gq 8 years ago
parent
commit
10ec98e4f7

+ 2 - 2
server/app/Http/Controllers/Api/V1/HomeController.php

xqd xqd
@@ -176,7 +176,7 @@ class HomeController extends Controller
      * @apiGroup Home
      * @apiPermission Passport
      * @apiVersion 0.1.0
-     * @apiParam {int} user_id 用户ID
+     * @apiParam {int} user_id 互动对象ID
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
      * {
@@ -289,7 +289,7 @@ class HomeController extends Controller
         return $this->api(compact('dream1','dream2'));
     }
     /**
-     * @api {post} /api/Home/paihang 排行
+     * @api {post} /api/user/paihang 排行
      * @apiDescription 排行
      * @apiGroup Home
      * @apiPermission Passport

+ 182 - 3
server/app/Http/Controllers/Api/V1/IndexController.php

xqd xqd
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\V1;
 
 use App\Models\BaseSettingsModel;
 use App\Models\DreamInfoModel;
+use App\Models\SearchInfoModel;
 use App\Models\UserInfoModel;
 use Illuminate\Http\Request;
 use App\Services\Base\ErrorCode;
@@ -41,16 +42,194 @@ class IndexController extends Controller
     {
         $user = $this->getUser();
 //获取轮播图
-        $banner = BaseSettingsModel::where(['category' => 'banner'])->where(['status' => '1'])
-            ->orderBy('sort')->limit('3')->get()->toArray();
+        $banner = $this->getBanner();
 //        关注的用户
        $other_user =  $user->UserCareUser;
 //        获取其他用户信息 及梦想
-        $dreams = DreamInfoModel::orderBy('created_at')->get();
+        $dreams = DreamInfoModel::orderBy('score','desc')->limit(20)->get();
         foreach ($dreams as $k => $dream) {
             $dream->dream_find_user =  $dream->dreamFindUser;
             $dream->dream_first_pic =  $dream->dreamImgsFirst;
         }
         return $this->api(compact('banner','other_user','dreams'));
     }
+
+    /**
+     * @api {get} /api/index/trend 潮流(trend)
+     * @apiDescription 潮流(trend)
+     * @apiGroup Index
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {string}  phone   手机号码
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "state": true,
+     *     "code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "verify_code": "1234"//该值调试时使用,sms调通后取消
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function trend(Request $request)
+    {
+        $user = $this->getUser();
+//        关注的用户
+        $other_user =  $user->UserCareUser;
+//        获取其他用户信息 及梦想
+        $dreams = DreamInfoModel::orderBy('score','desc')->offset(20)->limit(100)->get();
+        foreach ($dreams as $k => $dream) {
+            $dream->dream_find_user =  $dream->dreamFindUser;
+            $dream->dream_first_pic =  $dream->dreamImgsFirst;
+        }
+        return $this->api(compact('other_user','dreams'));
+    }
+
+    /**
+     * @api {get} /api/index/new 最新(news)
+     * @apiDescription 最新(news)
+     * @apiGroup Index
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {string}  phone   手机号码
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "state": true,
+     *     "code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "verify_code": "1234"//该值调试时使用,sms调通后取消
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function news(Request $request)
+    {
+        $user = $this->getUser();
+//        关注的用户
+        $other_user =  $user->UserCareUser;
+//        获取其他用户信息 及梦想
+        $dreams = DreamInfoModel::orderBy('score','desc')->offset(100)->limit(500)->get();
+        foreach ($dreams as $k => $dream) {
+            $dream->dream_find_user =  $dream->dreamFindUser;
+            $dream->dream_first_pic =  $dream->dreamImgsFirst;
+        }
+        return $this->api(compact('other_user','dreams'));
+    }
+
+    /**
+     * @api {get} {post} /api/index/search 搜索(search) get post
+     * @apiDescription 搜索(search)
+     * @apiGroup Index
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {string}  keyword   关键字
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *     get
+     *{
+     *    "status": true,
+     *  "status_code": 0,
+     *  "message": "",
+     *  "data": {
+     *      "arr": {    // 热门搜索
+     *       ...
+     *      },
+     *      "data1": [
+     *          {
+     *              "search": "ha",  //  历史搜索
+     *          }
+     *      ]
+     *  }
+     *}
+     * post
+     * {
+     *   "status": true,
+     *   "status_code": 0,
+     *   "message": "",
+     *   "data": {
+     *      "data1": [
+     *          ...  //用户
+     *       ],
+     *       "data2": [
+     *            ...   //梦想
+     *       ],
+     *      "data3": [
+     *            ...   //标签
+     *       ]
+     *    }
+     *}
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     */
+    public function search(Request $request)
+    {
+        $user = $this->getUser();
+
+        if ($request->method() == 'GET') {
+//            历史搜索
+            $data1  = $user->search()->orderBy('id','desc')->limit(10)->get();
+//            热门搜索
+            $data2 = SearchInfoModel::get();
+            $arr = [];
+            foreach ($data2 as $k => $v) {
+                if (count($arr) == 8) {
+                    break;
+                }
+                if (!array_key_exists($v->search,$arr)) {
+                    $arr[$v->search] = $v->times;
+                }else{
+                    $arr[$v->search] += $v->times;
+                }
+            }
+            arsort($arr);
+            return $this->api(compact('arr','data1'));
+        }
+
+        $validator = \Validator::make($request->all(),
+            [
+                'keyword'  => 'required',
+            ],
+            [
+                'keyword.required'  => '关键字必填',
+            ]
+        );
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $keyword ='%'.$request->keyword.'%';
+        $data1 = UserInfoModel::where('nickname','like',$keyword)->get();
+        $data2 = DreamInfoModel::where('dream','like',$keyword)->
+            orWhere('dream','like',$keyword)->get();
+        $data3  = BaseSettingsModel::where('category','sign')->get();
+        return $this->api(compact('data1','data2','data3'));
+    }
+
+    //获取轮播图
+    public function getBanner()
+    {
+        $banner =  BaseSettingsModel::where(['category' => 'banner'])->where(['status' => '1'])
+            ->orderBy('sort')->limit('3')->get()->toArray();
+        return $banner;
+    }
 }

+ 386 - 0
server/app/Http/Controllers/Api/V1/MyController.php

xqd xqd xqd xqd
@@ -2,6 +2,8 @@
 
 namespace App\Http\Controllers\Api\V1;
 
+use App\Models\BaseDictionaryOptionModel;
+use App\Models\BaseSettingsModel;
 use App\Models\DreamImages;
 use App\Models\DreamInfoModel;
 use App\Models\ReplyCommentsInfo;
@@ -116,6 +118,379 @@ class MyController extends Controller
         return $this->api(compact('user'));
     }
 
+    /**
+     * @api {post} /api/my/nickname 修改昵称(nickname)
+     * @apiDescription 修改昵称(nickname)
+     * @apiGroup My
+     * @apiParam {string} nickname 昵称
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function nickname(Request $request)
+    {
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'nickname'  => 'required',
+            ],
+            [
+                'nickname.required'  => '昵称不能为空',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $nickname = $request->nickname;
+        $user->nickname = $nickname;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/sex 修改性别(sex get or post)
+     * @apiDescription 修改性别(sex)
+     * @apiGroup My
+     * @apiParam {sex} sex 性别
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *   get
+     *{
+     *   "status": true,
+     *   "status_code": 0,
+     *   "message": "",
+     *   "data": [
+     *       {
+     *           "value": "0",
+     *           "name": "男"
+     *       },
+     *       {
+     *          "value": "1",
+     *          "name": "女"
+     *       }
+     *    ]
+     *}
+     * post
+     * {
+     *   " status": true,
+     *   "status_code": 0,
+     *   "message": "",
+     *   "data": ""
+     *}
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function sex(Request $request)
+    {
+        if ($request->method() == 'GET') {
+            $data = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
+                where('dictionary_code','sex')->get();
+            return $this->api($data);
+        }
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'sex'  => 'required',
+            ],
+            [
+                'sex.required'  => '性别不能为空',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $sex = $request->sex;
+        $user->sex = $sex;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/signture 个性签名(signture)
+     * @apiDescription 个性签名(signture)
+     * @apiGroup My
+     * @apiParam {string} signture 个性签名
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * 保存
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     * 提交
+     * {
+     *  "status": false,
+     *  "status_code": 1000,
+     *   "message": "个性签名不能为空",
+     *   "data": null
+     *}
+     */
+    public function signture(Request $request)
+    {
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'signture'  => 'required',
+            ],
+            [
+                'signture.required'  => '个性签名不能为空',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $signture = $request->signture;
+        $user->signture = $signture;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/tel 修改手机号(tel)
+     * @apiDescription 修改手机号(tel)
+     * @apiGroup My
+     * @apiParam {int} tel 修改手机号
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function tel(Request $request)
+    {
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'tel'  => 'required|regex:/^1[34578][0-9]{9}$/',
+            ],
+            [
+                'tel.required'  => '手机号不能为空',
+                'tel.regex'  => '手机号格式不正确',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $tel = $request->tel;
+        $user->tel = $tel;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/job 工作类型(job  get or post)
+     * @apiDescription 工作类型(job)
+     * @apiGroup My
+     * @apiParam {string} job 工作类型
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function job(Request $request)
+    {
+        if ($request->method() == 'GET') {
+            $data = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
+            where('dictionary_code','job')->get();
+            return $this->api($data);
+        }
+
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'job'  => 'required',
+            ],
+            [
+                'job.required'  => '工作类型不能为空',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $job = $request->job;
+        $user->job = $job;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/job 情感状态(emotion  get or post)
+     * @apiDescription 情感状态(job)
+     * @apiGroup My
+     * @apiParam {int} emotion 情感状态
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function emotion(Request $request)
+    {
+        if ($request->method() == 'GET') {
+            $data = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
+            where('dictionary_code','emotion')->get();
+            return $this->api($data);
+        }
+
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'emotion'  => 'required',
+            ],
+            [
+                'emotion.required'  => '情感状态不能为空',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $emotion = $request->emotion;
+        $user->emotion = $emotion;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
+    /**
+     * @api {post} /api/my/tall 身高
+     * @apiDescription 身高
+     * @apiGroup My
+     * @apiParam {int} tall 身高
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @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
+     * {
+     *   "status": false,
+     *   "status_code": 600,
+     *   "message": "保存用户数据失败",
+     *   "data": null
+     *  }
+     */
+    public function tall(Request $request)
+    {
+        $user = $this->getUser();
+
+        $validator = \Validator::make($request->all(),
+            [
+                'tall'  => 'required|integer',
+            ],
+            [
+                'tall.required'  => '身高不能为空',
+                'tall.integer'  => '身高只能填写数字',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $tall = $request->tall;
+        $user->tall = $tall;
+        $ok = $user->save();
+
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::SAVE_USER_FAILED);
+    }
+
     /**
      * @api {get} /api/my/recharge 充值(recharge)
      * @apiDescription 充值(recharge)
@@ -368,6 +743,7 @@ class MyController extends Controller
        * @apiParam {string}  dream   梦想标题
        * @apiParam {string}  about   梦想介绍
        * @apiParam {int}  money   梦想币
+       * @apiParam {int}  time   实现时间默认21*3600
      * @apiGroup My
      * @apiPermission Passport
      * @apiVersion 0.1.0
@@ -396,17 +772,27 @@ class MyController extends Controller
                 'dream'  => 'required',
                 'about'  => 'required',
                 'money'  => 'required|integer',
+                'time'  => 'required|integer',
             ],
             [
                 'dream.required'  => '梦想标题必填',
                 'about.required'  => '梦想介绍必填',
                 'money.required'  => '梦想币必填',
+                'time.required'  => '实现时间必填',
                 'money.integer'  => '梦想币必须是正整数',
+                'time.integer'  => '实现时间必须是正整数',
             ]
         );
         if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
 
+        $data2 = $user->myCareNum;
+        $care_num = count($data2);
+        $key = BaseSettingsModel::where('category','paihang')->first();
+        $a = $key ->key;
+        $b = $key ->value;
+        $t = 21*3600 / 60;
         $data = $request->except('_token','pic');
+        $data['score'] = (log($care_num) + ($a/$t) + $b)*100000000 ;
         $data['created_at'] = date('Y-m-d H:i:s');
         $data['updated_at'] = date('Y-m-d H:i:s');
         $dream_id = DreamInfoModel::insertGetId($data);

+ 2 - 0
server/app/Models/BaseDictionaryOptionModel.php

xqd
@@ -37,4 +37,6 @@ class BaseDictionaryOptionModel extends BaseModel
         'sort'
     ];
 
+    protected $visible = ['value', 'name'];
+
 }

+ 1 - 1
server/app/Models/DreamInfoModel.php

xqd
@@ -42,7 +42,7 @@ class DreamInfoModel extends BaseModel
 
     public function dreamUser()
     {
-        return $this->belongsToMany('App\Models\UserInfoModel','user_dream','user_id','dream_id');
+        return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
     }
 
     public function dreamFindUser()

+ 16 - 0
server/app/Models/SearchInfoModel.php

xqd
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class SearchInfoModel extends Model
+{
+    protected $table = 'search_info';
+
+    protected $fillable = [
+        'user_id',
+        'search',
+        'times',
+    ];
+}

+ 6 - 0
server/app/Models/UserInfoModel.php

xqd
@@ -100,4 +100,10 @@ class UserInfoModel extends Authenticatable
         return $this->belongsToMany('App\Models\CommentInfoModel','reply_comments_info','user_id','comment_id')->withPivot('content', 'level','created_at');
     }
 
+//    搜索
+    public function search()
+    {
+        return $this->hasMany('App\Models\SearchInfoModel','user_id','id');
+    }
+
 }

+ 33 - 0
server/database/migrations/2017_06_19_150244_add_column_score_to_user_info.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnScoreToUserInfo extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('user_info', function (Blueprint $table) {
+            $table->integer('score')->comment('梦想排行分数')->default('')->after('status');
+            $table->integer('sup_score')->comment('支持乘数')->default('')->after('status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('user_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 33 - 0
server/database/migrations/2017_06_19_152544_add_column_score_to_dream_info.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnScoreToDreamInfo extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('dream_info', function (Blueprint $table) {
+            $table->integer('score')->comment('梦想排行分数')->default('')->after('status');
+            $table->string('sign')->comment('梦想标签')->default('')->after('about');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('dream_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 34 - 0
server/database/migrations/2017_06_19_181006_create_search_info_table.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateSearchInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('search_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->integer('user_id')->comment('用户ID');
+            $table->string('search')->comment('搜索内容');
+            $table->integer('times')->comment('搜索次数');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('search_info');
+    }
+}

+ 30 - 2
server/routes/api.php

xqd xqd
@@ -94,9 +94,9 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
     ]);
     $api->get('index/new', [
         'as' => 'index.new',
-        'uses' => 'IndexController@new',
+        'uses' => 'IndexController@news',
     ]);
-    $api->get('index/search', [
+    $api->any('index/search', [
         'as' => 'index.search',
         'uses' => 'IndexController@search',
     ]);
@@ -110,6 +110,34 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'my.persona',
         'uses' => 'MyController@persona',
     ]);
+    $api->post('my/nickname', [
+        'as' => 'my.nickname',
+        'uses' => 'MyController@nickname',
+    ]);
+    $api->any('my/sex', [
+        'as' => 'my.sex',
+        'uses' => 'MyController@sex',
+    ]);
+    $api->post('my/signture', [
+        'as' => 'my.signture',
+        'uses' => 'MyController@signture',
+    ]);
+    $api->post('my/tel', [
+        'as' => 'my.tel',
+        'uses' => 'MyController@tel',
+    ]);
+    $api->any('my/job', [
+        'as' => 'my.job',
+        'uses' => 'MyController@job',
+    ]);
+    $api->any('my/emotion', [
+        'as' => 'my.emotion',
+        'uses' => 'MyController@emotion',
+    ]);
+    $api->post('my/tall', [
+        'as' => 'my.tall',
+        'uses' => 'MyController@tall',
+    ]);
 //    充值
     $api->get('my/recharge', [
         'as' => 'my.recharge',