|
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.time.LocalDateTime;
|
|
@@ -49,10 +50,10 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
@Autowired
|
|
|
private RedisUtil<String> redisUtil;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private QqApiService qqApiService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private VxApiService vxApiService;
|
|
|
|
|
|
@Autowired
|
|
@@ -88,17 +89,16 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
/**
|
|
|
* 用户名注册或者登录
|
|
|
*
|
|
|
- * @param param : 注册登录参数
|
|
|
- * @param request : 请求信息
|
|
|
- * @param userData : 用户信息
|
|
|
+ * @param param : 注册登录参数
|
|
|
+ * @param request : 请求信息
|
|
|
* @return : 返回用户登录信息
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public ResultVO<UserLoginVO> loginPassword(LoginPasswordParam param, UserData userData, HttpServletRequest request) {
|
|
|
+ public ResultVO<UserLoginVO> loginPassword(LoginPasswordParam param, HttpServletRequest request) {
|
|
|
String username = param.getUsername();
|
|
|
String password = param.getPassword();
|
|
|
- Long gameId = userData.getGameId();
|
|
|
+ Long gameId = Long.valueOf(request.getHeader("gameId"));
|
|
|
Integer type = param.getType();
|
|
|
//用户信息
|
|
|
User user;
|
|
@@ -128,7 +128,7 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
.gameId(gameId)
|
|
|
.username(username)
|
|
|
.password(RegisterUtil.cmfPassword(password))
|
|
|
- .deviceType(DeviceTypeEnum.DEVICE_TYPE_ANDROID_APP.getDeviceType())
|
|
|
+ .deviceType(DeviceTypeEnum.DEVICE_TYPE_ANDROID.getDeviceType())
|
|
|
.status(AccountStatusEnum.NORMAL_STATUS.getStatus())
|
|
|
.authentication(0)
|
|
|
.createTime(LocalDateTime.now())
|
|
@@ -141,7 +141,7 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
//插入用户登录记录
|
|
|
userLoginLogService.addUserLoginLog(realIp, user, gameId, 0);
|
|
|
//验证通过, 获取token
|
|
|
- String userToken = userTokenService.getUserToken(user.getId(), DeviceTypeEnum.DEVICE_TYPE_ANDROID_APP.getDeviceType());
|
|
|
+ String userToken = userTokenService.getUserToken(user.getId(), DeviceTypeEnum.DEVICE_TYPE_ANDROID.getDeviceType());
|
|
|
//构造用户登录信息
|
|
|
UserLoginVO userLoginVO = UserLoginVO.builder()
|
|
|
.userId(user.getId())
|
|
@@ -157,17 +157,16 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
/**
|
|
|
* 手机号登录
|
|
|
*
|
|
|
- * @param param : 手机号登录参数
|
|
|
- * @param request : 请求信息
|
|
|
- * @param userData : 用户信息
|
|
|
+ * @param param : 手机号登录参数
|
|
|
+ * @param request : 请求信息
|
|
|
* @return : 返回登录信息
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public ResultVO<UserLoginVO> loginMobile(LoginMobileParam param, UserData userData, HttpServletRequest request) {
|
|
|
+ public ResultVO<UserLoginVO> loginMobile(LoginMobileParam param, HttpServletRequest request) {
|
|
|
String mobile = param.getMobile();
|
|
|
String code = param.getCode();
|
|
|
- Long gameId = userData.getGameId();
|
|
|
+ Long gameId = Long.valueOf(request.getHeader("gameId"));
|
|
|
//验证码校验
|
|
|
HttpStatusEnum httpStatusEnum = smsService.smsCheck(SmsTypeEnum.SMS_REG.getType(), mobile, code);
|
|
|
//验证不通过, 返回
|
|
@@ -181,7 +180,7 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
user = User.builder()
|
|
|
.gameId(gameId)
|
|
|
.mobile(mobile)
|
|
|
- .deviceType(DeviceTypeEnum.DEVICE_TYPE_ANDROID_APP.getDeviceType())
|
|
|
+ .deviceType(DeviceTypeEnum.DEVICE_TYPE_ANDROID.getDeviceType())
|
|
|
.status(AccountStatusEnum.NORMAL_STATUS.getStatus())
|
|
|
.authentication(0)
|
|
|
.createTime(LocalDateTime.now())
|
|
@@ -195,12 +194,11 @@ public class LoginServiceImpl implements RegisterLoginService {
|
|
|
}
|
|
|
}
|
|
|
//验证通过, 获取token
|
|
|
- String userToken = userTokenService.getUserToken(user.getId(), DeviceTypeEnum.DEVICE_TYPE_ANDROID_APP.getDeviceType());
|
|
|
+ String userToken = userTokenService.getUserToken(user.getId(), DeviceTypeEnum.DEVICE_TYPE_ANDROID.getDeviceType());
|
|
|
//登录的ip
|
|
|
String realIp = IpUtils.getRealIp(request);
|
|
|
//插入用户登录记录
|
|
|
userLoginLogService.addUserLoginLog(realIp, user, gameId, 0);
|
|
|
- //构造返回
|
|
|
//构造用户登录信息
|
|
|
UserLoginVO userLoginVO = UserLoginVO.builder()
|
|
|
.userId(user.getId())
|