From 322c94ec7052d895213c123a8493c069a5174718 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Wed, 18 Sep 2024 10:09:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ShopAppAuthServiceImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/skyeye-shop/shop-member/src/main/java/com/skyeye/service/impl/ShopAppAuthServiceImpl.java b/skyeye-shop/shop-member/src/main/java/com/skyeye/service/impl/ShopAppAuthServiceImpl.java index 9e4e68f6..fe398b84 100644 --- a/skyeye-shop/shop-member/src/main/java/com/skyeye/service/impl/ShopAppAuthServiceImpl.java +++ b/skyeye-shop/shop-member/src/main/java/com/skyeye/service/impl/ShopAppAuthServiceImpl.java @@ -21,6 +21,7 @@ import com.skyeye.exception.CustomException; import com.skyeye.rest.sms.service.ISmsCodeService; import com.skyeye.service.MemberService; import com.skyeye.service.ShopAppAuthService; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -64,6 +65,11 @@ public class ShopAppAuthServiceImpl implements ShopAppAuthService { if (!StrUtil.equals(password, member.getPassword())) { 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)); String userToken; if (RequestType.APP.getKey().equals(requestType)) { @@ -146,5 +152,14 @@ public class ShopAppAuthServiceImpl implements ShopAppAuthService { String smsCode = params.get("smsCode").toString(); // 校验验证码 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); } }