|
@@ -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;
|