wzq 5 年之前
父节点
当前提交
91c6a7c7bf
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      app/Repositories/PostRepositories.php

+ 8 - 0
app/Repositories/PostRepositories.php

@@ -611,6 +611,14 @@ class PostRepositories
             $post->pv += 1;
             $post->pv_real += 1;
             Redis::HINCRBY($postInfoKey,'pv',1);
+            $topicIdStr = Redis::HGET($postInfoKey,'topic_ids');
+            if($topicIdStr){
+                Log::debug('话题增加浏览量'.$topicIdStr);
+                $topicIds = explode(',', $topicIdStr);
+                foreach($topicIds as $id){
+                    $this->topic->where('id', $id)->increment('pv');
+                }
+            }
             Log::debug("帖子:".$postId."被阅读,pv +1");
         } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'unlike') {
             //用户不喜欢帖子key