瀏覽代碼

api 海报信息

dyjh 6 年之前
父節點
當前提交
ad07eaf84f

+ 0 - 1
app/Http/Controllers/Admin/Album/PosterController.php

xqd
@@ -45,7 +45,6 @@ class PosterController extends Controller
     private function updateSave()
     {
         $data = (array) request('data');
-
         if (!empty($data['posters']['url'])) {
             foreach ($data['posters']['url'] as $key => $val) {
                 $data['posters']['url'][$key] = $this->formatImgUrl($val);

+ 71 - 0
app/Http/Controllers/Api/V1/AlbumPosterController.php

xqd
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: 思维定制
+ * Date: 2019/3/4
+ * Time: 15:12
+ */
+
+namespace App\Http\Controllers\Api\V1;
+
+use App\Models\AlbumPosterModel;
+use App\Services\Base\ErrorCode;
+use Validator, Response,Auth;
+use Illuminate\Http\Request;
+
+class AlbumPosterController extends Controller
+{
+
+    /**
+     * @api {post} /api/album_post/info 获取海报数据(info)
+     * @apiDescription 获取海报数据(info)
+     * @apiGroup Album_Post
+     * @apiPermission 需要登录
+     * @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": [
+     *           'posters':'asdawd',  //海报
+     *           'words':'asdawd',    //话术
+     *           'introduce':'222',   //介绍
+     *           'share':'xxx'        //分享图片
+     *           'phone':'xxx'        //电话
+     *           'username':'xxx'     //姓名
+     *      ]
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function posterInfo(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if (!$userAuth) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
+        }
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+        ], [
+            'store_id.required' => '店铺信息未知',
+        ]);
+        if ($validator->fails()) {
+            return $this->validatorError($validator->messages()->all(), ErrorCode::CLIENT_WRONG_PARAMS, '');
+        }
+        $info = AlbumPosterModel::where('store_id', $request->input('store_id'))->first()->toArray();
+        $info['phone'] = $userAuth->phone;
+        $info['username'] = $userAuth->username;
+        return $this->api(compact('info'));
+    }
+}

+ 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','albumGetDataCatSingle','albumGetCountOfFavorite','albumGetUserInfo','albumStatistical'
+                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId','albumAddAgent','albumGetBanner','albumGetDataGoods','newgoods_list','newgoods_index','albumGetAgentAdress','albumSetCustomer','albumGetCustomer','albumGetDataCat','albumCustomerGoods','albumCustomerGoodsDetail','albumGetDataCatSingle','albumGetCountOfFavorite','albumGetUserInfo','albumStatistical','posterInfo'
             ]
         ]);
 

+ 47 - 0
public/apidoc/api_data.js

xqd
@@ -1548,6 +1548,53 @@ define({ "api": [
     "groupTitle": "Album",
     "name": "PostApiAlbumXyx_login"
   },
+  {
+    "type": "post",
+    "url": "/api/album_post/info",
+    "title": "获取海报数据(info)",
+    "description": "<p>获取海报数据(info)</p>",
+    "group": "Album_Post",
+    "permission": [
+      {
+        "name": "需要登录"
+      }
+    ],
+    "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          'posters':'asdawd',  //海报\n          'words':'asdawd',    //话术\n          'introduce':'222',   //介绍\n          'share':'xxx'        //分享图片\n          'phone':'xxx'        //电话\n          'username':'xxx'     //姓名\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/AlbumPosterController.php",
+    "groupTitle": "Album_Post",
+    "name": "PostApiAlbum_postInfo"
+  },
   {
     "type": "get",
     "url": "/api/attachment/delete/{md5}",

+ 47 - 0
public/apidoc/api_data.json

xqd
@@ -1548,6 +1548,53 @@
     "groupTitle": "Album",
     "name": "PostApiAlbumXyx_login"
   },
+  {
+    "type": "post",
+    "url": "/api/album_post/info",
+    "title": "获取海报数据(info)",
+    "description": "<p>获取海报数据(info)</p>",
+    "group": "Album_Post",
+    "permission": [
+      {
+        "name": "需要登录"
+      }
+    ],
+    "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          'posters':'asdawd',  //海报\n          'words':'asdawd',    //话术\n          'introduce':'222',   //介绍\n          'share':'xxx'        //分享图片\n          'phone':'xxx'        //电话\n          'username':'xxx'     //姓名\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/AlbumPosterController.php",
+    "groupTitle": "Album_Post",
+    "name": "PostApiAlbum_postInfo"
+  },
   {
     "type": "get",
     "url": "/api/attachment/delete/{md5}",

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -9,7 +9,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-02-20T02:53:07.058Z",
+    "time": "2019-03-04T07:36:50.983Z",
     "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-20T02:53:07.058Z",
+    "time": "2019-03-04T07:36:50.983Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 5 - 0
routes/api.php

xqd
@@ -298,6 +298,11 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'uses' => 'AlbumController@albumGetDataGoods',
     ]);
 
+    $api->post('album_post/info', [
+        'as' => 'album_post.info',
+        'uses' => 'AlbumPosterController@posterInfo',
+    ]);
+
     $api->get('album/get-customer', [
         'as' => 'album.get-customer',
         'uses' => 'AlbumController@albumGetCustomer',