style: 错误提示英文内容

This commit is contained in:
TsMask
2023-11-07 15:58:34 +08:00
parent 5a5c4d2da9
commit 449871bb29
5 changed files with 29 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
package service
import (
"errors"
"fmt"
"ems.agt/src/framework/constants/cachekey"
@@ -37,16 +36,16 @@ func (s *RegisterImpl) ValidateCaptcha(code, uuid string) error {
return nil
}
if code == "" || uuid == "" {
return errors.New("验证码信息错误")
return fmt.Errorf("verification code information error")
}
verifyKey := cachekey.CAPTCHA_CODE_KEY + uuid
captcha, err := redis.Get("", verifyKey)
if err != nil {
return errors.New("验证码已失效")
return fmt.Errorf("the verification code has expired")
}
redis.Del("", verifyKey)
if captcha != code {
return errors.New("验证码错误")
return fmt.Errorf("verification code error")
}
return nil
}
@@ -57,13 +56,13 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
registerUserStr := s.sysConfigService.SelectConfigValueByKey("sys.account.registerUser")
captchaEnabled := parse.Boolean(registerUserStr)
if !captchaEnabled {
return "", fmt.Errorf("注册用户【%s】失败很抱歉系统已关闭外部用户注册通道", username)
return "", fmt.Errorf("failed to register user [%s]. Sorry, the system has closed the external user registration channel", username)
}
// 检查用户登录账号是否唯一
uniqueUserName := s.sysUserService.CheckUniqueUserName(username, "")
if !uniqueUserName {
return "", fmt.Errorf("注册用户【%s】失败注册账号已存在", username)
return "", fmt.Errorf("failed to register user [%s], registered account already exists", username)
}
sysUser := systemModel.SysUser{
@@ -72,7 +71,7 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
Password: password, // 原始密码
Status: common.STATUS_YES, // 账号状态激活
DeptID: "100", // 归属部门为根节点
CreateBy: "注册", // 创建来源
CreateBy: "register", // 创建来源
}
// 标记用户类型
if userType == "" {
@@ -87,7 +86,7 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
if insertId != "" {
return insertId, nil
}
return "", fmt.Errorf("注册用户【%s】失败请联系系统管理人员", username)
return "", fmt.Errorf("failed to register user [%s]. Please contact the system administrator", username)
}
// registerRoleInit 注册初始角色