Bladeren bron

话题使用数

wzq 5 jaren geleden
bovenliggende
commit
740052b9bb

+ 2 - 1
app/Repositories/PostRepositories.php

@@ -196,6 +196,7 @@ class PostRepositories
             Redis::zadd('post_trigger_type', $isValid, $post->id);
             foreach($topicIds as $id){
                 Redis::zincrby('topic.user_uid'.$userInfo['uid'], 1, $id);
+                Redis::zincrby('topic.just_use_count', 1, $id);
             }
             Redis::HSET('post_info_'.$post->id,
                 'id', $post->id,
@@ -712,7 +713,7 @@ class PostRepositories
                 'id' => $topic->id,
                 'name' => $topic->name,
                 'img' => $topic->img,
-                'follow_count' => getNumber($topic->follow->count() + $topic->base_count),
+                'follow_count' => getNumber($topic->use_count + $topic->base_count),
             ];
         }
         return $data;

+ 1 - 1
app/Transformers/Topic/MyTopicListTransformer.php

@@ -18,7 +18,7 @@ class MyTopicListTransformer extends TransformerAbstract
             'id' => $memberFollowTopic['topic_id'],
             'name' => $memberFollowTopic->topic->name,
             'img' => $memberFollowTopic->topic->img,
-            'follow_count' => getNumber($memberFollowTopic->topic->follow->count() + $memberFollowTopic->topic->base_count),
+            'follow_count' => getNumber($memberFollowTopic->topic->use_count + $memberFollowTopic->topic->base_count),
         ];
     }
 }

+ 1 - 1
app/Transformers/Topic/TopicDetailTransformer.php

@@ -27,7 +27,7 @@ class TopicDetailTransformer extends TransformerAbstract
             'id' => $topic['id'],
             'name' => $topic['name'],
             'img' => $topic['img'],
-            'follow_count' => getNumber($topic->follow->count() + $topic['base_count']),
+            'follow_count' => getNumber($topic['use_count'] + $topic['base_count']),
             'is_follow' => $isFollow,
         ];
     }

+ 1 - 1
app/Transformers/Topic/TopicListTransformer.php

@@ -18,7 +18,7 @@ class TopicListTransformer extends TransformerAbstract
             'id' => $topic['id'],
             'name' => $topic['name'],
             'img' => $topic['img'],
-            'follow_count' => getNumber($topic->follow->count() + $topic['base_count']),
+            'follow_count' => getNumber($topic['use_count'] + $topic['base_count']),
         ];
     }
 }