xielin %!s(int64=5) %!d(string=hai) anos
pai
achega
6a8e3d533d
Modificáronse 1 ficheiros con 7 adicións e 7 borrados
  1. 7 7
      app/Repositories/PostRepositories.php

+ 7 - 7
app/Repositories/PostRepositories.php

@@ -689,18 +689,18 @@ class PostRepositories
             }
         } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'comment_like') {
             //用户点赞评论
-            $comment = PostComment::where('id', $request['cl_comment_id'])->first();
+            $comment = PostComment::where('id', $request['comment_id'])->first();
             $postLikeKey = "comment_like_" . $postId;
             if ($request['behavior_value']) {
                 $comment->like_count += 1;
-                PostCommentLike::create(['uid' => $request['target_id'], 'comment_id' => $request['cl_comment_id']]);
-                Redis::sadd($postLikeKey, $request['target_id'] . '_' . $request['cl_comment_id']);
-                Log::debug("评论:" . $request['cl_comment_id'] . "被点赞,like_count +1");
+                PostCommentLike::create(['uid' => $request['target_id'], 'comment_id' => $request['comment_id']]);
+                Redis::sadd($postLikeKey, $request['target_id'] . '_' . $request['comment_id']);
+                Log::debug("评论:" . $request['comment_id'] . "被点赞,like_count +1");
             } else {
                 $comment->like_count -= 1;
-                PostCommentLike::where(['uid' => $request['target_id'], 'comment_id' => $request['cl_comment_id']])->delete();
-                Redis::srem($postLikeKey, $request['target_id'] . '_' . $request['cl_comment_id']);
-                Log::debug("评论:" . $request['cl_comment_id'] . "被取消点赞,like_count -1");
+                PostCommentLike::where(['uid' => $request['target_id'], 'comment_id' => $request['comment_id']])->delete();
+                Redis::srem($postLikeKey, $request['target_id'] . '_' . $request['comment_id']);
+                Log::debug("评论:" . $request['comment_id'] . "被取消点赞,like_count -1");
             }
         } elseif (isset($request['behavior_flag']) && $request['behavior_flag'] == 'forward') {
             $post->share_count += 1;