@@ -6,7 +6,7 @@ use Illuminate\Support\Facades\DB;
useApp\Laravue\Models\Users;
useIlluminate\Http\Request;
useApp\Http\Controllers\Controller;
useIlluminate\Support\Facades\Auth;
classSwooleCommandControllerextendsController
{
//返回用户列表
...
...
@@ -16,15 +16,17 @@ class SwooleCommandController extends Controller
$usercount=DB::table('users')->count();//获取用户数量
//查询设备类型
$count=DB::table('users as b')
->leftjoin('device as d','b.id','=','d.uid')
->leftjoin('device_type as t','d.dtype','=','t.tid')
->leftjoin('device as d','b.id','=','d.uid')
->leftjoin('device_type as t','d.dtype','=','t.tid')
->selectRaw('b.name,count(IF(d.dtype=1,true,null)) AS type_1, COUNT(IF(t.tid=2, true, null)) AS type_2,COUNT(IF(t.tid=4, true, null)) AS type_4,COUNT(IF(t.tid=5, true, null)) AS type_5,COUNT(IF(t.tid=6, true, null)) AS type_6,COUNT(IF(t.tid=7, true, null)) AS type_7,COUNT(IF(t.tid=8, true, null)) AS type_8,COUNT(IF(t.tid=9, true, null)) AS type_9,COUNT(IF(t.tid=10, true, null)) AS type_10,COUNT(IF(t.tid=11, true, null)) AS type_11')