|
@@ -1,9 +1,9 @@
|
|
|
package thyyxxk.webserver.service;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -18,7 +18,6 @@ import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
|
|
|
import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -49,6 +48,13 @@ public class LoginService {
|
|
|
this.sendWxInfoService = sendWxInfoService;
|
|
|
}
|
|
|
|
|
|
+ @Data
|
|
|
+ public static class Verification {
|
|
|
+ private String codeRs;
|
|
|
+ private String code;
|
|
|
+ private String newPwd;
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<UserInfo> login(UserInfo userInfo, boolean encrypt) {
|
|
|
Date now = new Date();
|
|
|
UserInfo tempUserInfo = dao.findUserByCodeRsFromDjUserBase(userInfo.getCodeRs());
|
|
@@ -105,6 +111,16 @@ public class LoginService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "验证码过期或者验证码错误。");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public ResultVo<String> checkVerificationCodeV2(Verification verification) {
|
|
|
+ int count = dao.checkVerificationCode(verification.getCodeRs(), verification.getCode());
|
|
|
+ if (count > 0) {
|
|
|
+ dao.updatePasswordByCodeRsV2(verification.getCodeRs(), SecureUtil.md5(verification.getNewPwd()));
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "验证成功,密码已修改");
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "验证码过期或者验证码错误。");
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<JSONObject> simpleLogin(String code) {
|
|
|
UserInfo us = dao.getUserInfoByCode(code);
|
|
|
if (us == null) {
|