|
|
@@ -2,6 +2,7 @@ package com.tech.controller;
|
|
|
|
|
|
import cn.hutool.captcha.CaptchaUtil;
|
|
|
import cn.hutool.captcha.CircleCaptcha;
|
|
|
+import cn.hutool.core.lang.Assert;
|
|
|
import com.tech.model.Demo;
|
|
|
import com.tech.model.User;
|
|
|
import com.tech.service.DemoService;
|
|
|
@@ -16,7 +17,6 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@@ -57,7 +57,7 @@ public class UserController {
|
|
|
redisUtil.delete("verifyCode" + ipAddr);
|
|
|
// 利用 hutool 工具,生成验证码图片资源
|
|
|
CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(130, 32, 4, 5);
|
|
|
- // 获得生成的验证码字符
|
|
|
+ // 获得生成的验证码字符·
|
|
|
String code = captcha.getCode();
|
|
|
redisUtil.add("verifyCode" + ipAddr, code, 3600);
|
|
|
// 将验证码图片的二进制数据写入【响应体 response 】
|
|
|
@@ -75,5 +75,12 @@ public class UserController {
|
|
|
public String test(Model model){
|
|
|
return "test";
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("demoD")
|
|
|
+ @PassToken
|
|
|
+ public void demoD(){
|
|
|
+ Assert.isNull("1231232", "测试断言");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|