AuthPlatform/src/util/status.lua

97 lines
4.2 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--HTTP 返回状态
--ngx.HTTP_OK (200)
--ngx.HTTP_CREATED (201)
--ngx.HTTP_SPECIAL_RESPONSE (300)
--ngx.HTTP_MOVED_PERMANENTLY (301)
--ngx.HTTP_MOVED_TEMPORARILY (302)
--ngx.HTTP_SEE_OTHER (303)
--ngx.HTTP_NOT_MODIFIED (304)
--ngx.HTTP_BAD_REQUEST (400)
--ngx.HTTP_UNAUTHORIZED (401)
--ngx.HTTP_FORBIDDEN (403)
--ngx.HTTP_NOT_FOUND (404)
--ngx.HTTP_NOT_ALLOWED (405)
--ngx.HTTP_GONE (410)
--ngx.HTTP_INTERNAL_SERVER_ERROR (500)
--ngx.HTTP_METHOD_NOT_IMPLEMENTED (501)
--ngx.HTTP_SERVICE_UNAVAILABLE (503)
--ngx.HTTP_GATEWAY_TIMEOUT (504)
-- 通用响应状态 @enum STATUS_CODES
local _M = {
-- 成功状态码
SUCCESS = { code = 200, message = "操作成功" },
--[[
HTTP_SPECIAL_RESPONSE(300, "操作成功"),
HTTP_MOVED_PERMANENTLY(301, "操作成功"),
HTTP_MOVED_TEMPORARILY(302, "操作成功"),
HTTP_SEE_OTHER(303, "操作成功"),
HTTP_NOT_MODIFIED(304, "操作成功"),
HTTP_BAD_REQUEST(400, "操作成功"),
HTTP_UNAUTHORIZED(401, "操作成功"),
HTTP_FORBIDDEN(403, "操作成功"),
HTTP_NOT_FOUND(404, "操作成功"),
HTTP_NOT_ALLOWED(405, "操作成功"),
--
HTTP_INTERNAL_SERVER_ERROR(500, "操作成功"),
HTTP_METHOD_NOT_IMPLEMENTED(501, "操作成功"),
HTTP_SERVICE_UNAVAILABLE(503, "操作成功"),
HTTP_GATEWAY_TIMEOUT(504, "操作成功"),
--]]
-- 参数错误1000-1099
PARAM_IS_INVALID = { code = 1000, message = "参数无效" },
PARAM_IS_BLANK = { code = 1001, message = "参数为空" },
PARAM_TYPE_BIND_ERROR = { code = 1002, message = "参数格式错误" },
PARAM_NOT_COMPLETE = { code = 1003, message = "参数缺失" },
DATA_NONE_FOUNT = { code = 1004, message = "数据未找到" },
DATA_IS_WRONG = { code = 1005, message = "数据有误" },
DATA_ALREADY_EXISTED = { code = 1006, message = "数据已存在" },
AUTH_CODE_ERROR = { code = 1007, message = "验证码错误" },
-- 注册错误1100-1199
REG_USERNAME_EXIST = { code = 1100, message = "注册失败,用户名已存在" },
REG_TELPHONE_EXIST = { code = 1101, message = "注册失败,手机号已存在" },
REG_EMAIL_EXIST = { code = 1102, message = "注册失败,邮箱地址已存在" },
REG_IDCARD_EXIST = { code = 1103, message = "注册失败,证件号码已存在" },
RESET_PASSWD_ERROR = { code = 1104, message = '重置密码失败,旧密码错误' },
RESET_PASSWD_SYSTEM_ERROR = { code = 1105, message = '重置密码失败,系统异常' },
RESET_PASSWD_DIFFERENT = { code = 1106, message = '重置密码失败,新密码不能和旧密码相同' },
-- 用户错误1200-1299
USER_NOT_LOGIN = { code = 1200, message = "用户未登录,请先登录" },
USER_LOGIN_ERROR = { code = 1201, message = "用户不存在或密码错误" },
USER_ACCOUNT_FORBIDDEN = { code = 1202, message = "用户已被禁用" },
USER_ACCOUNT_LOCKED = { code = 1203, message = "用户已被锁定" },
USER_NOT_EXIST = { code = 1204, message = "用户不存在" },
USER_HAS_EXISTED = { code = 1205, message = "用户已存在" },
ACCOUNT_NOT_LOGIN = { code = 1250, message = "账户未登录,请先登录" },
ACCOUNT_LOGIN_ERROR = { code = 1251, message = "账户不存在或密码错误" },
ACCOUNT_ACCOUNT_FORBIDDEN = { code = 1252, message = "账户已被禁用" },
ACCOUNT_ACCOUNT_LOCKED = { code = 1253, message = "账户已被锁定" },
ACCOUNT_NOT_EXIST = { code = 1254, message = "账户不存在" },
ACCOUNT_HAS_EXISTED = { code = 1255, message = "账户已存在" },
-- 错误1300-1399
-- 权限错误1400-1499
PERMISSION_UNAUTHENTICATED = { code = 1400, message = "此操作需要登陆系统" },
PERMISSION_UNAUTHORISE = { code = 1401, message = "权限不足,无权操作" },
PERMISSION_EXPIRED = { code = 1402, message = "登录状态已过期" },
TOKEN_EXPIRED = { code = 1403, message = "token已过期" },
TOKEN_LIMIT = { code = 1404, message = "访问次数受限制" },
TOKEN_INVALID = { code = 1405, message = "无效token" },
TOKEN_SIGNATURE_ERROR = { code = 1406, message = "签名失败" },
-- 未知错误9999
UNKNOWN_ERROR = { code = 9999, message = "未知错误" },
}
return _M