修改注释
This commit is contained in:
@ -2,7 +2,7 @@ package co.jp.app.common;
|
||||
|
||||
public enum ResultCode {
|
||||
|
||||
SUCCESS(200, "Success"), // 通常与 HTTP 200 OK 对应
|
||||
SUCCESS(200, "Success"),
|
||||
|
||||
// 客户端错误段 (1000 - 1999)
|
||||
BAD_REQUEST(1000, "HTTP 400 Bad Request"),
|
||||
@ -12,11 +12,11 @@ public enum ResultCode {
|
||||
METHOD_NOT_ALLOWED(1004, "HTTP 405 Method Not Allowed"),
|
||||
REQUEST_TIMEOUT(1005, "HTTP 408 Request Timeout"),
|
||||
CONFLICT(1006, "HTTP 409 Conflict"),
|
||||
UNSUPPORTED_MEDIA_TYPE(1007, "HTTP 415 Unsupported Media Type"), // 对应
|
||||
TOO_MANY_REQUESTS(1008, "HTTP 429 Too Many Requests"), // 对应
|
||||
VALIDATION_ERROR(1009, "Parameter validation failure"), // 通常由 @Valid 触发,可包含更详细的字段错误信息
|
||||
UNSUPPORTED_MEDIA_TYPE(1007, "HTTP 415 Unsupported Media Type"),
|
||||
TOO_MANY_REQUESTS(1008, "HTTP 429 Too Many Requests"),
|
||||
VALIDATION_ERROR(1009, "Parameter validation failure"),
|
||||
|
||||
// 服务端错误段 (2000 - 2999) - 通常建议与 HTTP 5xx 状态码含义相似
|
||||
// 服务端错误段 (2000 - 2999)
|
||||
INTERNAL_SERVER_ERROR(2000, "HTTP 500 Internal Server Error"),
|
||||
SERVICE_UNAVAILABLE(2001, "HTTP 503 Service Unavailable"),
|
||||
GATEWAY_TIMEOUT(2002, "HTTP 504 Gateway Timeout"),
|
||||
@ -26,7 +26,7 @@ public enum ResultCode {
|
||||
|
||||
// ================================== 用户模块状态码 (3000 - 3999) ==================================
|
||||
// 注册相关
|
||||
// USER_REGISTRATION_SUCCESS(3000, "用户注册成功"), // 成功状态也可以用通用的 SUCCESS
|
||||
// USER_REGISTRATION_SUCCESS(3000, "用户注册成功"),
|
||||
USER_EMAIL_ALREADY_EXISTS(3001, "Email already exists"),
|
||||
// USER_USERNAME_ALREADY_EXISTS(3002, "Username"),
|
||||
USER_PASSWORD_TOO_SHORT(3003, "password too short"),
|
||||
@ -77,7 +77,6 @@ public enum ResultCode {
|
||||
return message;
|
||||
}
|
||||
|
||||
// (可选) 允许覆盖默认消息的方法,用于更具体的场景
|
||||
public String getMessage(String customDetail) {
|
||||
return this.message + (customDetail == null || customDetail.isEmpty() ? "" : " (" + customDetail + ")");
|
||||
}
|
||||
|
Reference in New Issue
Block a user