Commit a85687ee authored by hezhen's avatar hezhen

添加注销

parent 91a349b0
...@@ -281,6 +281,15 @@ public class AppUserRest { ...@@ -281,6 +281,15 @@ public class AppUserRest {
} }
@ApiModelProperty("注销")
@PostMapping("cancelUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "mobilecode") String mobilecode,HttpServletRequest request)throws Exception{
IJWTInfo infoFromToken = authUtil.getInfoFromToken(userAuthConfig.getToken(request));
return appPermissionService.cancelUsername(Integer.parseInt(infoFromToken.getId()),mobilecode);
}
/*@GetMapping("/app/unauth/test") /*@GetMapping("/app/unauth/test")
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse test(){ public ObjectRestResponse test(){
......
...@@ -1258,6 +1258,29 @@ public class AppPermissionService { ...@@ -1258,6 +1258,29 @@ public class AppPermissionService {
} }
//注销
public ObjectRestResponse cancelUsername(Integer userId,String mobileCode){
if (StringUtils.isBlank(mobileCode) || userId == 0 || userId == null ){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
// 是否已存在
AppUserLogin user = appUserLoginBiz.selectById(userId);
if (user==null){
return ObjectRestResponse.createFailedResult(ResultCode.EXIST_CODE, "用户不存在");
}
if (StringUtils.isBlank(checkCodeByUsername(user.getUsername(),mobileCode))){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"验证码错误");
}
AppUserLogin userLogin=new AppUserLogin();
userLogin.setId(userId);
userLogin.setIsdel(1);
userLogin.setUsername(user.getUsername()+user.getId());
appUserLoginBiz.disable(userLogin);
return ObjectRestResponse.succ();
}
/** /**
* 注册用户 * 注册用户
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment