This commit is contained in:
wong
2025-08-15 18:30:03 +08:00
parent 25ae2458f0
commit 639d7d3cb6
3 changed files with 89 additions and 2 deletions

View File

@@ -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, '获取成功');
}
}