fly 5 vuotta sitten
vanhempi
commit
8c98a923fc

+ 61 - 0
app/Http/Controllers/QuickApp/User/UserController.php

@@ -4,9 +4,11 @@ namespace App\Http\Controllers\QuickApp\User;
 
 
 use App\Http\Controllers\QuickApp\BaseController;
+use App\Http\Controllers\Wap\User\Transformers\SignRecordTransformer;
 use App\Libs\AliSMS;
 use App\Modules\Subscribe\Services\YearOrderService;
 use App\Modules\User\Services\QappUserService;
+use App\Modules\User\Services\ReadRecordService;
 use App\Modules\User\Services\UserSignService;
 use Illuminate\Http\Request;
 use Redis;
@@ -178,4 +180,63 @@ class UserController extends BaseController
             return response()->error('WAP_SEND_CODE_ERROR');
         }
     }
+
+        /**
+     * @apiVersion 1.0.0
+     * @apiDescription 用户签到记录
+     * @api {GET} user/sign_record 用户签到记录
+     * @apiGroup User
+     * @apiName signRecord
+     * @apiSuccess {int}         code 状态码
+     * @apiSuccess {String}      msg  信息
+     * @apiSuccess {object}      data 结果集
+     * @apiSuccess {reward}     data.reward 奖励金额.
+     * @apiSuccess {sign_time}  data.sign_time 签到时间.
+     * @apiParam {page}  page
+     * @apiSuccessExample {json} Success-Response:
+     *
+     *    {
+     *       code: 0,
+     *       msg: "",
+     *       data: {
+     *           list: [
+     *           {
+     *               reward: 50,
+     *               sign_time: "2018-03-20 13:43:11"
+     *           },
+     *           {
+     *               reward: 50,
+     *               sign_time: "2018-01-18 16:22:33"
+     *           },
+     *       ],
+     *       meta: {
+     *           total: 12,
+     *           per_page: 15,
+     *           current_page: 1,
+     *           last_page: 1,
+     *           next_page_url: "",
+     *           prev_page_url: ""
+     *       }
+     *       }
+     *   }
+     */
+    public function signRecord(Request $request)
+    {
+        $sign_result = paginationTransform(new SignRecordTransformer(), UserSignService::getUserSignRecord($this->uid));
+        $sign_status = UserSignService::isSign($this->uid);
+        $sign_today = [];
+        if ($sign_status) {
+            $sign_today = ReadRecordService::getByField($this->uid, 'sign_info');
+            if ($sign_today) $sign_today = json_decode($sign_today, 1);
+            isset($sign_today['sign_time']) && $sign_today['sign_time'] = date('Y-m-d H:i:s', $sign_today['sign_time']);
+            isset($sign_today['sign_at']) && $sign_today['sign_time'] = $sign_today['sign_at'];
+            isset($sign_today['price']) && $sign_today['reward'] = $sign_today['price'];
+        }
+        $result = [
+            'sign_status' => $sign_status,
+            'sign_result' => $sign_result,
+            'sign_today' => $sign_today
+        ];
+        return response()->success($result);
+    }
 }

+ 1 - 0
app/Http/Routes/QuickApp/QuickAppRoutes.php

@@ -60,6 +60,7 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
         Route::post('user/bindPhone', 'User\UserController@bindPhone');
         //签到
         Route::get('sign', 'User\UserController@sign');
+        Route::get('user/sign_record', 'User\UserController@signRecord');
         //书架
         Route::get('userShelfBooks', 'User\UserShelfBooksController@index');
         //添加书架

+ 72 - 0
public/kyydoc/api_data.js

@@ -3862,6 +3862,78 @@ define({ "api": [
   },
   {
     "version": "1.0.0",
+    "description": "<p>用户签到记录</p>",
+    "type": "GET",
+    "url": "user/sign_record",
+    "title": "用户签到记录",
+    "group": "User",
+    "name": "signRecord",
+    "success": {
+      "fields": {
+        "Success 200": [
+          {
+            "group": "Success 200",
+            "type": "int",
+            "optional": false,
+            "field": "code",
+            "description": "<p>状态码</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "String",
+            "optional": false,
+            "field": "msg",
+            "description": "<p>信息</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "object",
+            "optional": false,
+            "field": "data",
+            "description": "<p>结果集</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "reward",
+            "optional": false,
+            "field": "data.reward",
+            "description": "<p>奖励金额.</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "sign_time",
+            "optional": false,
+            "field": "data.sign_time",
+            "description": "<p>签到时间.</p>"
+          }
+        ]
+      },
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "\n {\n    code: 0,\n    msg: \"\",\n    data: {\n        list: [\n        {\n            reward: 50,\n            sign_time: \"2018-03-20 13:43:11\"\n        },\n        {\n            reward: 50,\n            sign_time: \"2018-01-18 16:22:33\"\n        },\n    ],\n    meta: {\n        total: 12,\n        per_page: 15,\n        current_page: 1,\n        last_page: 1,\n        next_page_url: \"\",\n        prev_page_url: \"\"\n    }\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "page",
+            "optional": false,
+            "field": "page",
+            "description": ""
+          }
+        ]
+      }
+    },
+    "filename": "app/Http/Controllers/QuickApp/User/UserController.php",
+    "groupTitle": "用户"
+  },
+  {
+    "version": "1.0.0",
     "description": "<p>支付宝APP支付</p>",
     "type": "get",
     "url": "goToAliPay",

+ 72 - 0
public/kyydoc/api_data.json

@@ -3862,6 +3862,78 @@
   },
   {
     "version": "1.0.0",
+    "description": "<p>用户签到记录</p>",
+    "type": "GET",
+    "url": "user/sign_record",
+    "title": "用户签到记录",
+    "group": "User",
+    "name": "signRecord",
+    "success": {
+      "fields": {
+        "Success 200": [
+          {
+            "group": "Success 200",
+            "type": "int",
+            "optional": false,
+            "field": "code",
+            "description": "<p>状态码</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "String",
+            "optional": false,
+            "field": "msg",
+            "description": "<p>信息</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "object",
+            "optional": false,
+            "field": "data",
+            "description": "<p>结果集</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "reward",
+            "optional": false,
+            "field": "data.reward",
+            "description": "<p>奖励金额.</p>"
+          },
+          {
+            "group": "Success 200",
+            "type": "sign_time",
+            "optional": false,
+            "field": "data.sign_time",
+            "description": "<p>签到时间.</p>"
+          }
+        ]
+      },
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "\n {\n    code: 0,\n    msg: \"\",\n    data: {\n        list: [\n        {\n            reward: 50,\n            sign_time: \"2018-03-20 13:43:11\"\n        },\n        {\n            reward: 50,\n            sign_time: \"2018-01-18 16:22:33\"\n        },\n    ],\n    meta: {\n        total: 12,\n        per_page: 15,\n        current_page: 1,\n        last_page: 1,\n        next_page_url: \"\",\n        prev_page_url: \"\"\n    }\n    }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "page",
+            "optional": false,
+            "field": "page",
+            "description": ""
+          }
+        ]
+      }
+    },
+    "filename": "app/Http/Controllers/QuickApp/User/UserController.php",
+    "groupTitle": "用户"
+  },
+  {
+    "version": "1.0.0",
     "description": "<p>支付宝APP支付</p>",
     "type": "get",
     "url": "goToAliPay",

+ 1 - 1
public/kyydoc/api_project.js

@@ -17,7 +17,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-10-31T07:46:39.372Z",
+    "time": "2019-11-01T05:56:49.986Z",
     "url": "http://apidocjs.com",
     "version": "0.17.7"
   }

+ 1 - 1
public/kyydoc/api_project.json

@@ -17,7 +17,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2019-10-31T07:46:39.372Z",
+    "time": "2019-11-01T05:56:49.986Z",
     "url": "http://apidocjs.com",
     "version": "0.17.7"
   }