帖子详情
This commit is contained in:
@@ -126,9 +126,12 @@ class PostFavoriteService
|
||||
$where['user_id'] = $param['user_id'];
|
||||
$count = PostFavorite::where($where)->delete();
|
||||
|
||||
$post = PostFavorite::where(['id' => $param['post_id']])->first();
|
||||
$post['favorite'] = $post['favorite']-1;
|
||||
$post->save();
|
||||
if ($count) {
|
||||
$post = PostFavorite::where(['id' => $param['post_id']])->first();
|
||||
$post['favorite'] = $post['favorite']-1;
|
||||
$post['favorite'] = $post['favorite']<0?0:$post['favorite'];
|
||||
$post->save();
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user