Przeglądaj źródła

Merge branch 'kuaiyingyong' into kuaiyingyong_wcc

# Conflicts:
#	app/Http/Controllers/QuickApp/Book/ChapterController.php
Wang Chen 4 lat temu
rodzic
commit
5287704d1f

+ 4 - 6
app/Http/Controllers/QuickApp/Book/ChapterController.php

@@ -97,12 +97,10 @@ class ChapterController extends BaseController
         }
 
         if ($chapter->is_vip == 0) {
-            if ($chapter->sequence > 1) {
-                ReadRecordService::addReadRecord([
-                    'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
-                    'cid' => $cid, 'chapter_name' => $chapter->name
-                ]);
-            }
+            ReadRecordService::addReadRecord([
+                'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
+                'cid' => $cid, 'chapter_name' => $chapter->name
+            ]);
             return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
         }
 

+ 12 - 14
app/Http/Controllers/QuickApp/User/UserShelfBooksController.php

@@ -22,16 +22,16 @@ class UserShelfBooksController extends BaseController
         }
         $record = ReadRecordService::getReadRecord($this->uid);
         foreach ($res as &$v) {
-            $bid = $v['bid'];
-            $last_cid = $v['last_cid'];
-            $last_chapter = ChapterService::getChapterNameByID($last_cid, $bid);
+            $bid               = $v['bid'];
+            $last_cid          = $v['last_cid'];
+            $last_chapter      = ChapterService::getChapterNameByID($last_cid, $bid);
             $v['last_chapter'] = "最后章节:{$last_chapter['name']}";
             foreach ($record as $val) {
                 if ($v['bid'] == $val['bid']) {
-                    $v['updated_at'] = $val['time'];
-                    $recent_reading_cid = $val['cid'];
-                    $v['recent_cid'] = $recent_reading_cid;
-                    $recent_reading_chapter = ChapterService::getChapterNameById($recent_reading_cid, $bid);
+                    $v['updated_at']             = $val['time'];
+                    $recent_reading_cid          = $val['cid'];
+                    $v['recent_cid']             = $recent_reading_cid;
+                    $recent_reading_chapter      = ChapterService::getChapterNameById($recent_reading_cid, $bid);
                     $v['recent_reading_chapter'] = "最近阅读:{$recent_reading_chapter['name']}";
                     break;
                 }
@@ -61,17 +61,15 @@ class UserShelfBooksController extends BaseController
      */
     public function addShelf(Request $request)
     {
-        return response()->success();
         $param = $request->except('_url');
         if (checkParam($param, ['bid'])) {
             return response()->error('LACK_PARAM');
         }
 
-        $param['uid'] = $this->uid;
-        $param['bid'] = Hashids::decode($param['bid'])[0];
+        $param['uid']                     = $this->uid;
+        $param['bid']                     = Hashids::decode($param['bid'])[0];
         $param['distribution_channel_id'] = $this->distribution_channel_id;
-        $res = null;
-        $res = UserShelfBooksService::create($param);
+        $res                              = UserShelfBooksService::create($param);
         try {
         } catch (\Exception $e) {
             return response()->error('QAPP_PARAM_ERROR');
@@ -109,7 +107,7 @@ class UserShelfBooksController extends BaseController
         if (empty($bid)) return response()->error('LACK_PARAM');
         $param['uid'] = $this->uid;
         $param['bid'] = Hashids::decode($bid)[0];
-        $res = UserShelfBooksService::del($this->uid, $param['bid']);
+        $res          = UserShelfBooksService::del($this->uid, $param['bid']);
         if ($res) {
             return response()->success();
         }
@@ -139,7 +137,7 @@ class UserShelfBooksController extends BaseController
      *               is_on:0
      *           }
      */
-    public function  isOnshelf(Request $request)
+    public function isOnshelf(Request $request)
     {
         $bid = $request->input('bid');
         if (!$bid) return response()->error('LACK_PARAM');