|
@@ -4,6 +4,7 @@ package com.example.xiaoshiweixinback.service;
|
|
|
import cn.hutool.captcha.CaptchaUtil;
|
|
|
import cn.hutool.captcha.CircleCaptcha;
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -94,6 +95,8 @@ public class LoginService {
|
|
|
if (ToolUtil.isEmpty(person)) {
|
|
|
person = new Person();
|
|
|
person.setPhoneNum(dto.getPhoneNum());
|
|
|
+ String uid = IdUtil.simpleUUID();
|
|
|
+ person.setUuid(uid);
|
|
|
personMapper.insert(person);
|
|
|
|
|
|
loginVO.setId(person.getId());
|
|
@@ -170,6 +173,8 @@ public class LoginService {
|
|
|
person.setFileGuid(fileGuid);
|
|
|
person.setPhoneNum(phoneNumber);
|
|
|
person.setOpenId(jscode2SessionWo.getOpenid());
|
|
|
+ String uid = IdUtil.simpleUUID();
|
|
|
+ person.setUuid(uid);
|
|
|
person.insert();
|
|
|
|
|
|
wxVO.setIfFirst(true);
|
|
@@ -210,7 +215,7 @@ public class LoginService {
|
|
|
* @return 1.生成验证码的base64转码 2.生成的UUID 与Redis里面的验证码KEY值一致
|
|
|
* @date: 20240401
|
|
|
*/
|
|
|
- public boolean verifyCode(PersonPhoneDTO vo) {
|
|
|
+ public Map<String, String> verifyCode(PersonPhoneDTO vo) {
|
|
|
if (!RegexUtil.isPhoneLegal(vo.getPhoneNum())) {
|
|
|
throw new BusinessException(ExceptionEnum.PHONE_FORMAT_ERROR);
|
|
|
}
|
|
@@ -224,7 +229,7 @@ public class LoginService {
|
|
|
result.put("uuid", uuid);
|
|
|
//4.将验证码存放到Redis里面并设置过期时间为 60 单位:秒 KEY值格式为: 验证码:UUID VALUE值为:验证码生成工具所生成的验证码
|
|
|
redisUtil.setEx(AppCacheKeyUtil.getCheckCode(vo.getPhoneNum()), captcha.getCode(), 60, TimeUnit.SECONDS);
|
|
|
- return true;
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|