1
This commit is contained in:
@@ -197,7 +197,13 @@ class StatsController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 场景获客数据统计
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function getFriendRequestTaskStats()
|
||||
{
|
||||
$companyId = $this->request->userInfo['companyId'];
|
||||
@@ -347,5 +353,35 @@ class StatsController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function userInfoStats()
|
||||
{
|
||||
$companyId = $this->request->userInfo['companyId'];
|
||||
$userId = $this->request->userInfo['id'];
|
||||
$isAdmin = $this->request->userInfo['isAdmin'];
|
||||
|
||||
|
||||
$device = Db::name('device')->where(['companyId' => $companyId,'deleteTime' => 0]);
|
||||
$wechat = Db::name('wechat_customer')->where(['companyId' => $companyId]);
|
||||
$contentLibrary = Db::name('content_library')->where(['companyId' => $companyId,'isDel' => 0]);
|
||||
$user = Db::name('wechat_friendship')->where(['companyId' => $companyId,'deleteTime' => 0]);
|
||||
|
||||
if(empty($isAdmin)){
|
||||
$contentLibrary = $contentLibrary->where(['userId' => $userId]);
|
||||
}
|
||||
|
||||
$deviceNum = $device->count();
|
||||
$wechatNum = $wechat->count();
|
||||
$contentLibraryNum = $contentLibrary->count();
|
||||
$userNum = $user->count();
|
||||
|
||||
$data = [
|
||||
'deviceNum' => $deviceNum,
|
||||
'wechatNum' => $wechatNum,
|
||||
'contentLibraryNum' => $contentLibraryNum,
|
||||
'userNum' => $userNum,
|
||||
];
|
||||
return successJson($data, '获取成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user