update m2pool 注销功能删除api,挖矿账户等功能测试通过
This commit is contained in:
@@ -105,6 +105,7 @@ public class TokenController {
|
||||
*/
|
||||
@PostMapping("/closeAccount")
|
||||
@ApiOperation(value = "用户注销")
|
||||
@RequiresLogin
|
||||
public R<?> closeAccount(@RequestBody @Valid CloseAccountVo closeAccountVo){
|
||||
return sysLoginService.closeAccount(closeAccountVo);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,7 @@ import com.m2pool.common.core.constant.UserConstants;
|
||||
import com.m2pool.common.core.enums.UserStatus;
|
||||
import com.m2pool.common.core.exception.ServiceException;
|
||||
import com.m2pool.common.core.text.Convert;
|
||||
import com.m2pool.common.core.utils.DateUtils;
|
||||
import com.m2pool.common.core.utils.GoogleAuthenticator;
|
||||
import com.m2pool.common.core.utils.ServletUtils;
|
||||
import com.m2pool.common.core.utils.StringUtils;
|
||||
import com.m2pool.common.core.utils.*;
|
||||
import com.m2pool.common.core.utils.ip.IpUtils;
|
||||
import com.m2pool.common.core.utils.sign.RsaUtils;
|
||||
import com.m2pool.common.core.web.Result.AjaxResult;
|
||||
@@ -35,6 +32,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.m2pool.common.core.RedisTransKey.getTokenKey;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 登录校验方法
|
||||
@@ -578,7 +577,6 @@ public class SysLoginService {
|
||||
throw new ServiceException("邮箱为必填项");
|
||||
}
|
||||
String closeAccountKey = RedisTransKey.getCloseAccountKey(email);
|
||||
System.out.println("redis 的 key"+closeAccountKey);
|
||||
//校验谷歌验证码和邮箱验证码
|
||||
if(redisService.hasKey(closeAccountKey)){
|
||||
Object o = redisService.getCacheObject(closeAccountKey);//user:emailCode:email
|
||||
@@ -602,13 +600,18 @@ public class SysLoginService {
|
||||
if (R.FAIL == userInfo.getCode()) {
|
||||
throw new ServiceException("服务器请求失败请稍后再试");
|
||||
}
|
||||
SysUser sysUser = userInfo.getData().getSysUser();
|
||||
|
||||
LoginUser loginUser = userInfo.getData();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
sysUser.setDelFlag("2");
|
||||
|
||||
R<Boolean> booleanR = remoteUserService.closeAccount(sysUser);
|
||||
R<Boolean> booleanR = remoteUserService.closeAccount(sysUser, SecurityConstants.INNER);
|
||||
System.out.println("用户邮箱"+booleanR.getData()+"---" + booleanR.getMsg()+"--"+booleanR.getCode() );
|
||||
if (R.FAIL == booleanR.getCode()) {
|
||||
throw new ServiceException("服务器请求失败请稍后再试");
|
||||
}
|
||||
String userKey = getTokenKey(loginUser.getToken());
|
||||
redisService.deleteObject(userKey);
|
||||
return booleanR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user