Quellcode durchsuchen

Merge branch 'master' of http://git.9026.com/wesley/furniture

gq vor 6 Jahren
Ursprung
Commit
f7fd93286a

+ 72 - 0
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd
@@ -835,6 +835,7 @@ class AlbumController extends Controller
      * @apiPermission 需要登录
      * @apiVersion 0.1.0
      * @apiParam {int}    [store_id]  商户id 模拟值为0
+     * @apiParam {int}    [style_id]
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
      * {
@@ -899,6 +900,77 @@ class AlbumController extends Controller
     }
 
 
+    /**
+     * @api {post} /api/album/get_data_cat_single 单用户获取分类访问数据(get_data_cat_single)
+     * @apiDescription 单用户获取分类访问数据(get_data_cat_single)
+     * @apiGroup Album
+     * @apiPermission 需要登录
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id 模拟值为0
+     * @apiParam {int}    [open_id]
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": [
+     *          {
+     *              "1": [
+     *                  'name':'asdawd',
+     *                  'point':'asdawd',
+     *                  'num':'1',
+     *              ],
+     *          }
+     *      ]
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function albumGetDataCatSingle(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+            'open_id' => 'required'
+        ],[
+            'store_id.required'=>'缺少商户参数',
+            'open_id.required'=>'缺少风格参数',
+        ]);
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+        $store_id = $request->input('store_id');
+        $open_id = $request->input('open_id');
+        if($userAuth->is_dealer!=1) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '该用户不是经销商!', $validator->messages());
+
+        $user_agent = AlbumAgentModel::where('user_id',$userAuth->id)->first();
+        $cat = AlbumCatModel::where('store_id',$store_id)->get(['name','id'])->toArray();
+        $total = 0;
+        foreach ($cat as $key=>$val){
+            $count = CustomerCatRecordModel::where([['agent_id',$user_agent->id],['store_id',$store_id],['open_id',$open_id],['cat_id',$val['id']]])->count();
+            $total += $count;
+            $cat[$key]['num'] = $count;
+        }
+        foreach($cat as $key=>$val){
+            if($val['num']==0||$total==0){
+                $cat[$key]['point']=0;
+            }else{
+                $cat[$key]['point'] = ($val['num']/$total*100).'%';
+            }
+        }
+        return $this->api(compact('cat'));
+    }
+
     /**
      * @api {post} /api/album/get-cart-of-watch 客户浏览情况概览(get-cart-of-watch)
      * @apiDescription 客户浏览情况概览(get-cart-of-watch)

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

xqd
@@ -22,7 +22,7 @@ class Controller extends BaseController
         $this->middleware('auth:api', [
             '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',
-                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail'
+                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail','albumGetDataCatSingle',
             ]
         ]);
 

+ 61 - 0
public/apidoc/api_data.js

xqd xqd
@@ -995,6 +995,13 @@ define({ "api": [
             "optional": true,
             "field": "store_id",
             "description": "<p>商户id 模拟值为0</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "style_id",
+            "description": ""
           }
         ]
       }
@@ -1021,6 +1028,60 @@ define({ "api": [
     "groupTitle": "Album",
     "name": "PostApiAlbumGet_data_cat"
   },
+  {
+    "type": "post",
+    "url": "/api/album/get_data_cat_single",
+    "title": "单用户获取分类访问数据(get_data_cat_single)",
+    "description": "<p>单用户获取分类访问数据(get_data_cat_single)</p>",
+    "group": "Album",
+    "permission": [
+      {
+        "name": "需要登录"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id 模拟值为0</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "open_id",
+            "description": ""
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": [\n         {\n             \"1\": [\n                 'name':'asdawd',\n                 'point':'asdawd',\n                 'num':'1',\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/AlbumController.php",
+    "groupTitle": "Album",
+    "name": "PostApiAlbumGet_data_cat_single"
+  },
   {
     "type": "post",
     "url": "/api/album/get_data_goods",

+ 61 - 0
public/apidoc/api_data.json

xqd xqd
@@ -995,6 +995,13 @@
             "optional": true,
             "field": "store_id",
             "description": "<p>商户id 模拟值为0</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "style_id",
+            "description": ""
           }
         ]
       }
@@ -1021,6 +1028,60 @@
     "groupTitle": "Album",
     "name": "PostApiAlbumGet_data_cat"
   },
+  {
+    "type": "post",
+    "url": "/api/album/get_data_cat_single",
+    "title": "单用户获取分类访问数据(get_data_cat_single)",
+    "description": "<p>单用户获取分类访问数据(get_data_cat_single)</p>",
+    "group": "Album",
+    "permission": [
+      {
+        "name": "需要登录"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "store_id",
+            "description": "<p>商户id 模拟值为0</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "open_id",
+            "description": ""
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": [\n         {\n             \"1\": [\n                 'name':'asdawd',\n                 'point':'asdawd',\n                 'num':'1',\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/AlbumController.php",
+    "groupTitle": "Album",
+    "name": "PostApiAlbumGet_data_cat_single"
+  },
   {
     "type": "post",
     "url": "/api/album/get_data_goods",

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -9,7 +9,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-02-03T05:13:41.572Z",
+    "time": "2019-02-09T16:27:44.648Z",
     "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-02-03T05:13:41.572Z",
+    "time": "2019-02-09T16:27:44.648Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 5 - 0
routes/api.php

xqd
@@ -313,6 +313,11 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'uses' => 'AlbumController@albumGetDataCat',
     ]);
 
+
+    $api->post('album/get_data_cat_single', [
+        'as' => 'album.get_data_cat_single',
+        'uses' => 'AlbumController@albumGetDataCatSingle',
+    ]);
     $api->get('album/favorite_list', [
         'as' => 'album.favorite_list',
         'uses' => 'AlbumController@albumFavoriteList',