优化部分错误码

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
@@ -1,12 +1,15 @@
package apiReturn
var ErrorCodeMap = map[int]string{
// -1:操作失败
// -1:操作失败(前端会自动弹窗)
// 100: "operation failed",
1000: "Not logged in yet", // 还未登录
1003: "Incorrect username or password", // 用户名或密码错误
1004: "Account disabled or not activated", // 账号已停用或未激活
1005: "No current permission for operation", // 当前无权限操作
1006: "Account does not exist", // 账号不存在
1007: "Old password error", // 旧密码不正确
// 数据类
1200: "Database error", // 数据库错误
+2 -1
View File
@@ -28,7 +28,8 @@ func (a *ItemIcon) Edit(c *gin.Context) {
}
if req.ItemIconGroupId == 0 {
apiReturn.Error(c, "Group is mandatory")
// apiReturn.Error(c, "Group is mandatory")
apiReturn.ErrorParamFomat(c, "Group is mandatory")
return
}
+1 -1
View File
@@ -97,7 +97,7 @@ func (a *UserApi) UpdatePasssword(c *gin.Context) {
} else {
if v.Password != cmn.PasswordEncryption(params.OldPassword) {
// 旧密码不正确
apiReturn.Error(c, global.Lang.Get("user.api_old_pass_error"))
apiReturn.ErrorByCode(c, 1007)
return
}
}