|
@@ -167,6 +167,7 @@ public class LoginServiceImpl implements LoginService {
|
|
}
|
|
}
|
|
String mobile = loginCodeDto.getMobile();
|
|
String mobile = loginCodeDto.getMobile();
|
|
String code = loginCodeDto.getCode();
|
|
String code = loginCodeDto.getCode();
|
|
|
|
+ String unionId = loginCodeDto.getUnionId();
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
if (result != null) {
|
|
if (result != null) {
|
|
return ResponseJson.error(result);
|
|
return ResponseJson.error(result);
|
|
@@ -177,15 +178,18 @@ public class LoginServiceImpl implements LoginService {
|
|
// 查看验证码是否过期
|
|
// 查看验证码是否过期
|
|
long expireTime = redisService.getExpireTime("code:" + mobile);
|
|
long expireTime = redisService.getExpireTime("code:" + mobile);
|
|
if (expireTime < 0) {
|
|
if (expireTime < 0) {
|
|
- return ResponseJson.error("验证码已过期,请重新获取验证码");
|
|
|
|
|
|
+ return ResponseJson.error("验证码已失效,请重新获取");
|
|
}
|
|
}
|
|
// 获取redis手机短信验证码
|
|
// 获取redis手机短信验证码
|
|
Object randomCode = redisService.get("code:"+mobile);
|
|
Object randomCode = redisService.get("code:"+mobile);
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(randomCode)) {
|
|
if (!ObjectUtils.isEmpty(randomCode)) {
|
|
if (code.equals(randomCode.toString())) {
|
|
if (code.equals(randomCode.toString())) {
|
|
|
|
+ redisService.remove("code:" + mobile);
|
|
// 根据手机号获取用户信息
|
|
// 根据手机号获取用户信息
|
|
UserLoginVo baseUser = loginMapper.getLoginUserByMobileOrEmail(mobile);
|
|
UserLoginVo baseUser = loginMapper.getLoginUserByMobileOrEmail(mobile);
|
|
|
|
+ // 如果前端传入unionId,则存入返回前端
|
|
|
|
+ baseUser.setUnionId(unionId);
|
|
if (baseUser.getUserIdentity() == 1) {
|
|
if (baseUser.getUserIdentity() == 1) {
|
|
// 协销登录
|
|
// 协销登录
|
|
return ResponseJson.success(baseUser);
|
|
return ResponseJson.success(baseUser);
|
|
@@ -193,14 +197,15 @@ public class LoginServiceImpl implements LoginService {
|
|
// 返回登录校验结果
|
|
// 返回登录校验结果
|
|
return logonVerify(baseUser);
|
|
return logonVerify(baseUser);
|
|
}
|
|
}
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
return ResponseJson.error("验证码不匹配,请重新输入");
|
|
return ResponseJson.error("验证码不匹配,请重新输入");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return ResponseJson.error("验证码为空,请重新获取");
|
|
|
|
|
|
+ return ResponseJson.error("验证码错误,请重新获取");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return ResponseJson.error("手机验证码不存在,请重新获取");
|
|
|
|
|
|
+ return ResponseJson.error("验证码错误,请重新获取");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -684,22 +689,40 @@ public class LoginServiceImpl implements LoginService {
|
|
* mobile 手机号
|
|
* mobile 手机号
|
|
* smsCode 手机验证码
|
|
* smsCode 手机验证码
|
|
* linkName 联系人
|
|
* linkName 联系人
|
|
|
|
+ * passOrNote 0 密码验证 1 短信
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ResponseJson<UserLoginVo> qrCodeAuthScanBind(ScanBindDto scanBindDto) {
|
|
public ResponseJson<UserLoginVo> qrCodeAuthScanBind(ScanBindDto scanBindDto) {
|
|
- String mobileOrEmail = scanBindDto.getMobileOrEmail();
|
|
|
|
- String password = scanBindDto.getPassword();
|
|
|
|
|
|
+ String mobileOrEmail = null;
|
|
|
|
+ if (!ObjectUtils.isEmpty(scanBindDto.getMobileOrEmail())) {
|
|
|
|
+ mobileOrEmail = scanBindDto.getMobileOrEmail();
|
|
|
|
+ }
|
|
|
|
+ String password = null;
|
|
|
|
+ if (!ObjectUtils.isEmpty(scanBindDto.getPassword())) {
|
|
|
|
+ password = scanBindDto.getPassword();
|
|
|
|
+ }
|
|
String mobile = scanBindDto.getMobile();
|
|
String mobile = scanBindDto.getMobile();
|
|
String smsCode = scanBindDto.getSmsCode();
|
|
String smsCode = scanBindDto.getSmsCode();
|
|
String linkName = scanBindDto.getLinkName();
|
|
String linkName = scanBindDto.getLinkName();
|
|
String unionId = scanBindDto.getUnionId();
|
|
String unionId = scanBindDto.getUnionId();
|
|
- // 参数校验
|
|
|
|
- if (StringUtils.isBlank(mobileOrEmail)) {
|
|
|
|
- return ResponseJson.error("参数异常:手机号或邮箱不能为空!", null);
|
|
|
|
|
|
+ // 0 密码验证 1 短信
|
|
|
|
+ String passOrNote = "0";
|
|
|
|
+ if (!ObjectUtils.isEmpty(scanBindDto.getPassOrNote())) {
|
|
|
|
+ passOrNote = scanBindDto.getPassOrNote();
|
|
}
|
|
}
|
|
- if (StringUtils.isBlank(password)) {
|
|
|
|
- return ResponseJson.error("参数异常:密码不能为空!", null);
|
|
|
|
|
|
+ String companyMobile = null;
|
|
|
|
+ if (!ObjectUtils.isEmpty(scanBindDto.getPassOrNote())) {
|
|
|
|
+ companyMobile = scanBindDto.getCompanyMobile();
|
|
|
|
+ }
|
|
|
|
+ // 参数校验
|
|
|
|
+ if ("0".equals(passOrNote)) {
|
|
|
|
+ if (StringUtils.isBlank(mobileOrEmail)) {
|
|
|
|
+ return ResponseJson.error("参数异常:手机号或邮箱不能为空!", null);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(password)) {
|
|
|
|
+ return ResponseJson.error("参数异常:密码不能为空!", null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (StringUtils.isBlank(mobile)) {
|
|
if (StringUtils.isBlank(mobile)) {
|
|
return ResponseJson.error("参数异常:手机号不能为空!", null);
|
|
return ResponseJson.error("参数异常:手机号不能为空!", null);
|
|
@@ -711,9 +734,26 @@ public class LoginServiceImpl implements LoginService {
|
|
return ResponseJson.error("参数异常:unionId不能为空!", null);
|
|
return ResponseJson.error("参数异常:unionId不能为空!", null);
|
|
}
|
|
}
|
|
//处理比对密码
|
|
//处理比对密码
|
|
|
|
+ if ("0".equals(passOrNote)) {
|
|
|
|
+ mobileOrEmail = mobileOrEmail;
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(passOrNote)) {
|
|
|
|
+ mobileOrEmail = companyMobile;
|
|
|
|
+ }
|
|
|
|
+ // 根据手机号或者邮箱获取账户信息
|
|
UserLoginVo user = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
|
|
UserLoginVo user = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
|
|
- String md5Password = Md5Util.md5(password);
|
|
|
|
- if (null != user && md5Password.equals(user.getPassword())) {
|
|
|
|
|
|
+ String md5Password = null;
|
|
|
|
+ boolean item = false;
|
|
|
|
+ // 账号密码验证、短信验证校验方式
|
|
|
|
+ if ("0".equals(passOrNote)) {
|
|
|
|
+ md5Password = Md5Util.md5(password);
|
|
|
|
+ item= md5Password.equals(user.getPassword());
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(passOrNote)) {
|
|
|
|
+ item = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (null != user && item) {
|
|
// 查询使用该手机号的运营人员或用户
|
|
// 查询使用该手机号的运营人员或用户
|
|
String checkRust = commonService.operationBindCheck(mobile, smsCode);
|
|
String checkRust = commonService.operationBindCheck(mobile, smsCode);
|
|
if (checkRust != null) {
|
|
if (checkRust != null) {
|
|
@@ -1039,10 +1079,7 @@ public class LoginServiceImpl implements LoginService {
|
|
/**
|
|
/**
|
|
* 绑定运营人员短信验证
|
|
* 绑定运营人员短信验证
|
|
*
|
|
*
|
|
- * @param loginCodeDto {
|
|
|
|
- * mobile 手机号
|
|
|
|
- * code 短信验证码
|
|
|
|
- * }
|
|
|
|
|
|
+ * @param loginCodeDto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@@ -1056,6 +1093,7 @@ public class LoginServiceImpl implements LoginService {
|
|
String mobile = loginCodeDto.getMobile();
|
|
String mobile = loginCodeDto.getMobile();
|
|
String code = loginCodeDto.getCode();
|
|
String code = loginCodeDto.getCode();
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
String result = ValidateUtil.validateMobile(mobile);
|
|
|
|
+
|
|
if (result != null) {
|
|
if (result != null) {
|
|
return ResponseJson.error(result);
|
|
return ResponseJson.error(result);
|
|
}
|
|
}
|
|
@@ -1071,15 +1109,16 @@ public class LoginServiceImpl implements LoginService {
|
|
Object randomCode = redisService.get("code:" + mobile);
|
|
Object randomCode = redisService.get("code:" + mobile);
|
|
if (!ObjectUtils.isEmpty(randomCode)) {
|
|
if (!ObjectUtils.isEmpty(randomCode)) {
|
|
if (code.equals(randomCode.toString())) {
|
|
if (code.equals(randomCode.toString())) {
|
|
|
|
+ redisService.remove("code:"+mobile);
|
|
return ResponseJson.success("验证码匹配成功");
|
|
return ResponseJson.success("验证码匹配成功");
|
|
} else {
|
|
} else {
|
|
return ResponseJson.error("验证码不匹配,请重新输入");
|
|
return ResponseJson.error("验证码不匹配,请重新输入");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return ResponseJson.error("验证码为空,请重新获取");
|
|
|
|
|
|
+ return ResponseJson.error("验证码错误,请重新获取");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return ResponseJson.error("验证码不存在,请重新获取");
|
|
|
|
|
|
+ return ResponseJson.error("验证码错误,请重新获取");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|