1、帖子搜索

2、收藏搜索
3、帖子、评论删除
This commit is contained in:
2025-12-10 10:29:41 +08:00
parent ad0527600a
commit 4d94614d40
9 changed files with 98 additions and 7 deletions
+5 -3
View File
@@ -129,12 +129,10 @@ class PostCommentService
$post->save();
}
/**
* 添加后置处理
*/
public function serviceDelete(Request $request)
public function serviceDelete(Request $request,$scene = 'admin')
{
$param = $request->all();
@@ -146,6 +144,10 @@ class PostCommentService
$where['id'] = $param['id'];
$comment = PostComment::where($where)->first();
if($scene == 'mini' && $comment['user_id'] != $request->user->uid){
throw new \Exception("只能删除本人评论");
}
$post = Post::where(['id' => $comment['post_id']])->first();
$post['comment'] = $post['comment']-1;
$post->save();