Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server

This commit is contained in:
sdhkjh 2024-09-18 10:10:38 +08:00
commit 9495618ca4

View file

@ -21,6 +21,7 @@ import com.skyeye.exception.CustomException;
import com.skyeye.rest.sms.service.ISmsCodeService; import com.skyeye.rest.sms.service.ISmsCodeService;
import com.skyeye.service.MemberService; import com.skyeye.service.MemberService;
import com.skyeye.service.ShopAppAuthService; import com.skyeye.service.ShopAppAuthService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -64,6 +65,11 @@ public class ShopAppAuthServiceImpl implements ShopAppAuthService {
if (!StrUtil.equals(password, member.getPassword())) { if (!StrUtil.equals(password, member.getPassword())) {
throw new CustomException("密码错误!"); throw new CustomException("密码错误!");
} }
return getMember(requestType, member, password);
}
@NotNull
private static Member getMember(String requestType, Member member, String password) {
SysUserAuthConstants.setUserLoginRedisCache(member.getId(), BeanUtil.beanToMap(member)); SysUserAuthConstants.setUserLoginRedisCache(member.getId(), BeanUtil.beanToMap(member));
String userToken; String userToken;
if (RequestType.APP.getKey().equals(requestType)) { if (RequestType.APP.getKey().equals(requestType)) {
@ -146,5 +152,14 @@ public class ShopAppAuthServiceImpl implements ShopAppAuthService {
String smsCode = params.get("smsCode").toString(); String smsCode = params.get("smsCode").toString();
// 校验验证码 // 校验验证码
iSmsCodeService.validateSmsCode(mobile, smsCode, SmsSceneEnum.LOGIN.getKey()); iSmsCodeService.validateSmsCode(mobile, smsCode, SmsSceneEnum.LOGIN.getKey());
// 登录
Member member = memberService.queryMemberByPhone(mobile);
if (ObjectUtil.isEmpty(member)) {
throw new CustomException("手机号码不存在,请先注册!");
}
String requestType = InputObject.getRequest().getHeader("requestType");
member = getMember(requestType, member, member.getPassword());
outputObject.setBean(member);
outputObject.settotal(CommonNumConstants.NUM_ONE);
} }
} }