This commit is contained in:
沈健
2024-12-27 16:57:18 +08:00
parent 140470bbc5
commit e880ab2015
2 changed files with 5 additions and 3 deletions
@@ -8,7 +8,8 @@ public enum HttpStatusCodeEnum {
BAD_REQUEST_DECRYPT_ERROR(4002,"加密参数解密失败"), BAD_REQUEST_DECRYPT_ERROR(4002,"加密参数解密失败"),
UN_AUTHORIZED(401,"请求未被授权"), UN_AUTHORIZED(401,"请求未被授权"),
SERVER_ERROR(500,"服务器内部错误"), SERVER_ERROR(500,"服务器内部错误"),
SERVER_FORBID(403,"请求频繁"); SERVER_FORBID(403,"请求频繁"),
UPGRADE(503,"服务升级中");
private final int code; private final int code;
private final String msg; private final String msg;
@@ -32,10 +32,11 @@ public class FangjiaOpenExceptionHandler implements ExceptionHandler {
} catch (Exception e1) { } catch (Exception e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
context.getResponse().setStatus(500); // 临时改,后面还原 TODO
context.getResponse().setStatus(503);
context.getResponse().setCharacterEncoding("UTF-8"); context.getResponse().setCharacterEncoding("UTF-8");
context.getResponse().setContentType("application/json;charset=UTF-8"); context.getResponse().setContentType("application/json;charset=UTF-8");
context.getResponse().getWriter().println("{\"code\":500, \"msg\":\"服务升级中...\"}"); context.getResponse().getWriter().println("{\"code\":503, \"msg\":\"服务升级中\"}");
} }
public static String getLocalHostIP() { public static String getLocalHostIP() {