第一版
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.gameparlor.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ResultCode {
|
||||
SUCCESS(200, "成功"),
|
||||
BAD_REQUEST(400, "请求参数错误"),
|
||||
UNAUTHORIZED(401, "未登录或登录已过期"),
|
||||
FORBIDDEN(403, "没有权限"),
|
||||
NOT_FOUND(404, "资源不存在"),
|
||||
INTERNAL_ERROR(500, "服务器内部错误"),
|
||||
|
||||
// 业务错误
|
||||
BALANCE_NOT_ENOUGH(4001, "余额不足"),
|
||||
POINTS_NOT_ENOUGH(4002, "积分不足"),
|
||||
USERNAME_EXISTS(4003, "用户名已存在"),
|
||||
USERNAME_OR_PASSWORD_ERROR(4004, "用户名或密码错误"),
|
||||
AUTH_CODE_ERROR(4005, "授权码错误"),
|
||||
ORDER_NOT_FOUND(4006, "订单不存在"),
|
||||
ITEM_NOT_FOUND(4007, "项目不存在"),
|
||||
MEMBER_ONLY(4008, "仅会员可操作"),
|
||||
OPTIMISTIC_LOCK(4009, "操作过于频繁,请重试"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
ResultCode(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user