Kaynağa Gözat

评论发消息

wzq 5 yıl önce
ebeveyn
işleme
d73498d46a
1 değiştirilmiş dosya ile 20 ekleme ve 0 silme
  1. 20 0
      app/Repositories/Post/PostRepository.php

+ 20 - 0
app/Repositories/Post/PostRepository.php

@@ -15,6 +15,7 @@ use App\Models\PostData;
 use App\Models\PostImgs;
 use App\Models\PostLog;
 use App\Models\Topic;
+use App\Service\RabbitMqUtil;
 use App\Traits\PostTrait;
 use App\Traits\UserTrait;
 use Illuminate\Database\QueryException;
@@ -38,6 +39,7 @@ class PostRepository
                                 PostComment $postComment,
                                 PostImgs $postImgs,
                                 PostLog $postLog,
+                                RabbitMqUtil $rabbitMqUtil,
                                 CategoryTopic $categoryTopic,
                                 Topic $topic)
     {
@@ -46,6 +48,7 @@ class PostRepository
         $this->postComment = $postComment;
         $this->postImgs = $postImgs;
         $this->postLog = $postLog;
+        $this->rabbitMqUtil = $rabbitMqUtil;
         $this->categoryTopic = $categoryTopic;
         $this->topic = $topic;
     }
@@ -265,6 +268,23 @@ class PostRepository
             $data['parent_id'] = $request['parent_id'];
             $data['reply_uid'] = $comment->uid;
             $data['reply_username'] = $comment->username;
+            $this->rabbitMqUtil->push('add_message_one', [
+                'uid' => $comment->uid,
+                'message_show_type' => 'post_reply_main',
+                'param' => [
+                    'uid' => $userInfo['uid'],
+                    'username' => $userInfo['username'],
+                ]
+            ]);
+        }else{
+            $this->rabbitMqUtil->push('add_message_one', [
+                'uid' => $post->uid,
+                'message_show_type' => 'post_comment',
+                'param' => [
+                    'uid' => $userInfo['uid'],
+                    'username' => $userInfo['username'],
+                ]
+            ]);
         }
         DB::beginTransaction();
         try{