Browse Source

内容信息

wzq 5 years ago
parent
commit
d5fb426041
2 changed files with 23 additions and 5 deletions
  1. 0 5
      app/Models/Post.php
  2. 23 0
      app/Repositories/PostRepositories.php

+ 0 - 5
app/Models/Post.php

@@ -31,9 +31,4 @@ class Post extends Model
     {
     {
         return Topic::whereIn('id', explode(',', $this->topic_ids))->pluck('name', 'id');
         return Topic::whereIn('id', explode(',', $this->topic_ids))->pluck('name', 'id');
     }
     }
-
-    public function comment(){
-        return $this->hasOne('App\Models\PostComment', 'post_id', 'id');
-    }
-
 }
 }

+ 23 - 0
app/Repositories/PostRepositories.php

@@ -198,6 +198,29 @@ class PostRepositories
             foreach($topicIds as $id){
             foreach($topicIds as $id){
                 Redis::zincrby('topic.user_uid'.$userInfo['uid'], 1, $id);
                 Redis::zincrby('topic.user_uid'.$userInfo['uid'], 1, $id);
             }
             }
+            Redis::HSET('post_info_'.$post->id,
+                'id', $post->id,
+                'uid', $post->uid,
+                'type', $post->type,
+                'img', $post->img,
+                'imgs', json_encode($imgs),
+                'video', $post->video,
+                'topic_ids', $post->topic_ids,
+                'title', $post->title,
+                'content', $post->content,
+                'location', $post->location,
+                'pv', $postData->pv,
+                'dislike_count', $postData->dislike_count,
+                'praise_count', $postData->praise_count,
+                'share_count', $postData->share_count,
+                'comment_count', $postData->comment_count,
+                'collect_count', $postData->collect_count,
+                'available_bean', $postData->available_bean,
+                'will_collect_bean', $postData->will_collect_bean,
+                'create_bean', $postData->create_bean,
+                'collect_bean', $postData->collect_bean,
+                'weight', $postData->weight);
+
             return jsonSuccess([
             return jsonSuccess([
                 'post_id' => $post->id,
                 'post_id' => $post->id,
                 'h5url' => config('customer.share_post_h5url')."?post_id={$post->id}&invite_code={$userInfo['invite_code']}",
                 'h5url' => config('customer.share_post_h5url')."?post_id={$post->id}&invite_code={$userInfo['invite_code']}",