dyjh před 6 roky
rodič
revize
09175691b5

+ 153 - 3
app/Http/Controllers/Api/V1/AlbumBossController.php

xqd xqd xqd 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)
@@ -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
      * {
@@ -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);
@@ -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);
     }
 }

+ 1 - 1
app/Http/Controllers/Api/V1/Controller.php

xqd
@@ -23,7 +23,7 @@ class Controller extends BaseController
             'except' => [
                 'upload', 'getCode', 'reset', 'login', 'get', 'register', 'alipayNotify', 'wechatpayNotify', 'get', 'area', 'get_province', 'get_city', 'get_county', 'albumStyle', 'test', 'index', 'companyInfo', 'shop2', 'cardIndex', 'cardUserInfo', 'cardUserProgress', 'cardUserHonor', 'cardUserProject', 'CardUserTrend', 'projectDetail', 'trendDetail', 'albumSetting', 'albumXyxLogin', 'albumCat', 'albumchecklogin', 'albumGoods', 'albumGoodsDetail', 'albumSetPrice', 'albumXcxLogin', 'albumContentList', 'albumSearchGoods','albumContentDetail','albumFavoriteList','albumAddFavorite','albumFavoriteDel','getAttr','getOrder','getProgress','getReviewCount', 'furnitureNewsDetail','furnitureSetting','furnitureXcxLogin','furnitureGoodsList','serviceLogin','getFurnitureAds','getPhoneNumber','getQrcode','orderCount','searchList','printOrder','saveFormId','furnitureNewsList','getMoreComments','addToLike','albumSavePhone','albumGetStatistical','test',
                 'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail','albumGetDataCatSingle','albumGetCountOfFavorite','albumGetUserInfo','albumStatistical','posterInfo','createPoster','posterDel','albumAgentPriceSet', 'getTop', 'agentCustomer'
-                , 'agentStatistical', 'albumOverviewActive', 'albumOverviewLeft', 'albumOverviewFavorite', 'albumOverviewNew', 'agentAnalysis'
+                , 'agentStatistical', 'albumOverviewActive', 'albumOverviewLeft', 'albumOverviewFavorite', 'albumOverviewNew', 'agentAnalysis', 'albumOverviewFunnel', 'albumOverviewCall'
             ]
         ]);
 

+ 108 - 0
public/apidoc/api_data.js

xqd xqd xqd
@@ -2243,6 +2243,60 @@ define({ "api": [
     "groupTitle": "Boss",
     "name": "PostApiAlbum_bossAgent_overview_active"
   },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview_call",
+    "title": "经销商总览咨询(agent_overview_call)",
+    "description": "<p>经销商总览咨询(agent_overview_call)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "day",
+            "description": "<p>天数</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"callCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview_call"
+  },
   {
     "type": "post",
     "url": "/api/album_boss/agent_overview_favorite",
@@ -2311,6 +2365,53 @@ define({ "api": [
     "groupTitle": "Boss",
     "name": "PostApiAlbum_bossAgent_overview_favorite"
   },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview_funnel",
+    "title": "经销商总览漏斗(agent_overview_funnel)",
+    "description": "<p>经销商总览漏斗(agent_overview_funnel)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"customerFollow\":11,\n        \"shareCount\":11,\n        \"totalCustomerCount\":11,\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview_funnel"
+  },
   {
     "type": "post",
     "url": "/api/album_boss/agent_overview_left",
@@ -2393,6 +2494,13 @@ define({ "api": [
             "optional": true,
             "field": "store_id",
             "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "day",
+            "description": "<p>天数</p>"
           }
         ]
       }

+ 108 - 0
public/apidoc/api_data.json

xqd xqd xqd
@@ -2243,6 +2243,60 @@
     "groupTitle": "Boss",
     "name": "PostApiAlbum_bossAgent_overview_active"
   },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview_call",
+    "title": "经销商总览咨询(agent_overview_call)",
+    "description": "<p>经销商总览咨询(agent_overview_call)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "day",
+            "description": "<p>天数</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"callCustomers\": [\n             {\n                 \"day\" : 03/25,\n                 \"num\" : 111\n             }\n         ]\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview_call"
+  },
   {
     "type": "post",
     "url": "/api/album_boss/agent_overview_favorite",
@@ -2311,6 +2365,53 @@
     "groupTitle": "Boss",
     "name": "PostApiAlbum_bossAgent_overview_favorite"
   },
+  {
+    "type": "post",
+    "url": "/api/album_boss/agent_overview_funnel",
+    "title": "经销商总览漏斗(agent_overview_funnel)",
+    "description": "<p>经销商总览漏斗(agent_overview_funnel)</p>",
+    "group": "Boss",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n        \"customerFollow\":11,\n        \"shareCount\":11,\n        \"totalCustomerCount\":11,\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/AlbumBossController.php",
+    "groupTitle": "Boss",
+    "name": "PostApiAlbum_bossAgent_overview_funnel"
+  },
   {
     "type": "post",
     "url": "/api/album_boss/agent_overview_left",
@@ -2393,6 +2494,13 @@
             "optional": true,
             "field": "store_id",
             "description": "<p>商户id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "day",
+            "description": "<p>天数</p>"
           }
         ]
       }

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -9,7 +9,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-04-17T05:43:27.159Z",
+    "time": "2019-04-17T06:56:10.150Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 1 - 1
public/apidoc/api_project.json

xqd
@@ -9,7 +9,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-04-17T05:43:27.159Z",
+    "time": "2019-04-17T06:56:10.150Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 10 - 0
routes/api.php

xqd
@@ -536,4 +536,14 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'uses' => 'AlbumBossController@agentAnalysis',
     ]);
 
+    $api->post('album_boss/agent_overview_call', [
+        'as' => 'album_boss.agent_overview_call',
+        'uses' => 'AlbumBossController@albumOverviewCall',
+    ]);
+
+    $api->post('album_boss/agent_overview_funnel', [
+        'as' => 'album_boss.agent_overview_funnel',
+        'uses' => 'AlbumBossController@albumOverviewFunnel',
+    ]);
+
 });