1
This commit is contained in:
@@ -130,13 +130,14 @@ Route::group('v1/', function () {
|
||||
});
|
||||
|
||||
|
||||
//数据统计相关
|
||||
//数据统计相关
|
||||
Route::group('dashboard',function (){
|
||||
Route::get('', 'app\cunkebao\controller\StatsController@baseInfoStats');
|
||||
Route::get('plan-stats', 'app\cunkebao\controller\StatsController@planStats');
|
||||
Route::get('sevenDay-stats', 'app\cunkebao\controller\StatsController@customerAcquisitionStats7Days');
|
||||
Route::get('today-stats', 'app\cunkebao\controller\StatsController@todayStats');
|
||||
Route::get('friendRequestTaskStats', 'app\cunkebao\controller\StatsController@getFriendRequestTaskStats');
|
||||
Route::get('userInfoStats', 'app\cunkebao\controller\StatsController@userInfoStats');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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