mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-10 00:31:10 +08:00
!284 更新常量 GenConstants,优化 Map 返回结构
* update 优化返回结构, 将 Map 改为指定 Vo 对象 ; * update GenConstants 扩展数据库数据类型, 更新 BO, VO, ENTITY 字段, 并移动到 generator 模块 ;
This commit is contained in:
@@ -18,6 +18,7 @@ import com.ruoyi.common.sms.entity.SmsResult;
|
||||
import com.ruoyi.common.web.config.properties.CaptchaProperties;
|
||||
import com.ruoyi.common.web.enums.CaptchaType;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.web.domain.vo.CaptchaVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.expression.Expression;
|
||||
@@ -79,10 +80,12 @@ public class CaptchaController {
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public R<Map<String, Object>> getCode() {
|
||||
public R<CaptchaVo> getCode() {
|
||||
CaptchaVo captchaVo = new CaptchaVo();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
if (!captchaEnabled) {
|
||||
return R.ok(Map.of("captchaEnabled", false));
|
||||
captchaVo.setCaptchaEnabled(false);
|
||||
return R.ok(captchaVo);
|
||||
}
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
@@ -102,7 +105,9 @@ public class CaptchaController {
|
||||
code = exp.getValue(String.class);
|
||||
}
|
||||
RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
||||
return R.ok(Map.of("uuid", uuid, "img", captcha.getImageBase64()));
|
||||
captchaVo.setUuid(uuid);
|
||||
captchaVo.setImg(captcha.getImageBase64());
|
||||
return R.ok(captchaVo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user