wzq vor 5 Jahren
Ursprung
Commit
eef9e7a14f
1 geänderte Dateien mit 4 neuen und 12 gelöschten Zeilen
  1. 4 12
      app/Repositories/PostRepositories.php

+ 4 - 12
app/Repositories/PostRepositories.php

@@ -200,7 +200,7 @@ class PostRepositories
         ];
         if(isset($request['parent_id']) && $request['parent_id'] != 0){
             $comment = $this->postComment->find($request['parent_id']);
-            if(!$comment){
+            if(!$comment || $comment->post_id != $post->id){
                 return jsonError('获取评论信息失败');
             }
             if($comment->parent_id){
@@ -209,7 +209,7 @@ class PostRepositories
             $data['parent_id'] = $request['parent_id'];
 
             if(isset($request['reply_uid']) && isset($request['reply_username'])){
-                $data['reply_uid'] = 0;
+                $data['reply_uid'] = $request['reply_uid'];
                 $data['reply_username'] = $request['reply_username'];
                 $this->rabbitMqUtil->push('add_message', [
                     'uid' => $request['reply_uid'],
@@ -217,6 +217,8 @@ class PostRepositories
                     'param' => [
                         'uid' => $userInfo['uid'],
                         'username' => $userInfo['username'],
+                        'post_id' => $post->id,
+                        'content' => subtext($request['content'], 20),
                     ]
                 ]);
             }else{
@@ -233,16 +235,6 @@ class PostRepositories
                     ]
                 ]);
             }
-            $this->rabbitMqUtil->push('add_message', [
-                'uid' => $comment->uid,
-                'message_show_type' => 'post_reply_main',
-                'param' => [
-                    'uid' => $userInfo['uid'],
-                    'username' => $userInfo['username'],
-                    'post_id' => $post->id,
-                    'content' => subtext($request['content'], 20),
-                ]
-            ]);
         }else{
             $this->rabbitMqUtil->push('add_message', [
                 'uid' => $post->uid,