fly 5 سال پیش
والد
کامیت
b82b6c195b

+ 16 - 2
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -9,6 +9,7 @@ use App\Http\Controllers\QuickApp\BaseController;
 use App\Http\Controllers\QuickApp\Book\Transformers\BookTransformer;
 use App\Modules\Book\Services\BookConfigService;
 use App\Modules\Book\Services\BookService;
+use App\Modules\Book\Services\BookUrgeUpdateService;
 use App\Modules\Book\Services\UserShelfBooksService;
 use App\Modules\Book\Services\ChapterService;
 use Hashids;
@@ -509,8 +510,21 @@ class BookController extends BaseController
         }
         $bid = BookService::decodeBidStatic($bid);
         $book_info = BookConfigService::getBookById($bid);
-        $res = BookConfigService::getQuickAppRecommendBooks($bid, $book_info->category_id);
-        return response()->collection(new BookTransformer(), $res);
+        $res = BookConfigService::getRecommendBooks($bid,$book_info->channel_name);
+        $urge_status = 0;
+        if($book_info->status == 0 && !BookUrgeUpdateService::isHadUrged($this->uid,$bid)){
+            $urge_status = 1;
+        }
+        $recommend_result = collectionTransform(new BookTransformer(),$res);
+        $book_status = [
+            'status'=>$book_info->status,
+            'urge_status'=>$urge_status
+        ];
+        $data = [
+            'recommend_result'=>$recommend_result,
+            'book_status'=>$book_status
+        ];
+        return response()->success($data);
     }
 
     /**

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

@@ -6,6 +6,8 @@ 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\Book\Services\BookService;
+use App\Modules\Book\Services\BookUrgeUpdateService;
 use App\Modules\Subscribe\Services\YearOrderService;
 use App\Modules\User\Services\QappUserService;
 use App\Modules\User\Services\ReadRecordService;
@@ -252,4 +254,34 @@ class UserController extends BaseController
         ];
         return response()->success($result);
     }
+
+    /**
+     * @apiVersion 1.0.0
+     * @apiDescription 催更
+     * @api {POST} user/urgeUpdate 催更
+     * @apiHeader {String} [Authorization]  token
+     * @apiGroup User
+     * @apiName urgeUpdate
+     * @apiParam {String}  bid 书号
+     * @apiSuccessExample {json} Success-Response:
+     *
+     *     {
+     *         "code": 0,
+     *         "msg": "",
+     *         "data": {}
+     *     }
+     */
+    public function urgeUpdate(Request $request)
+    {
+        $bid = $request->input('bid');
+        if (empty($bid)) {
+            return response()->error('PARAM_ERROR');
+        }
+        $bid = BookService::decodeBidStatic($bid);
+        $result = BookUrgeUpdateService::UrgeRecord($this->uid, $bid);
+        if ($result && !$result->id) {
+            BookUrgeUpdateService::UrgeUpdate($this->uid, $bid, $result->updated_at);
+        }
+        return response()->success();
+    }
 }

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

@@ -58,6 +58,8 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
         Route::get('userinfo', 'User\UserController@index');
         Route::post('user/sendCode', 'User\UserController@sendCode');
         Route::post('user/bindPhone', 'User\UserController@bindPhone');
+        //催更
+        Route::post('user/urgeUpdate', 'User\UserController@urgeUpdate');
         //签到
         Route::get('sign', 'User\UserController@sign');
         Route::get('user/sign_record', 'User\UserController@signRecord');

+ 46 - 0
public/kyydoc/api_data.js

@@ -4006,6 +4006,52 @@ define({ "api": [
   },
   {
     "version": "1.0.0",
+    "description": "<p>催更</p>",
+    "type": "POST",
+    "url": "user/urgeUpdate",
+    "title": "催更",
+    "header": {
+      "fields": {
+        "Header": [
+          {
+            "group": "Header",
+            "type": "String",
+            "optional": true,
+            "field": "Authorization",
+            "description": "<p>token</p>"
+          }
+        ]
+      }
+    },
+    "group": "User",
+    "name": "urgeUpdate",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "String",
+            "optional": false,
+            "field": "bid",
+            "description": "<p>书号</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "\n{\n    \"code\": 0,\n    \"msg\": \"\",\n    \"data\": {}\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/QuickApp/User/UserController.php",
+    "groupTitle": "用户"
+  },
+  {
+    "version": "1.0.0",
     "description": "<p>支付宝APP支付</p>",
     "type": "get",
     "url": "goToAliPay",

+ 46 - 0
public/kyydoc/api_data.json

@@ -4006,6 +4006,52 @@
   },
   {
     "version": "1.0.0",
+    "description": "<p>催更</p>",
+    "type": "POST",
+    "url": "user/urgeUpdate",
+    "title": "催更",
+    "header": {
+      "fields": {
+        "Header": [
+          {
+            "group": "Header",
+            "type": "String",
+            "optional": true,
+            "field": "Authorization",
+            "description": "<p>token</p>"
+          }
+        ]
+      }
+    },
+    "group": "User",
+    "name": "urgeUpdate",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "String",
+            "optional": false,
+            "field": "bid",
+            "description": "<p>书号</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "\n{\n    \"code\": 0,\n    \"msg\": \"\",\n    \"data\": {}\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "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-11-05T02:53:02.243Z",
+    "time": "2019-11-05T03:20:18.693Z",
     "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-11-05T02:53:02.243Z",
+    "time": "2019-11-05T03:20:18.693Z",
     "url": "http://apidocjs.com",
     "version": "0.17.7"
   }