gq 7 years ago
parent
commit
fc92265b7d

+ 1 - 0
server/app/Http/Controllers/Api/V1/AuthController.php

xqd
@@ -54,6 +54,7 @@ class AuthController extends Controller
      *             "type": 2,
      *             "phone": "15888888888",
      *             "avatar": null,
+     *             "step": 0,  新手引导默认0
      *             "last_ip": null,
      *             "created_at": "2016-09-30 00:45:13",
      *             "updated_at": "2016-09-29 16:43:36"

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

xqd
@@ -1627,4 +1627,40 @@ class MyController extends Controller
         return $this->api($data);
     }
 
+    /**
+     * @api {post} /api/my/step 新手引导
+     * @apiDescription 新手引导
+     * @apiGroup My
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *{
+     *  "status": true,
+     *  "status_code": 0,
+     *  "message": "",
+     *  "data": ""
+     *               如果step的值等于5表示已完成新手引导不用调用此接口
+     *                  可根据step的值判断用户新手引导到第几步
+     *}
+     * @apiErrorExample {json} Error-Response:
+     *{
+     *  "status": false,
+     *  "status_code": 700,
+     *  "message": "操作失败",
+     *  "data": null
+     *}
+     * HTTP/1.1 400 Bad Request
+     */
+    public function step(Request $request)
+    {
+        $user = $this->getUser();
+        if($user->step<5) {  //新手引导一共5步
+            $user->step += 1;
+            $ok = $user->save();
+            if($ok)  return $this->api('');
+        }
+        return $this->error(ErrorCode::OPERATION_FAILED);
+    }
+
 }

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

xqd
@@ -56,6 +56,7 @@ class UserInfoModel extends Authenticatable
                            'wechat',
                            'add_fens_number',
                            'jpush',
+                           'step',
                           ];
 
     protected $hidden = ['password'];

+ 32 - 0
server/database/migrations/2017_12_25_153933_add_step_to_user_info_table.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddStepToUserInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('user_info', function (Blueprint $table) {
+            $table->unsignedSmallInteger('step')->after('weibo')->default(0)->comment('新手引导(步数)');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('user_info', function (Blueprint $table) {
+            //
+        });
+    }
+}