瀏覽代碼

Update api

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

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

xqd xqd
@@ -8,6 +8,7 @@ use App\Models\AlbumBannerModel;
 use App\Models\AlbumCatModel;
 use App\Models\AlbumCommentsModel;
 use App\Models\AlbumFavoriteModel;
+use App\Models\AlbumFormId;
 use App\Models\AlbumInformationModel;
 use App\Models\AlbumManufacturerModel;
 use App\Models\AlbumNavModel;
@@ -957,6 +958,65 @@ class AlbumController extends Controller
         return $this->api($d);
     }
 
+
+    /**
+     * @api {get} /api/album/save_form_id 添加Form_id(save_form_id)
+     * @apiDescription 添加Form_id(save_form_id)
+     * @apiGroup Album
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}    [store_id]  商户id
+     * @apiParam {int}    [form_id]  form_id
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": []//返回信息
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function albumSaveFormId(Request $request)
+    {
+        $userAuth = Auth('api')->user();
+        if(!$userAuth) return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '未登录!');
+        $validator = Validator::make($request->all(), [
+            'store_id' => 'required',
+            'form_id' => 'required',
+        ],[
+            'store_id.required'=>'缺少商户参数',
+            'form_id.required'=>'缺少FormId',
+        ]);
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+        $data = $request->input();
+        $data['open_id'] = $userAuth->wechat_open_id;
+        $res = AlbumFormId::create($data);
+        if($res){
+            $d = [
+                'code' =>0,
+                'msg' =>'success',
+            ];
+        }else{
+            $d = [
+                'code' =>1,
+                'msg' =>'error',
+            ];
+        }
+        return $this->api($d);
+    }
+
     /**
      * @api {get} /api/album/add_favorite 添加收藏(add_favorite)
      * @apiDescription 添加收藏(favorite_list)

+ 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'
+                'albumGetWatchRecord','albumSetWatch','albumGetCartOfWatch','albumSaveFormId'
             ]
         ]);
 

+ 41 - 0
app/Models/AlbumFormId.php

xqd
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: 思维定制
+ * Date: 2018/11/21
+ * Time: 16:30
+ */
+
+namespace App\Models;
+
+
+class AlbumFormId extends BaseModel
+{
+    protected $dates = ['delete_at'];
+
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'album_form_id';
+    /**
+    主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+        'form_id',
+        'open_id',
+        'store_id'
+    ];
+}

+ 34 - 0
database/migrations/2018_11_21_162209_create_table_album_form_id.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableAlbumFormId extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('album_form_id', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('open_id',100)->comment('open_id');
+            $table->string('form_id',100)->comment('form_id');
+            $table->string('store_id',100)->comment('store_id');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('album_form_id');
+    }
+}

+ 54 - 0
public/apidoc/api_data.js

xqd
@@ -411,6 +411,60 @@ define({ "api": [
     "groupTitle": "Album",
     "name": "GetApiAlbumGoodsDetail"
   },
+  {
+    "type": "get",
+    "url": "/api/album/save_form_id",
+    "title": "添加Form_id(save_form_id)",
+    "description": "<p>添加Form_id(save_form_id)</p>",
+    "group": "Album",
+    "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": "form_id",
+            "description": "<p>form_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}",
+          "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": "GetApiAlbumSave_form_id"
+  },
   {
     "type": "get",
     "url": "/api/album/set-price",

+ 54 - 0
public/apidoc/api_data.json

xqd
@@ -411,6 +411,60 @@
     "groupTitle": "Album",
     "name": "GetApiAlbumGoodsDetail"
   },
+  {
+    "type": "get",
+    "url": "/api/album/save_form_id",
+    "title": "添加Form_id(save_form_id)",
+    "description": "<p>添加Form_id(save_form_id)</p>",
+    "group": "Album",
+    "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": "form_id",
+            "description": "<p>form_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}",
+          "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": "GetApiAlbumSave_form_id"
+  },
   {
     "type": "get",
     "url": "/api/album/set-price",

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -9,7 +9,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2018-11-21T07:59:25.978Z",
+    "time": "2018-11-21T08:34:17.938Z",
     "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": "2018-11-21T07:59:25.978Z",
+    "time": "2018-11-21T08:34:17.938Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 5 - 0
routes/api.php

xqd
@@ -260,6 +260,11 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'uses' => 'AlbumController@albumSetWatch',
     ]);
 
+    $api->post('album/save_form_id', [
+        'as' => 'album.SaveFormId',
+        'uses' => 'AlbumController@albumSaveFormId',
+    ]);
+
     $api->get('album/search_goods', [
         'as' => 'album.search_goods',
         'uses' => 'AlbumController@albumSearchGoods',