数据统计
This commit is contained in:
@@ -404,19 +404,26 @@ class StatsController extends Controller
|
|||||||
$isAdmin = $this->request->userInfo['isAdmin'];
|
$isAdmin = $this->request->userInfo['isAdmin'];
|
||||||
|
|
||||||
|
|
||||||
$device = Db::name('device')->where(['companyId' => $companyId,'deleteTime' => 0]);
|
$where = [
|
||||||
$wechat = Db::name('wechat_customer')->where(['companyId' => $companyId]);
|
['departmentId','=',$companyId]
|
||||||
$contentLibrary = Db::name('content_library')->where(['companyId' => $companyId,'isDel' => 0]);
|
];
|
||||||
$user = Db::name('wechat_friendship')->where(['companyId' => $companyId,'deleteTime' => 0]);
|
if (!empty($this->request->userInfo['isAdmin'])){
|
||||||
|
$where[] = ['id','=',$this->request->userInfo['s2_accountId']];
|
||||||
|
}
|
||||||
|
$accounts = Db::table('s2_company_account')->where($where)->column('id');
|
||||||
|
|
||||||
|
|
||||||
|
$userNum = Db::table('s2_wechat_friend')->whereIn('accountId',$accounts)->where(['isDeleted' => 0])->count();
|
||||||
|
$deviceNum = Db::table('s2_device')->whereIn('currentAccountId',$accounts)->where(['isDeleted' => 0])->count();
|
||||||
|
$wechatNum = Db::table('s2_wechat_account')->whereIn('deviceAccountId',$accounts)->count();
|
||||||
|
|
||||||
|
|
||||||
|
$contentLibrary = Db::name('content_library')->where(['companyId' => $companyId,'isDel' => 0]);
|
||||||
if(empty($isAdmin)){
|
if(empty($isAdmin)){
|
||||||
$contentLibrary = $contentLibrary->where(['userId' => $userId]);
|
$contentLibrary = $contentLibrary->where(['userId' => $userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$deviceNum = $device->count();
|
|
||||||
$wechatNum = $wechat->count();
|
|
||||||
$contentLibraryNum = $contentLibrary->count();
|
$contentLibraryNum = $contentLibrary->count();
|
||||||
$userNum = $user->count();
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'deviceNum' => $deviceNum,
|
'deviceNum' => $deviceNum,
|
||||||
|
|||||||
Reference in New Issue
Block a user