update
This commit is contained in:
@@ -35,4 +35,8 @@ public class ApiConst {
|
||||
|
||||
public static final String API_UPLOAD_PICTURE_FAILED_MSG = "上传图片失败";
|
||||
|
||||
public static final int API_SYS_ERR_CODE = 500;
|
||||
|
||||
public static final String API_SYS_ERR_MSG = "系统异常!";
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.cwhelp.common.vo.ResultVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -36,6 +37,13 @@ public class ResultExceptionHandler {
|
||||
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
@ResponseBody
|
||||
public ResultVo methodArgumentNotValidException(MethodArgumentNotValidException e){
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
|
||||
}
|
||||
|
||||
// 拦截未知的运行时异常
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ResponseBody
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.io.PrintWriter;
|
||||
*/
|
||||
@Component
|
||||
@ServletComponentScan
|
||||
@WebFilter(filterName = "apiLoginFilter", urlPatterns = {"/api_biz/*"})
|
||||
@WebFilter(filterName = "apiLoginFilter", urlPatterns = {"/api_biz/*", "/api/biz/*"})
|
||||
public class ApiLoginFilter implements Filter {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user