Finish half translation work.

This commit is contained in:
zicla
2019-05-04 23:36:05 +08:00
parent 900924d196
commit 5625149766
52 changed files with 613 additions and 950 deletions

View File

@ -23,23 +23,18 @@ type CodeWrapper struct {
}
var (
OK = &CodeWrapper{Code: "OK", HttpStatus: http.StatusOK, Description: "成功"}
BAD_REQUEST = &CodeWrapper{Code: "BAD_REQUEST", HttpStatus: http.StatusBadRequest, Description: "请求不合法"}
CAPTCHA_ERROR = &CodeWrapper{Code: "CAPTCHA_ERROR", HttpStatus: http.StatusBadRequest, Description: "验证码错误"}
NEED_CAPTCHA = &CodeWrapper{Code: "NEED_CAPTCHA", HttpStatus: http.StatusBadRequest, Description: "验证码必填"}
NEED_SHARE_CODE = &CodeWrapper{Code: "NEED_SHARE_CODE", HttpStatus: http.StatusUnauthorized, Description: "分享提取码必填"}
SHARE_CODE_ERROR = &CodeWrapper{Code: "SHARE_CODE_ERROR", HttpStatus: http.StatusUnauthorized, Description: "分享提取码错误"}
USERNAME_PASSWORD_ERROR = &CodeWrapper{Code: "USERNAME_PASSWORD_ERROR", HttpStatus: http.StatusBadRequest, Description: "用户名或密码错误"}
PARAMS_ERROR = &CodeWrapper{Code: "PARAMS_ERROR", HttpStatus: http.StatusBadRequest, Description: "用户名或密码错误"}
LOGIN = &CodeWrapper{Code: "LOGIN", HttpStatus: http.StatusUnauthorized, Description: "未登录,禁止访问"}
LOGIN_EXPIRE = &CodeWrapper{Code: "LOGIN_EXPIRE", HttpStatus: http.StatusUnauthorized, Description: "登录过期,请重新登录"}
USER_DISABLED = &CodeWrapper{Code: "USER_DISABLED", HttpStatus: http.StatusForbidden, Description: "账户被禁用,禁止访问"}
UNAUTHORIZED = &CodeWrapper{Code: "UNAUTHORIZED", HttpStatus: http.StatusUnauthorized, Description: "没有权限,禁止访问"}
NOT_FOUND = &CodeWrapper{Code: "NOT_FOUND", HttpStatus: http.StatusNotFound, Description: "内容不存在"}
RANGE_NOT_SATISFIABLE = &CodeWrapper{Code: "RANGE_NOT_SATISFIABLE", HttpStatus: http.StatusRequestedRangeNotSatisfiable, Description: "文件范围读取错误"}
NOT_INSTALLED = &CodeWrapper{Code: "NOT_INSTALLED", HttpStatus: http.StatusInternalServerError, Description: "系统尚未安装"}
SERVER = &CodeWrapper{Code: "SERVER", HttpStatus: http.StatusInternalServerError, Description: "服务器出错"}
UNKNOWN = &CodeWrapper{Code: "UNKNOWN", HttpStatus: http.StatusInternalServerError, Description: "服务器未知错误"}
OK = &CodeWrapper{Code: "OK", HttpStatus: http.StatusOK, Description: "ok"}
BAD_REQUEST = &CodeWrapper{Code: "BAD_REQUEST", HttpStatus: http.StatusBadRequest, Description: "bad request"}
NEED_SHARE_CODE = &CodeWrapper{Code: "NEED_SHARE_CODE", HttpStatus: http.StatusUnauthorized, Description: "share code required"}
SHARE_CODE_ERROR = &CodeWrapper{Code: "SHARE_CODE_ERROR", HttpStatus: http.StatusUnauthorized, Description: "share code error"}
LOGIN = &CodeWrapper{Code: "LOGIN", HttpStatus: http.StatusUnauthorized, Description: "not login"}
USER_DISABLED = &CodeWrapper{Code: "USER_DISABLED", HttpStatus: http.StatusForbidden, Description: "user disabled"}
UNAUTHORIZED = &CodeWrapper{Code: "UNAUTHORIZED", HttpStatus: http.StatusUnauthorized, Description: "unauthorized"}
NOT_FOUND = &CodeWrapper{Code: "NOT_FOUND", HttpStatus: http.StatusNotFound, Description: "404 not found"}
RANGE_NOT_SATISFIABLE = &CodeWrapper{Code: "RANGE_NOT_SATISFIABLE", HttpStatus: http.StatusRequestedRangeNotSatisfiable, Description: "range not satisfiable"}
NOT_INSTALLED = &CodeWrapper{Code: "NOT_INSTALLED", HttpStatus: http.StatusInternalServerError, Description: "application not installed"}
SERVER = &CodeWrapper{Code: "SERVER", HttpStatus: http.StatusInternalServerError, Description: "server error"}
UNKNOWN = &CodeWrapper{Code: "UNKNOWN", HttpStatus: http.StatusInternalServerError, Description: "server unknow error"}
)
//根据 CodeWrapper来获取对应的HttpStatus
@ -48,22 +43,12 @@ func FetchHttpStatus(code string) int {
return OK.HttpStatus
} else if code == BAD_REQUEST.Code {
return BAD_REQUEST.HttpStatus
} else if code == CAPTCHA_ERROR.Code {
return CAPTCHA_ERROR.HttpStatus
} else if code == NEED_CAPTCHA.Code {
return NEED_CAPTCHA.HttpStatus
} else if code == NEED_SHARE_CODE.Code {
return NEED_SHARE_CODE.HttpStatus
} else if code == SHARE_CODE_ERROR.Code {
return SHARE_CODE_ERROR.HttpStatus
} else if code == USERNAME_PASSWORD_ERROR.Code {
return USERNAME_PASSWORD_ERROR.HttpStatus
} else if code == PARAMS_ERROR.Code {
return PARAMS_ERROR.HttpStatus
} else if code == LOGIN.Code {
return LOGIN.HttpStatus
} else if code == LOGIN_EXPIRE.Code {
return LOGIN_EXPIRE.HttpStatus
} else if code == USER_DISABLED.Code {
return USER_DISABLED.HttpStatus
} else if code == UNAUTHORIZED.Code {