style: 错误信息英文返回-featues包
This commit is contained in:
@@ -92,12 +92,12 @@ func (r *ServiceSysConfig) DeleteConfigByIds(configIds []string) (int64, error)
|
||||
// 检查是否存在
|
||||
configs := r.sysConfigRepository.SelectConfigByIds(configIds)
|
||||
if len(configs) <= 0 {
|
||||
return 0, errors.New("没有权限访问参数配置数据!")
|
||||
return 0, errors.New("does not have permission to access parameter configuration data")
|
||||
}
|
||||
for _, config := range configs {
|
||||
// 检查是否为内置参数
|
||||
if config.ConfigType == "Y" {
|
||||
return 0, errors.New(config.ConfigID + " 配置参数属于内置参数,禁止删除!")
|
||||
return 0, errors.New(config.ConfigID + " Configuration parameters are built-in parameters and their deletion is prohibited!")
|
||||
}
|
||||
// 清除缓存
|
||||
r.clearConfigCache(config.ConfigKey)
|
||||
@@ -106,7 +106,7 @@ func (r *ServiceSysConfig) DeleteConfigByIds(configIds []string) (int64, error)
|
||||
rows := r.sysConfigRepository.DeleteConfigByIds(configIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除参数配置信息失败!")
|
||||
return 0, errors.New("failed to delete parameter configuration information")
|
||||
}
|
||||
|
||||
// ResetConfigCache 重置参数缓存数据
|
||||
|
||||
@@ -78,7 +78,7 @@ func (r *ServiceSysDictData) DeleteDictDataByCodes(dictCodes []string) (int64, e
|
||||
// 检查是否存在
|
||||
dictDatas := r.sysDictDataRepository.SelectDictDataByCodes(dictCodes)
|
||||
if len(dictDatas) <= 0 {
|
||||
return 0, errors.New("没有权限访问字典编码数据!")
|
||||
return 0, errors.New("does not have permission to access dictionary-encoded data")
|
||||
}
|
||||
if len(dictDatas) == len(dictCodes) {
|
||||
for _, v := range dictDatas {
|
||||
@@ -89,7 +89,7 @@ func (r *ServiceSysDictData) DeleteDictDataByCodes(dictCodes []string) (int64, e
|
||||
rows := r.sysDictDataRepository.DeleteDictDataByCodes(dictCodes)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除字典数据信息失败!")
|
||||
return 0, errors.New("failed to delete dictionary data information")
|
||||
}
|
||||
|
||||
// InsertDictData 新增字典数据信息
|
||||
|
||||
@@ -108,13 +108,13 @@ func (r *ServiceSysDictType) DeleteDictTypeByIDs(dictIDs []string) (int64, error
|
||||
// 检查是否存在
|
||||
dictTypes := r.sysDictTypeRepository.SelectDictTypeByIDs(dictIDs)
|
||||
if len(dictTypes) <= 0 {
|
||||
return 0, errors.New("没有权限访问字典类型数据!")
|
||||
return 0, errors.New("no permission to access dictionary type data")
|
||||
}
|
||||
for _, v := range dictTypes {
|
||||
// 字典类型下级含有数据
|
||||
useCount := r.sysDictDataRepository.CountDictDataByType(v.DictType)
|
||||
if useCount > 0 {
|
||||
msg := fmt.Sprintf("【%s】存在字典数据,不能删除", v.DictName)
|
||||
msg := fmt.Sprintf("[%s] Dictionary data exists and cannot be deleted. ", v.DictName)
|
||||
return 0, errors.New(msg)
|
||||
}
|
||||
// 清除缓存
|
||||
@@ -124,7 +124,7 @@ func (r *ServiceSysDictType) DeleteDictTypeByIDs(dictIDs []string) (int64, error
|
||||
rows := r.sysDictTypeRepository.DeleteDictTypeByIDs(dictIDs)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除字典数据信息失败!")
|
||||
return 0, errors.New("failed to delete dictionary data information")
|
||||
}
|
||||
|
||||
// ResetDictCache 重置字典缓存数据
|
||||
|
||||
@@ -97,17 +97,17 @@ func (r *ServiceSysRole) DeleteRoleByIds(roleIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
roles := r.sysRoleRepository.SelectRoleByIds(roleIds)
|
||||
if len(roles) <= 0 {
|
||||
return 0, errors.New("没有权限访问角色数据!")
|
||||
return 0, errors.New("no permission to access role data")
|
||||
}
|
||||
for _, role := range roles {
|
||||
// 检查是否为已删除
|
||||
if role.DelFlag == "1" {
|
||||
return 0, errors.New(role.RoleID + " 角色信息已经删除!")
|
||||
return 0, errors.New(role.RoleID + " The character information has been deleted")
|
||||
}
|
||||
// 检查分配用户
|
||||
userCount := r.sysUserRoleRepository.CountUserRoleByRoleId(role.RoleID)
|
||||
if userCount > 0 {
|
||||
msg := fmt.Sprintf("【%s】已分配给用户,不能删除", role.RoleName)
|
||||
msg := fmt.Sprintf("[%s] has been assigned to a user and cannot be deleted", role.RoleName)
|
||||
return 0, errors.New(msg)
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func (r *ServiceSysRole) DeleteRoleByIds(roleIds []string) (int64, error) {
|
||||
rows := r.sysRoleRepository.DeleteRoleByIds(roleIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除角色信息失败!")
|
||||
return 0, errors.New("failed to delete role information")
|
||||
}
|
||||
|
||||
// CheckUniqueRoleName 校验角色名称是否唯一
|
||||
|
||||
@@ -103,7 +103,7 @@ func (r *ServiceSysUser) DeleteUserByIds(userIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
users := r.sysUserRepository.SelectUserByIds(userIds)
|
||||
if len(users) <= 0 {
|
||||
return 0, errors.New("没有权限访问用户数据!")
|
||||
return 0, errors.New("no permission to access user data")
|
||||
}
|
||||
if len(users) == len(userIds) {
|
||||
// 删除用户与角色关联
|
||||
@@ -113,7 +113,7 @@ func (r *ServiceSysUser) DeleteUserByIds(userIds []string) (int64, error) {
|
||||
rows := r.sysUserRepository.DeleteUserByIds(userIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除用户信息失败!")
|
||||
return 0, errors.New("failed to delete user information")
|
||||
}
|
||||
|
||||
// CheckUniqueUserName 校验用户名称是否唯一
|
||||
|
||||
@@ -511,9 +511,9 @@ func (s *UdmUserApi) UdmAuthUserExport(w http.ResponseWriter, r *http.Request) {
|
||||
if body.Type == "csv" {
|
||||
// 转换数据
|
||||
data := [][]string{}
|
||||
data = append(data, []string{"imsi", "ki", "amf", "algo", "opc"})
|
||||
data = append(data, []string{"imsi", "ki", "algo", "amf", "opc"})
|
||||
for _, v := range list {
|
||||
data = append(data, []string{v.Imsi, v.Ki, v.Amf, v.AlgoIndex, v.Opc})
|
||||
data = append(data, []string{v.Imsi, v.Ki, v.AlgoIndex, v.Amf, v.Opc})
|
||||
}
|
||||
// 输出到文件
|
||||
err := file.WriterCSVFile(data, filePath)
|
||||
@@ -527,7 +527,7 @@ func (s *UdmUserApi) UdmAuthUserExport(w http.ResponseWriter, r *http.Request) {
|
||||
// 转换数据
|
||||
data := [][]string{}
|
||||
for _, v := range list {
|
||||
data = append(data, []string{v.Imsi, v.Ki, v.Amf, v.AlgoIndex, v.Opc})
|
||||
data = append(data, []string{v.Imsi, v.Ki, v.AlgoIndex, v.Amf, v.Opc})
|
||||
}
|
||||
// 输出到文件
|
||||
err = file.WriterTxtFile(data, filePath)
|
||||
@@ -1168,7 +1168,9 @@ func (s *UdmUserApi) UdmSubUserImport(w http.ResponseWriter, r *http.Request) {
|
||||
ctx.JSON(w, 200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
data2 := file.ReadCSVFile(localPath)
|
||||
neId = ""
|
||||
go s.subUser.InsertCSV(neId, data2)
|
||||
// 复制到远程
|
||||
err = ssh.FileSCPLocalToNe(neInfo.Ip, localPath, nePath)
|
||||
if err != nil {
|
||||
|
||||
@@ -210,6 +210,7 @@ func (r *RepoUdmAuthUser) Inserts(authUsers []model.UdmAuthUser) int64 {
|
||||
// 调用 InsertMulti 函数将批量数据插入数据库
|
||||
results, err := datasource.DefaultDB().Table("u_auth_user").InsertMulti(batch)
|
||||
if err != nil {
|
||||
log.Errorf("Insert err => %v", err)
|
||||
continue
|
||||
}
|
||||
num += results
|
||||
|
||||
@@ -220,6 +220,7 @@ func (r *RepoUdmSubUser) ClearAndInsert(neID string, subArr []model.UdmSubUser)
|
||||
func (r *RepoUdmSubUser) Insert(subUser model.UdmSubUser) int64 {
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Insert(subUser)
|
||||
if err != nil {
|
||||
log.Errorf("Insert err => %v", err)
|
||||
return results
|
||||
}
|
||||
return results
|
||||
@@ -240,6 +241,7 @@ func (r *RepoUdmSubUser) Inserts(subUser []model.UdmSubUser) int64 {
|
||||
// 调用 InsertMulti 函数将批量数据插入数据库
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").InsertMulti(batch)
|
||||
if err != nil {
|
||||
log.Errorf("Insert err => %v", err)
|
||||
continue
|
||||
}
|
||||
num += results
|
||||
@@ -266,6 +268,7 @@ func (r *RepoUdmSubUser) Insert4G(neID string, subUser model.UdmSubUser) int64 {
|
||||
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Insert(subUser)
|
||||
if err == nil {
|
||||
log.Errorf("Insert err => %v", err)
|
||||
insertNum += results
|
||||
}
|
||||
}
|
||||
@@ -336,6 +339,7 @@ func (r *RepoUdmSubUser) Update(neID string, authUser model.UdmSubUser) int64 {
|
||||
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Where("imsi = ? and ne_id = ?", user.Imsi, user.NeID).Update(user)
|
||||
if err != nil {
|
||||
log.Errorf("Update err => %v", err)
|
||||
return 0
|
||||
}
|
||||
return results
|
||||
@@ -373,6 +377,7 @@ func (r *RepoUdmSubUser) Update4GIP(neID string, subUser model.UdmSubUser) int64
|
||||
// 更新
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Update(user)
|
||||
if err == nil {
|
||||
log.Errorf("Update err => %v", err)
|
||||
insertNum += results
|
||||
}
|
||||
}
|
||||
@@ -406,6 +411,7 @@ func (r *RepoUdmSubUser) UpdateSmData(neID string, subUser model.UdmSubUser) int
|
||||
// 更新
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Update(user)
|
||||
if err == nil {
|
||||
log.Errorf("Update err => %v", err)
|
||||
insertNum += results
|
||||
}
|
||||
}
|
||||
@@ -417,6 +423,7 @@ func (r *RepoUdmSubUser) UpdateSmData(neID string, subUser model.UdmSubUser) int
|
||||
func (r *RepoUdmSubUser) Delete(neID, imsi string) int64 {
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Where("imsi = ? and ne_id = ?", imsi, neID).Delete()
|
||||
if err != nil {
|
||||
log.Errorf("Delete err => %v", err)
|
||||
return results
|
||||
}
|
||||
return results
|
||||
@@ -436,6 +443,7 @@ func (r *RepoUdmSubUser) Deletes(neID, imsi, num string) int64 {
|
||||
|
||||
results, err := datasource.DefaultDB().Table("u_sub_user").Where("imsi >= ? and imsi < ? and ne_id = ?", imsiV, imsiV+numV, neID).Delete()
|
||||
if err != nil {
|
||||
log.Errorf("Delete err => %v", err)
|
||||
return results
|
||||
}
|
||||
return results
|
||||
|
||||
@@ -90,12 +90,12 @@ func (r *ServiceUdmAuthUser) InsertCSV(neID string, data []map[string]string) in
|
||||
if s, ok := v["ki"]; ok {
|
||||
authUser.Ki = s
|
||||
}
|
||||
if s, ok := v["amf"]; ok {
|
||||
authUser.Amf = s
|
||||
}
|
||||
if s, ok := v["algo"]; ok {
|
||||
authUser.AlgoIndex = s
|
||||
}
|
||||
if s, ok := v["amf"]; ok {
|
||||
authUser.Amf = s
|
||||
}
|
||||
if s, ok := v["opc"]; ok {
|
||||
authUser.Opc = s
|
||||
}
|
||||
|
||||
@@ -137,6 +137,17 @@ func (r *ServiceUdmSubUser) InsertCSV(neID string, data []map[string]string) int
|
||||
}
|
||||
if s, ok := v["eps_dat"]; ok {
|
||||
subUser.EpsDat = s
|
||||
arr := strings.Split(s, ",")
|
||||
if len(arr) == 9 {
|
||||
subUser.EpsFlag = arr[0]
|
||||
subUser.EpsOdb = arr[1]
|
||||
subUser.HplmnOdb = arr[2]
|
||||
subUser.Ard = arr[3]
|
||||
subUser.Epstpl = arr[4]
|
||||
subUser.ContextId = arr[5]
|
||||
subUser.ApnContext = arr[7]
|
||||
subUser.StaticIp = arr[8]
|
||||
}
|
||||
}
|
||||
arr = append(arr, subUser)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user