mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-16 16:14:19 +08:00
登录增加限流控制
This commit is contained in:
@@ -9,6 +9,7 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import xyz.playedu.api.exception.LimitException;
|
||||
import xyz.playedu.api.exception.NotFoundException;
|
||||
import xyz.playedu.api.exception.ServiceException;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
@@ -66,4 +67,9 @@ public class ExceptionController {
|
||||
return JsonResponse.error(e.getMessage(), 404);
|
||||
}
|
||||
|
||||
@ExceptionHandler(LimitException.class)
|
||||
public JsonResponse serviceExceptionHandler(LimitException e) {
|
||||
return JsonResponse.error("请稍后再试", 429);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user