|
@@ -13,8 +13,8 @@ import com.zanxiang.common.utils.URIUtil;
|
|
|
import com.zanxiang.mybatis.entity.User;
|
|
|
import com.zanxiang.sdk.common.constant.ApiUrlConstant;
|
|
|
import com.zanxiang.sdk.common.constant.RedisKeyConstant;
|
|
|
-import com.zanxiang.sdk.common.util.RedisUtils;
|
|
|
-import com.zanxiang.sdk.common.util.RegisterUtils;
|
|
|
+import com.zanxiang.sdk.common.util.RedisUtil;
|
|
|
+import com.zanxiang.sdk.common.util.RegisterUtil;
|
|
|
import com.zanxiang.sdk.domain.dto.UserOauthDTO;
|
|
|
import com.zanxiang.sdk.domain.params.*;
|
|
|
import com.zanxiang.sdk.domain.vo.UserLoginVO;
|
|
@@ -39,34 +39,34 @@ import java.util.Objects;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
+public class RegisterLoginServiceImpl implements RegisterLoginService {
|
|
|
|
|
|
@Autowired
|
|
|
- private RedisUtils<String> redisUtils;
|
|
|
+ private RedisUtil<String> redisUtil;
|
|
|
|
|
|
@Autowired
|
|
|
- private IQqApiService qqApiService;
|
|
|
+ private QqApiService qqApiService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IVxApiService vxApiService;
|
|
|
+ private VxApiService vxApiService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IUserOauthService userOauthService;
|
|
|
+ private UserOauthService userOauthService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IUserTokenService userTokenService;
|
|
|
+ private UserTokenService userTokenService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IUserLoginLogService userLoginLogService;
|
|
|
+ private UserLoginLogService userLoginLogService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IUserService userService;
|
|
|
+ private UserService userService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ISmsService smsService;
|
|
|
+ private SmsService smsService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IWordCheckService wordCheckService;
|
|
|
+ private WordCheckService wordCheckService;
|
|
|
|
|
|
/**
|
|
|
* QQ开发者应用id
|
|
@@ -131,7 +131,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
//插入用户登录记录
|
|
|
userLoginLogService.addUserLoginLog(realIp, user, qqLoginCallbackParam.getGameId());
|
|
|
//移出state
|
|
|
- redisUtils.removeOfSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
+ redisUtil.removeOfSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
//构造返回
|
|
|
return new ResultVo<>(new UserLoginVO(userToken));
|
|
|
}
|
|
@@ -189,7 +189,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
//插入用户登录记录
|
|
|
userLoginLogService.addUserLoginLog(realIp, user, qqLoginCallbackParam.getGameId());
|
|
|
//移出state
|
|
|
- redisUtils.removeOfSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
+ redisUtil.removeOfSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
//构造返回
|
|
|
return new ResultVo<>(new UserLoginVO(userToken));
|
|
|
}
|
|
@@ -215,7 +215,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
//创建用户信息
|
|
|
User user = User.builder()
|
|
|
.username(registerPasswordParam.getUsername())
|
|
|
- .password(RegisterUtils.cmfPassword(password))
|
|
|
+ .password(RegisterUtil.cmfPassword(password))
|
|
|
.deviceId(registerPasswordParam.getDeviceId())
|
|
|
.deviceType(registerPasswordParam.getDeviceType())
|
|
|
.status(AccountStatusEnum.NORMAL_STATUS.getStatus())
|
|
@@ -257,7 +257,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
return new ResultVo<>(HttpStatusEnum.PHONE_IS_REG);
|
|
|
}
|
|
|
//验证密码是否合规
|
|
|
- HttpStatusEnum passwordCheckEnum = RegisterUtils.checkPassword(password);
|
|
|
+ HttpStatusEnum passwordCheckEnum = RegisterUtil.checkPassword(password);
|
|
|
if (!Objects.equals(passwordCheckEnum, HttpStatusEnum.SUCCESS)) {
|
|
|
return new ResultVo<>(passwordCheckEnum);
|
|
|
}
|
|
@@ -266,7 +266,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
.username(mobile)
|
|
|
.regMobile(mobile)
|
|
|
.mobile(mobile)
|
|
|
- .password(RegisterUtils.cmfPassword(password))
|
|
|
+ .password(RegisterUtil.cmfPassword(password))
|
|
|
.deviceId(registerMobileParam.getDeviceId())
|
|
|
.deviceType(registerMobileParam.getDeviceType())
|
|
|
.status(AccountStatusEnum.NORMAL_STATUS.getStatus())
|
|
@@ -314,7 +314,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
return new ResultVo<>(HttpStatusEnum.ACCOUNT_HALT);
|
|
|
}
|
|
|
//验证密码
|
|
|
- if (!Objects.equals(RegisterUtils.cmfPassword(password), user.getPassword())) {
|
|
|
+ if (!Objects.equals(RegisterUtil.cmfPassword(password), user.getPassword())) {
|
|
|
return new ResultVo<>(HttpStatusEnum.USERNAME_OR_PASSWORD_ERR);
|
|
|
}
|
|
|
//验证通过, 获取token
|
|
@@ -403,7 +403,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
*/
|
|
|
private HttpStatusEnum checkRegister(String username, String password) {
|
|
|
//用户名合规检测
|
|
|
- HttpStatusEnum checkUserNameEnum = RegisterUtils.checkUserName(username);
|
|
|
+ HttpStatusEnum checkUserNameEnum = RegisterUtil.checkUserName(username);
|
|
|
if (Objects.equals(checkUserNameEnum, HttpStatusEnum.SUCCESS)) {
|
|
|
return checkUserNameEnum;
|
|
|
}
|
|
@@ -416,7 +416,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
return HttpStatusEnum.USERNAME_EXISTS;
|
|
|
}
|
|
|
//密码验证
|
|
|
- return RegisterUtils.checkPassword(password);
|
|
|
+ return RegisterUtil.checkPassword(password);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -426,7 +426,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
*/
|
|
|
private String getState() {
|
|
|
String state = UUID.randomUUID().toString();
|
|
|
- redisUtils.addToSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
+ redisUtil.addToSet(RedisKeyConstant.AUTH_STATE_KEY, state);
|
|
|
return state;
|
|
|
}
|
|
|
|
|
@@ -436,7 +436,7 @@ public class RegisterLoginServiceImpl implements IRegisterLoginService {
|
|
|
* @param state : 随机密钥
|
|
|
*/
|
|
|
private void checkState(String state) {
|
|
|
- if (!redisUtils.isMemberInSet(RedisKeyConstant.AUTH_STATE_KEY, state)) {
|
|
|
+ if (!redisUtil.isMemberInSet(RedisKeyConstant.AUTH_STATE_KEY, state)) {
|
|
|
throw new BaseException("State验证失败");
|
|
|
}
|
|
|
}
|