fix: 微信小程序接口对接修改,联调测试问题修复。
This commit is contained in:
@@ -21,6 +21,7 @@ import com.intc.common.sms.config.properties.SmsProperties;
|
||||
import com.intc.common.web.config.properties.CaptchaProperties;
|
||||
import com.intc.common.web.enums.CaptchaType;
|
||||
import com.intc.web.domain.vo.CaptchaVo;
|
||||
import com.intc.fishery.domain.bo.ReqVerifySmsCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,6 +33,8 @@ import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -105,6 +108,31 @@ public class CaptchaController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证短信验证码
|
||||
*
|
||||
* @param request 手机号和验证码数据
|
||||
* @return 验证结果
|
||||
*/
|
||||
@PostMapping("/resource/sms/verify")
|
||||
public R<Void> verifySmsCode(@Validated @RequestBody ReqVerifySmsCode request) {
|
||||
String key = GlobalConstants.CAPTCHA_CODE_KEY + request.getMobilePhone();
|
||||
String cachedCode = RedisUtils.getCacheObject(key);
|
||||
|
||||
if (StringUtils.isBlank(cachedCode)) {
|
||||
return R.fail("短信验证码已过期");
|
||||
}
|
||||
|
||||
if (!cachedCode.equals(request.getSmsCode())) {
|
||||
return R.fail("短信验证码错误");
|
||||
}
|
||||
|
||||
// 验证成功后删除验证码(根据 C# 代码中的 true 参数)
|
||||
RedisUtils.deleteObject(key);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱验证码
|
||||
*
|
||||
|
||||
@@ -57,4 +57,14 @@ public class LoginVo {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ public class SmsAuthStrategy implements IAuthStrategy {
|
||||
loginVo.setExpireIn(StpUtil.getTokenTimeout());
|
||||
loginVo.setClientId(client.getClientId());
|
||||
loginVo.setUserId(loginUser.getUserId());
|
||||
loginVo.setNickName(loginUser.getNickname());
|
||||
loginVo.setUserName(loginUser.getUsername());
|
||||
return loginVo;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,12 @@ sms:
|
||||
# 模板内容需包含 ${code} 参数
|
||||
code-template-id: 'SMS_465720430' # TODO: 请填写您的阿里云短信模板CODE
|
||||
|
||||
|
||||
# 设备类型到 ProductKey 的映射配置
|
||||
device-type:
|
||||
# 1-水质检测仪 ProductKey(请填写实际的 ProductKey)
|
||||
water-quality-monitor: a15hA3oBPmB # TODO: 请替换为实际的水质检测仪 ProductKey
|
||||
# 2-控制一体机 ProductKey(请填写实际的 ProductKey)
|
||||
control-integrated: a1Xj9dagTIx # TODO: 请替换为实际的控制一体机 ProductKey
|
||||
--- # 阿里云生活物联网平台(飞燕平台)配置
|
||||
aliyun:
|
||||
living-iot:
|
||||
@@ -219,12 +224,6 @@ aliyun:
|
||||
app-key: 334224397
|
||||
# App Secret
|
||||
app-secret: 70de3018ec39423e9ca1e1b6a6a84ad6
|
||||
# 设备类型到 ProductKey 的映射配置
|
||||
device-type:
|
||||
# 1-水质检测仪 ProductKey(请填写实际的 ProductKey)
|
||||
water-quality-monitor: a15hA3oBPmB # TODO: 请替换为实际的水质检测仪 ProductKey
|
||||
# 2-控制一体机 ProductKey(请填写实际的 ProductKey)
|
||||
control-integrated: a1Xj9dagTIx # TODO: 请替换为实际的控制一体机 ProductKey
|
||||
# AMQP 服务端订阅配置(使用数据同步的 AppKey + AppSecret)
|
||||
amqp:
|
||||
# 是否启用
|
||||
|
||||
Reference in New Issue
Block a user