style: 响应信息改英文
This commit is contained in:
@@ -103,7 +103,7 @@ func (s *SysDictDataApi) List(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *SysDictDataApi) Info(w http.ResponseWriter, r *http.Request) {
|
||||
dictCode := ctx.Param(r, "dictCode")
|
||||
if dictCode == "" {
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictDataService.SelectDictDataByCode(dictCode)
|
||||
@@ -121,21 +121,21 @@ func (s *SysDictDataApi) Add(w http.ResponseWriter, r *http.Request) {
|
||||
var body model.SysDictData
|
||||
err := ctx.ShouldBindJSON(r, &body)
|
||||
if err != nil || body.DictCode != "" {
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
ctx.JSON(w, 200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
ctx.JSON(w, 200, result.ErrMsg("No permission to access dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, "")
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
msg := fmt.Sprintf("[%s] The subscript signature of this dictionary type already exists", body.DictLabel)
|
||||
ctx.JSON(w, 200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func (s *SysDictDataApi) Add(w http.ResponseWriter, r *http.Request) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, "")
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
msg := fmt.Sprintf("[%s] The label value under this dictionary type already exists", body.DictValue)
|
||||
ctx.JSON(w, 200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -164,28 +164,28 @@ func (s *SysDictDataApi) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
var body model.SysDictData
|
||||
err := ctx.ShouldBindJSON(r, &body)
|
||||
if err != nil || body.DictCode == "" {
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
ctx.JSON(w, 200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
ctx.JSON(w, 200, result.ErrMsg("No permission to access dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典编码是否存在
|
||||
SysDictDataApi := s.sysDictDataService.SelectDictDataByCode(body.DictCode)
|
||||
if SysDictDataApi.DictCode != body.DictCode {
|
||||
ctx.JSON(w, 200, result.ErrMsg("没有权限访问字典编码数据!"))
|
||||
ctx.JSON(w, 200, result.ErrMsg("No permission to access dictionary encoding data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, body.DictCode)
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
msg := fmt.Sprintf("Data modification failed for [%s], the dictionary type subscript signature already exists", body.DictLabel)
|
||||
ctx.JSON(w, 200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -193,7 +193,7 @@ func (s *SysDictDataApi) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, body.DictCode)
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
msg := fmt.Sprintf("Data modification failed for [%s], label value already exists under this dictionary type", body.DictValue)
|
||||
ctx.JSON(w, 200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -213,7 +213,7 @@ func (s *SysDictDataApi) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *SysDictDataApi) Remove(w http.ResponseWriter, r *http.Request) {
|
||||
dictCodes := ctx.Param(r, "dictCodes")
|
||||
if dictCodes == "" {
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -228,7 +228,7 @@ func (s *SysDictDataApi) Remove(w http.ResponseWriter, r *http.Request) {
|
||||
ctx.JSON(w, 200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Successfully deleted: %d", rows)
|
||||
ctx.JSON(w, 200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ func (s *SysDictDataApi) Remove(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *SysDictDataApi) DictType(w http.ResponseWriter, r *http.Request) {
|
||||
dictType := ctx.Param(r, "dictType")
|
||||
if dictType == "" {
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user