Browse Source

read record

zz 6 years ago
parent
commit
f9e2b5c98c

+ 12 - 2
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -13,6 +13,7 @@ use App\Modules\Statistic\Services\DataAnalysisChapterService;
 use App\Modules\Statistic\Services\DataAnalysisSelectUserService;
 use App\Modules\Statistic\Services\WapVisitStatService;
 use App\Modules\Subscribe\Services\OrderService;
+use App\Modules\User\Services\ReadRecordStatsService;
 use App\Modules\YunQi\Services\BookUserService;
 use Illuminate\Http\Request;
 use App\Http\Controllers\Wap\BaseController;
@@ -629,6 +630,8 @@ class ChapterController extends BaseController
         $this->share();
         //广告
         $this->isShowAd();
+        //完整阅读纪录 阅读纪录
+        $this->readRecordOther();
     }
 
     /**
@@ -1203,7 +1206,14 @@ class ChapterController extends BaseController
 
     private function readRecordOther()
     {
-        $chapter = $this->chapter;
+        $bid = $this->book_info->bid;
+        $cid = $this->cid;
+        $distribution_channel_id = $this->distribution_channel_id;
+        $send_order_id = $this->send_order_id;
+        $from = $this->from_type;
+        $sequence = $this->chapter->sequence;
+        ReadRecordStatsService::record($this->uid,$bid,$cid,$distribution_channel_id,$send_order_id,$from,$sequence);
+        /*$chapter = $this->chapter;
         try {
             $data = [];
             $data['uid'] = $this->uid;
@@ -1216,7 +1226,7 @@ class ChapterController extends BaseController
             DB::table('read_records')->insert($data);
         } catch (\Exception  $e) {
 
-        }
+        }*/
 
     }
 

+ 24 - 0
app/Modules/User/Services/ReadRecordStatsService.php

@@ -0,0 +1,24 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2019/1/28
+ * Time: 16:22
+ */
+
+namespace App\Modules\User\Services;
+
+use Redis;
+
+class ReadRecordStatsService
+{
+    public static function record($uid,$bid,$cid,$distribution_channel_id,$send_order_id,$from,$sequence){
+        $data = compact('uid', 'bid','cid','distribution_channel_id','send_order_id','from','sequence');
+        $data['created_at'] = $data['updated_at'] = date('Y-m-d H:i:s');
+        $data['attach'] = '';
+        try{
+            Redis::lpush('ReadRecordStats',json_encode($data));
+        }catch (\Exception $e){}
+    }
+
+}