init
This commit is contained in:
24
src/main/java/cn/wujiangbo/controller/TestController.java
Normal file
24
src/main/java/cn/wujiangbo/controller/TestController.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package cn.wujiangbo.controller;
|
||||
|
||||
import cn.wujiangbo.annotation.RateLimit;
|
||||
import cn.wujiangbo.result.JSONResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>测试类</p>
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
public class TestController {
|
||||
|
||||
//cycle秒内只能访问count次
|
||||
@RateLimit(key= "testLimit:", count = 2, cycle = 2, msg = "同志,不要请求这么快,好吗")
|
||||
@GetMapping("/test001")
|
||||
public JSONResult test001() {
|
||||
System.out.println("成功发送一条短信");
|
||||
return JSONResult.success("成功发送一条短信");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user