| xqd
@@ -467,6 +467,150 @@ class AlbumBossController extends Controller
|
|
|
return $this->api(compact('totalCustomerCount', 'newCustomerCount', 'shareCount', 'downloadCount', 'customerFollow'));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @api {post} /api/album_boss/agent_overview_funnel 经销商总览漏斗(agent_overview_funnel)
|
|
|
+ * @apiDescription 经销商总览漏斗(agent_overview_funnel)
|
|
|
+ * @apiGroup Boss
|
|
|
+ * @apiPermission none
|
|
|
+ * @apiVersion 0.1.0
|
|
|
+ * @apiParam {int} [store_id] 商户id
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
+ * {
|
|
|
+ * "status": true,
|
|
|
+ * "status_code": 0,
|
|
|
+ * "message": "",
|
|
|
+ * "data": {
|
|
|
+ * "customerFollow":11,
|
|
|
+ * "shareCount":11,
|
|
|
+ * "totalCustomerCount":11,
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
+ * HTTP/1.1 400 Bad Request
|
|
|
+ * {
|
|
|
+ * "state": false,
|
|
|
+ * "code": 1000,
|
|
|
+ * "message": "传入参数不正确",
|
|
|
+ * "data": null or []
|
|
|
+ * }
|
|
|
+ * 可能出现的错误代码:
|
|
|
+ * 1000 CLIENT_WRONG_PARAMS 传入参数不正确
|
|
|
+ */
|
|
|
+ public function albumOverviewFunnel(Request $request)
|
|
|
+ {
|
|
|
+
|
|
|
+ $userAuth = Auth('api')->user();
|
|
|
+ if (!$userAuth) {
|
|
|
+ return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
|
|
|
+ }
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
+ 'store_id' => 'required',
|
|
|
+ ], [
|
|
|
+ 'store_id.required' => '缺少商户参数',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($userAuth->role != 4) {
|
|
|
+ return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($validator->fails()) {
|
|
|
+ return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
|
+ }
|
|
|
+
|
|
|
+ $store_id = $request->input('store_id');
|
|
|
+
|
|
|
+ $customerFollow = CustomerDetailsModel::where('store_id', $store_id)->count();
|
|
|
+ $shareCount = AlbumWatchRecord::where([
|
|
|
+ ['store_id', $store_id],
|
|
|
+ ['action', 8],
|
|
|
+ ])->orderByDesc('id')->count();
|
|
|
+
|
|
|
+ $totalCustomerCount = AlbumWatchRecord::where([
|
|
|
+ ['store_id', $store_id],
|
|
|
+ ])->orderByDesc('id')->groupBy('open_id')->count();
|
|
|
+ return $this->api(compact('totalCustomerCount', 'shareCount', 'customerFollow'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @api {post} /api/album_boss/agent_overview_call 经销商总览咨询(agent_overview_call)
|
|
|
+ * @apiDescription 经销商总览咨询(agent_overview_call)
|
|
|
+ * @apiGroup Boss
|
|
|
+ * @apiPermission none
|
|
|
+ * @apiVersion 0.1.0
|
|
|
+ * @apiParam {int} [store_id] 商户id
|
|
|
+ * @apiParam {int} [day] 天数
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
+ * {
|
|
|
+ * "status": true,
|
|
|
+ * "status_code": 0,
|
|
|
+ * "message": "",
|
|
|
+ * "data": {
|
|
|
+ * "callCustomers": [
|
|
|
+ * {
|
|
|
+ * "day" : 03/25,
|
|
|
+ * "num" : 111
|
|
|
+ * }
|
|
|
+ * ]
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
+ * HTTP/1.1 400 Bad Request
|
|
|
+ * {
|
|
|
+ * "state": false,
|
|
|
+ * "code": 1000,
|
|
|
+ * "message": "传入参数不正确",
|
|
|
+ * "data": null or []
|
|
|
+ * }
|
|
|
+ * 可能出现的错误代码:
|
|
|
+ * 1000 CLIENT_WRONG_PARAMS 传入参数不正确
|
|
|
+ */
|
|
|
+ public function albumOverviewCall(Request $request)
|
|
|
+ {
|
|
|
+
|
|
|
+ $userAuth = Auth('api')->user();
|
|
|
+ if (!$userAuth) {
|
|
|
+ return $this->error(ErrorCode::ERROR_POWER, '登陆过期!');
|
|
|
+ }
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
+ 'store_id' => 'required',
|
|
|
+ ], [
|
|
|
+ 'store_id.required' => '缺少商户参数',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if ($userAuth->role != 4) {
|
|
|
+ return $this->error(ErrorCode::NOT_BOSS, '该用户没有Boss权限');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($validator->fails()) {
|
|
|
+ return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
|
+ }
|
|
|
+
|
|
|
+ $store_id = $request->input('store_id');
|
|
|
+ $day = $request->input('day');
|
|
|
+ $callCustomers = array();
|
|
|
+ for ($d = 0; $d < $day; $d++) {
|
|
|
+ $StartO = mktime(0, 0, 0, date('m'), date('d'), date('y')) - 86400 * $d;
|
|
|
+ $EndO = $StartO + 86400;
|
|
|
+ $End = date('Y-m-d H:i:s', $EndO);
|
|
|
+ $Start = date('Y-m-d H:i:s', $StartO);
|
|
|
+ $callCustomer = AlbumWatchRecord::where([
|
|
|
+ ['store_id', $store_id],
|
|
|
+ ['action', 7],
|
|
|
+ ['updated_at','>=',$Start],
|
|
|
+ ['updated_at','<=',$End]
|
|
|
+ ])->orderByDesc('id')->count();
|
|
|
+ $callCustomers[] = [
|
|
|
+ 'day' => date('m', $StartO) . '-' . date('d', $EndO),
|
|
|
+ 'num' => $callCustomer
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return $this->api($callCustomers);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @api {post} /api/album_boss/agent_overview_favorite 经销商总览兴趣占比(agent_overview_favorite)
|
|
|
* @apiDescription 经销商总览兴趣占比(agent_overview_favorite)
|
| xqd
@@ -567,6 +711,7 @@ class AlbumBossController extends Controller
|
|
|
* @apiPermission none
|
|
|
* @apiVersion 0.1.0
|
|
|
* @apiParam {int} [store_id] 商户id
|
|
|
+ * @apiParam {int} [day] 天数
|
|
|
* @apiSuccessExample {json} Success-Response:
|
|
|
* HTTP/1.1 200 OK
|
|
|
* {
|
| xqd
@@ -615,9 +760,9 @@ class AlbumBossController extends Controller
|
|
|
}
|
|
|
|
|
|
$store_id = $request->input('store_id');
|
|
|
-
|
|
|
+ $day = $request->input('day');
|
|
|
$newCustomers = array();
|
|
|
- for ($d = 0; $d < 15; $d++) {
|
|
|
+ for ($d = 0; $d < $day; $d++) {
|
|
|
$StartO = mktime(0, 0, 0, date('m'), date('d'), date('y')) - 86400 * $d;
|
|
|
$EndO = $StartO + 86400;
|
|
|
$End = date('Y-m-d H:i:s', $EndO);
|
| xqd
@@ -691,7 +836,12 @@ class AlbumBossController extends Controller
|
|
|
return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
|
|
|
}
|
|
|
$store_id = $request->input('store_id');
|
|
|
- $agent = AlbumAgentModel::where('store_id', $store_id)->orderByDesc('newCount')->select('realname', 'pointCount', 'callCount', 'favoriteCount', 'get_count', 'share_times', 'newCount')->paginate(12);
|
|
|
+
|
|
|
+ $agent = AlbumAgentModel::where('store_id', $store_id)->orderByDesc('newCount')->select('user_id', 'realname', 'pointCount', 'callCount', 'favoriteCount', 'get_count', 'share_times', 'newCount')->paginate(12);
|
|
|
+ foreach ($agent as $value) {
|
|
|
+ $user = AlbumUserModel::where([['id', $value->user_id], ['store_id', $store_id]])->first(['avatar']);
|
|
|
+ $value->avatar = $user->avatar;
|
|
|
+ }
|
|
|
return $this->api($agent);
|
|
|
}
|
|
|
}
|