我的收藏

This commit is contained in:
2025-11-26 17:35:38 +08:00
parent a924959365
commit 12812fa775
5 changed files with 68 additions and 8 deletions
+26 -2
View File
@@ -105,8 +105,6 @@ class PostCommentService
return $data;
}
/**
* 添加后置处理
*/
@@ -123,4 +121,30 @@ class PostCommentService
$post['comment'] = $post['comment']+1;
$post->save();
}
/**
* 添加后置处理
*/
public function serviceDelete(Request $request)
{
$param = $request->all();
if (empty($param['id'])) {
throw new \Exception("参数错误");
}
$where = [];
$where['id'] = $param['id'];
$comment = PostComment::where($where)->first();
$post = Post::where(['id' => $comment['post_id']])->first();
$post['comment'] = $post['comment']-1;
$post->save();
$count = $comment->delete();
return $count;
}
}
+1 -3
View File
@@ -106,8 +106,6 @@ class UserService
'openid' => $user->openid,
'unionid' => $user->unionid,
],
// 'menu' => $menuTree,
// 'permissions' => $permissionCodes
];
}
@@ -182,7 +180,7 @@ class UserService
{
// 对密码进行哈希处理
$user = User::find($uid);
$keysToKeep = ['name', 'avatar'];
$keysToKeep = ['name', 'nickname', 'avatar'];
$data = array_intersect_key($data, array_flip($keysToKeep));