登录增加限流控制

This commit is contained in:
none
2023-03-10 14:24:36 +08:00
parent f9dec16760
commit 81870bd802
7 changed files with 88 additions and 5 deletions

View File

@@ -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);
}
}