1、帖子搜索
2、收藏搜索 3、帖子、评论删除
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user