wesley.chen %!s(int64=7) %!d(string=hai) anos
pai
achega
043bfd8670

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

xqd
@@ -21,7 +21,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', 'test',
+                'get', 'area', 'get_province', 'get_city', 'get_county', 'test','introduction','indexSetting'
 
             ]
         ]);

+ 56 - 0
app/Http/Controllers/Api/V1/HomeController.php

xqd
@@ -0,0 +1,56 @@
+<?php
+namespace App\Http\Controllers\Api\V1;
+
+use App\Models\IntroductionInfoModel;
+use App\Models\MajorInfoModel;
+
+
+class HomeController extends Controller{
+
+    /**
+     * @api {get} /api/home/introduction获取使用说用及协议
+     * @apiDescription 获取使用说用及协
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "list": [
+     *
+     *          ]
+     *
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function introduction(){
+        $list = IntroductionInfoModel::get(['title','content','type']);
+
+        return $this->api(compact('list'));
+    }
+
+
+
+    public function indexSetting(){
+        $batchs = MajorInfoModel::groupBy('batch')->pluck('batch');
+
+        $provinces = [
+            "全部省份","安徽","澳门","北京","重庆","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","台湾","天津","西藏","香港","新疆","云南","浙江"
+        ];
+
+        return $this->api(compact('batchs','provinces'));
+    }
+}

+ 11 - 0
routes/api.php

xqd
@@ -63,4 +63,15 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'auth.is_login',
         'uses' => 'AuthController@isLogin',
     ]);
+
+    $api->get('home/introduction', [
+        'as' => 'home.introduction',
+        'uses' => 'HomeController@introduction',
+    ]);
+
+    $api->get('home/indexsetting', [
+        'as' => 'home.indexsetting',
+        'uses' => 'HomeController@indexSetting',
+    ]);
+
 });