浏览代码

read record

zz 6 年之前
父节点
当前提交
16c80a69d9
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 7 4
      app/Http/Controllers/Wap/Book/ChapterController.php
  2. 1 1
      app/Modules/Book/Models/BookConfig.php

+ 7 - 4
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -420,10 +420,6 @@ class ChapterController extends BaseController
         //用户是否强关
         $this->is_had_subscribe = $is_had_subscribe = $inter_not_need_sub ? true : $this->getSubscribe();
 
-        //阅读记录
-        ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
-            'cid' => $cid, 'chapter_name' => $chapter->name]);
-
         //判断当前是否有强制显示服务号信息的cookie、已经关注 跳转到服务号信息引导页
         if($has_force_show_qrcode_cookie && $is_had_subscribe)
         {
@@ -486,6 +482,9 @@ class ChapterController extends BaseController
                     $my_log = myLog('special');
                     $my_log->info('need subscribe-------------------------');
                 }
+                //阅读记录
+                ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
+                    'cid' => $cid, 'chapter_name' => $chapter->name]);
                 return response()->error($force_data['error_type'], $force_data['data']);
             }
 
@@ -766,6 +765,10 @@ class ChapterController extends BaseController
         //章节内容
         $chapter_content = ChapterService::getChapter($this->book_info->bid, $this->cid);
         $this->chapter->content = str_replace($chapter_content->name, '', $chapter_content->content);
+
+        //阅读记录
+        ReadRecordService::addReadRecord(['uid' => $this->uid, 'bid' => $this->book_info->bid, 'book_name' => $this->book_info->book_name,
+            'cid' => $this->cid, 'chapter_name' => $this->chapter->name]);
         //统计
         $this->chapterStats();
         //123特殊强关

+ 1 - 1
app/Modules/Book/Models/BookConfig.php

@@ -926,7 +926,7 @@ class BookConfig extends Model
                 , 'book_configs.recommend_cid', 'book_configs.is_high_quality', 'books.updated_at as last_update_time'
             )
             ->where('book_categories.channel_name', $channel_name)
-            ->whereIn('book_configs.is_on_shelf', [1,2])
+            ->where('book_configs.is_on_shelf', 2)
             ->whereNotIn('book_configs.bid', $bid)
             ->where('book_configs.is_high_quality', 1)
             ->get();