|
|
@@ -1,9 +1,11 @@
|
|
|
package cn.qinys.platform.mobile.service.impl;
|
|
|
|
|
|
import cn.qinys.platform.base.exceptions.BizException;
|
|
|
+import cn.qinys.platform.base.redis.RedisKeyEnum;
|
|
|
import cn.qinys.platform.base.security.utils.CurrentUtils;
|
|
|
import cn.qinys.platform.base.service.AbstractLoginService;
|
|
|
import cn.qinys.platform.base.service.ICaptchaService;
|
|
|
+import cn.qinys.platform.base.utils.RedisUtils;
|
|
|
import cn.qinys.platform.base.vo.LoginUserInfo;
|
|
|
import cn.qinys.platform.entity.wishing.WishingUser;
|
|
|
import cn.qinys.platform.mobile.mapper.UserWishMapper;
|
|
|
@@ -16,6 +18,7 @@ import cn.qinys.platform.mobile.service.LoginService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Map;
|
|
|
@@ -38,10 +41,23 @@ public class LoginServiceImpl extends AbstractLoginService implements LoginServi
|
|
|
private WishingUserMapper userMapper;
|
|
|
@Resource
|
|
|
private UserWishMapper wishMapper;
|
|
|
+ @Resource
|
|
|
+ RedisUtils redisUtils;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public LoginResp login(LoginReq query) {
|
|
|
+
|
|
|
+ // 校验验证码
|
|
|
+ String codeKey = RedisKeyEnum.CAPTCHA.getCode() + query.getCaptchaKey();
|
|
|
+ String code = (String) redisUtils.get(codeKey);
|
|
|
+ if (!StringUtils.hasLength(code)) {
|
|
|
+ throw new BizException("图片验证码已过期");
|
|
|
+ }
|
|
|
+ if (!code.equalsIgnoreCase(query.getCaptcha())) {
|
|
|
+ throw new BizException("图片验证码不正确");
|
|
|
+ }
|
|
|
+
|
|
|
WishingUser user = userMapper.selectByMobile(query.getMobile());
|
|
|
if (user == null) {
|
|
|
throw new BizException("用户不存在");
|