fix: 修改注销账号的实现方式
This commit is contained in:
parent
6deed61311
commit
49fd03df7f
@ -272,12 +272,9 @@ public class MemberBuyerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "注销账号")
|
@ApiOperation(value = "注销账号")
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query")
|
|
||||||
})
|
|
||||||
@PutMapping("/cancellation")
|
@PutMapping("/cancellation")
|
||||||
public ResultMessage<Member> cancellation(@NotNull(message = "密码不能为空") @RequestParam String password) {
|
public ResultMessage<Member> cancellation() {
|
||||||
memberService.cancellation(password);
|
memberService.cancellation();
|
||||||
return ResultUtil.success();
|
return ResultUtil.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,10 +135,9 @@ public interface MemberService extends IService<Member> {
|
|||||||
/**
|
/**
|
||||||
* 注销账号
|
* 注销账号
|
||||||
*
|
*
|
||||||
* @param password 密码
|
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
void cancellation(String password);
|
void cancellation();
|
||||||
/**
|
/**
|
||||||
* 修改当前会员的手机号
|
* 修改当前会员的手机号
|
||||||
*
|
*
|
||||||
|
@ -375,20 +375,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancellation(String password) {
|
public void cancellation() {
|
||||||
|
|
||||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||||
if (tokenUser == null) {
|
if (tokenUser == null) {
|
||||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||||
}
|
}
|
||||||
Member member = this.getById(tokenUser.getId());
|
Member member = this.getById(tokenUser.getId());
|
||||||
if (member.getPassword().equals(new BCryptPasswordEncoder().encode(password))) {
|
|
||||||
//删除联合登录
|
//删除联合登录
|
||||||
connectService.deleteByMemberId(member.getId());
|
connectService.deleteByMemberId(member.getId());
|
||||||
//混淆用户信息
|
//混淆用户信息
|
||||||
this.confusionMember(member);
|
this.confusionMember(member);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 混淆之前的会员信息
|
* 混淆之前的会员信息
|
||||||
|
Loading…
x
Reference in New Issue
Block a user