优化部分错误码

This commit is contained in:
Sun 2024-01-24 13:55:28 +08:00
parent 863cdf0fc1
commit e0dcc49f5b
6 changed files with 10 additions and 12 deletions

View File

@ -1,12 +1,15 @@
package apiReturn package apiReturn
var ErrorCodeMap = map[int]string{ var ErrorCodeMap = map[int]string{
// -1:操作失败 // -1:操作失败(前端会自动弹窗)
// 100: "operation failed",
1000: "Not logged in yet", // 还未登录 1000: "Not logged in yet", // 还未登录
1003: "Incorrect username or password", // 用户名或密码错误 1003: "Incorrect username or password", // 用户名或密码错误
1004: "Account disabled or not activated", // 账号已停用或未激活 1004: "Account disabled or not activated", // 账号已停用或未激活
1005: "No current permission for operation", // 当前无权限操作 1005: "No current permission for operation", // 当前无权限操作
1006: "Account does not exist", // 账号不存在 1006: "Account does not exist", // 账号不存在
1007: "Old password error", // 旧密码不正确
// 数据类 // 数据类
1200: "Database error", // 数据库错误 1200: "Database error", // 数据库错误

View File

@ -28,7 +28,8 @@ func (a *ItemIcon) Edit(c *gin.Context) {
} }
if req.ItemIconGroupId == 0 { if req.ItemIconGroupId == 0 {
apiReturn.Error(c, "Group is mandatory") // apiReturn.Error(c, "Group is mandatory")
apiReturn.ErrorParamFomat(c, "Group is mandatory")
return return
} }

View File

@ -97,7 +97,7 @@ func (a *UserApi) UpdatePasssword(c *gin.Context) {
} else { } else {
if v.Password != cmn.PasswordEncryption(params.OldPassword) { if v.Password != cmn.PasswordEncryption(params.OldPassword) {
// 旧密码不正确 // 旧密码不正确
apiReturn.Error(c, global.Lang.Get("user.api_old_pass_error")) apiReturn.ErrorByCode(c, 1007)
return return
} }
} }

View File

@ -104,14 +104,6 @@ function handleUpdatePassword(e: MouseEvent) {
updatePasswordModalState.value.show = false updatePasswordModalState.value.show = false
ms.success(t('common.success')) ms.success(t('common.success'))
} }
else if (code === 0) {
//
}
else {
//
ms.error(`${t('common.failed')}:${msg}`)
}
}).finally(() => { }).finally(() => {
updatePasswordModalState.value.loading = false updatePasswordModalState.value.loading = false
}).catch(() => { }).catch(() => {

View File

@ -25,6 +25,7 @@
"1004": "Account has been deactivated or inactivated", "1004": "Account has been deactivated or inactivated",
"1005": "Currently no permission to operate", "1005": "Currently no permission to operate",
"1006": "Account does not exist", "1006": "Account does not exist",
"1007": "Old password error",
"1200": "database error", "1200": "database error",
"1201": "Please keep at least one", "1201": "Please keep at least one",
"1202": "Data record not found", "1202": "Data record not found",

View File

@ -25,6 +25,7 @@
"1004": "账号已停用或未激活", "1004": "账号已停用或未激活",
"1005": "当前无权限操作", "1005": "当前无权限操作",
"1006": "账号不存在", "1006": "账号不存在",
"1007": "旧密码错误",
"1200": "数据库出错", "1200": "数据库出错",
"1201": "请至少保留一个", "1201": "请至少保留一个",
"1202": "未找到数据记录", "1202": "未找到数据记录",
@ -55,7 +56,7 @@
"configFailed": "配置保存失败,{message}", "configFailed": "配置保存失败,{message}",
"configSaved": "配置已保存", "configSaved": "配置已保存",
"contentArea": "内容区域", "contentArea": "内容区域",
"customFooter": "自定义footer", "customFooter": "自定义页脚",
"customImageAddress": "展开图片链接输入框", "customImageAddress": "展开图片链接输入框",
"detailIcon": "详情图标", "detailIcon": "详情图标",
"hideDescription": "隐藏描述信息", "hideDescription": "隐藏描述信息",