style: 错误信息英文返回-system 模块路由
This commit is contained in:
@@ -45,7 +45,7 @@ func (s *SysConfigController) List(c *gin.Context) {
|
||||
func (s *SysConfigController) Info(c *gin.Context) {
|
||||
configId := c.Param("configId")
|
||||
if configId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysConfigService.SelectConfigById(configId)
|
||||
@@ -63,14 +63,15 @@ func (s *SysConfigController) Add(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.ConfigID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查属性值唯一
|
||||
uniqueConfigKey := s.sysConfigService.CheckUniqueConfigKey(body.ConfigKey, "")
|
||||
if !uniqueConfigKey {
|
||||
msg := fmt.Sprintf("参数配置新增【%s】失败,参数键名已存在", body.ConfigKey)
|
||||
// 参数配置新增【%s】失败,参数键名已存在
|
||||
msg := fmt.Sprintf("Parameter configuration add [%s] failed, parameter key name already exists", body.ConfigKey)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -91,14 +92,15 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.ConfigID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查属性值唯一
|
||||
uniqueConfigKey := s.sysConfigService.CheckUniqueConfigKey(body.ConfigKey, body.ConfigID)
|
||||
if !uniqueConfigKey {
|
||||
msg := fmt.Sprintf("参数配置修改【%s】失败,参数键名已存在", body.ConfigKey)
|
||||
// 参数配置修改【%s】失败,参数键名已存在
|
||||
msg := fmt.Sprintf("Parameter configuration modification [%s] failed, parameter key name already exists", body.ConfigKey)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -106,7 +108,8 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
// 检查是否存在
|
||||
config := s.sysConfigService.SelectConfigById(body.ConfigID)
|
||||
if config.ConfigID != body.ConfigID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问参数配置数据!"))
|
||||
// 没有可访问参数配置数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible parameter configuration data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +128,7 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
func (s *SysConfigController) Remove(c *gin.Context) {
|
||||
configIds := c.Param("configIds")
|
||||
if configIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -140,7 +143,7 @@ func (s *SysConfigController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -158,7 +161,7 @@ func (s *SysConfigController) RefreshCache(c *gin.Context) {
|
||||
func (s *SysConfigController) ConfigKey(c *gin.Context) {
|
||||
configKey := c.Param("configKey")
|
||||
if configKey == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
key := s.sysConfigService.SelectConfigValueByKey(configKey)
|
||||
@@ -177,7 +180,8 @@ func (s *SysConfigController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysConfigService.SelectConfigPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysConfig)
|
||||
@@ -186,19 +190,19 @@ func (s *SysConfigController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("config_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "参数编号",
|
||||
"B1": "参数名称",
|
||||
"C1": "参数键名",
|
||||
"D1": "参数键值",
|
||||
"E1": "系统内置",
|
||||
"A1": "ConfigID",
|
||||
"B1": "ConfigName",
|
||||
"C1": "ConfigKey",
|
||||
"D1": "ConfigValue",
|
||||
"E1": "Type",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
typeValue := "否"
|
||||
typeValue := "clogged"
|
||||
if row.ConfigType == "Y" {
|
||||
typeValue = "是"
|
||||
typeValue = "be"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.ConfigID,
|
||||
@@ -228,20 +232,22 @@ func (s *SysConfigController) ConfigValue(c *gin.Context) {
|
||||
Value string `json:"value" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
info := s.sysConfigService.SelectConfigByKey(body.Key)
|
||||
if info.ConfigKey != body.Key {
|
||||
c.JSON(200, result.ErrMsg("无效 key"))
|
||||
// 无效 key
|
||||
c.JSON(200, result.ErrMsg("Invalid key"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if info.ConfigValue == body.Value {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
info.ConfigValue = body.Value
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *SysDeptController) List(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindQuery(&querys)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (s *SysDeptController) List(c *gin.Context) {
|
||||
func (s *SysDeptController) Info(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDeptService.SelectDeptById(deptId)
|
||||
@@ -82,7 +82,7 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DeptID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,16 +90,19 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
if body.ParentID != "0" {
|
||||
deptParent := s.sysDeptService.SelectDeptById(body.ParentID)
|
||||
if deptParent.DeptID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
if deptParent.Status == common.STATUS_NO {
|
||||
msg := fmt.Sprintf("上级部门【%s】停用,不允许新增", deptParent.DeptName)
|
||||
// 上级部门【%s】停用,不允许新增
|
||||
msg := fmt.Sprintf("Upper division [%s] deactivated, no new additions allowed", deptParent.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
if deptParent.DelFlag == common.STATUS_YES {
|
||||
msg := fmt.Sprintf("上级部门【%s】已删除,不允许新增", deptParent.DeptName)
|
||||
// 上级部门【%s】已删除,不允许新增
|
||||
msg := fmt.Sprintf("The parent department [%s] has been deleted and is not allowed to be added", deptParent.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -111,7 +114,8 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
// 检查同级下名称唯一
|
||||
uniqueDeptName := s.sysDeptService.CheckUniqueDeptName(body.DeptName, body.ParentID, "")
|
||||
if !uniqueDeptName {
|
||||
msg := fmt.Sprintf("部门新增【%s】失败,部门名称已存在", body.DeptName)
|
||||
// 部门新增【%s】失败,部门名称已存在
|
||||
msg := fmt.Sprintf("Department add [%s] failed, department name already exists", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -132,13 +136,14 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DeptID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 上级部门不能选自己
|
||||
if body.DeptID == body.ParentID {
|
||||
msg := fmt.Sprintf("部门修改【%s】失败,上级部门不能是自己", body.DeptName)
|
||||
// 部门修改【%s】失败,上级部门不能是自己
|
||||
msg := fmt.Sprintf("Departmental modification [%s] failed, the parent department cannot be itself", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -146,14 +151,16 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
// 检查数据是否存在
|
||||
deptInfo := s.sysDeptService.SelectDeptById(body.DeptID)
|
||||
if deptInfo.DeptID != body.DeptID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
// 父级ID不为0是要检查
|
||||
if body.ParentID != "0" {
|
||||
deptParent := s.sysDeptService.SelectDeptById(body.ParentID)
|
||||
if deptParent.DeptID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -161,7 +168,8 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
// 检查同级下名称唯一
|
||||
uniqueDeptName := s.sysDeptService.CheckUniqueDeptName(body.DeptName, body.ParentID, body.DeptID)
|
||||
if !uniqueDeptName {
|
||||
msg := fmt.Sprintf("部门修改【%s】失败,部门名称已存在", body.DeptName)
|
||||
// 部门修改【%s】失败,部门名称已存在
|
||||
msg := fmt.Sprintf("Department modification [%s] failed, department name already exists", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -170,7 +178,8 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
if body.Status == common.STATUS_NO {
|
||||
hasChild := s.sysDeptService.HasChildByDeptId(body.DeptID)
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("该部门包含未停用的子部门数量:%d", hasChild)
|
||||
// 该部门包含未停用的子部门数量:%d
|
||||
msg := fmt.Sprintf("Number of subsectors not deactivated included in this sector: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -191,21 +200,23 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
dept := s.sysDeptService.SelectDeptById(deptId)
|
||||
if dept.DeptID != deptId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在子部门
|
||||
hasChild := s.sysDeptService.HasChildByDeptId(deptId)
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,存在子部门数:%d", hasChild)
|
||||
// 不允许删除,存在子部门数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of subsectors present: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -213,14 +224,16 @@ func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
// 检查是否分配给用户
|
||||
existUser := s.sysDeptService.CheckDeptExistUser(deptId)
|
||||
if existUser > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,部门已分配给用户数:%d", existUser)
|
||||
// 不允许删除,部门已分配给用户数:%d
|
||||
msg := fmt.Sprintf("Deletions are not allowed and the department has been assigned to the number of users: %d", existUser)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
rows := s.sysDeptService.DeleteDeptById(deptId)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -233,7 +246,7 @@ func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
func (s *SysDeptController) ExcludeChild(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -274,7 +287,7 @@ func (s *SysDeptController) TreeSelect(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindQuery(&querys)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -295,7 +308,7 @@ func (s *SysDeptController) TreeSelect(c *gin.Context) {
|
||||
func (s *SysDeptController) RoleDeptTreeSelect(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s *SysDictDataController) List(c *gin.Context) {
|
||||
func (s *SysDictDataController) Info(c *gin.Context) {
|
||||
dictCode := c.Param("dictCode")
|
||||
if dictCode == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictDataService.SelectDictDataByCode(dictCode)
|
||||
@@ -66,21 +66,23 @@ func (s *SysDictDataController) Add(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictCode != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, "")
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
// 数据新增【%s】失败,该字典类型下标签名已存在
|
||||
msg := fmt.Sprintf("Data addition [%s] failed, tag name already exists under this dictionary type", body.DictLabel)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -88,7 +90,8 @@ func (s *SysDictDataController) Add(c *gin.Context) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, "")
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
// 数据新增【%s】失败,该字典类型下标签值已存在
|
||||
msg := fmt.Sprintf("Data addition [%s] failed, tagged value already exists under this dictionary type", body.DictValue)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -109,28 +112,31 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictCode == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典编码是否存在
|
||||
SysDictDataController := s.sysDictDataService.SelectDictDataByCode(body.DictCode)
|
||||
if SysDictDataController.DictCode != body.DictCode {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典编码数据!"))
|
||||
// 没有可访问字典编码数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary-encoded data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, body.DictCode)
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
// 数据修改【%s】失败,该字典类型下标签名已存在
|
||||
msg := fmt.Sprintf("Data modification [%s] failed, tag name already exists under this dictionary type", body.DictLabel)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -138,7 +144,8 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, body.DictCode)
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
// 数据修改【%s】失败,该字典类型下标签值已存在
|
||||
msg := fmt.Sprintf("Data modification [%s] failed, tagged value already exists under this dictionary type", body.DictValue)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -158,7 +165,7 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
dictCodes := c.Param("dictCodes")
|
||||
if dictCodes == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -173,7 +180,8 @@ func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -183,7 +191,7 @@ func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
func (s *SysDictDataController) DictType(c *gin.Context) {
|
||||
dictType := c.Param("dictType")
|
||||
if dictType == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -199,7 +207,8 @@ func (s *SysDictDataController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysDictDataService.SelectDictDataPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysDictData)
|
||||
@@ -208,20 +217,20 @@ func (s *SysDictDataController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("dict_data_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "字典编码",
|
||||
"B1": "字典排序",
|
||||
"C1": "字典标签",
|
||||
"D1": "字典键值",
|
||||
"E1": "字典类型",
|
||||
"F1": "状态",
|
||||
"A1": "DictCode",
|
||||
"B1": "DictSort",
|
||||
"C1": "DictLabel",
|
||||
"D1": "DictValue",
|
||||
"E1": "DictType",
|
||||
"F1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.DictCode,
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *SysDictTypeController) List(c *gin.Context) {
|
||||
func (s *SysDictTypeController) Info(c *gin.Context) {
|
||||
dictId := c.Param("dictId")
|
||||
if dictId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictTypeService.SelectDictTypeByID(dictId)
|
||||
@@ -64,14 +64,15 @@ func (s *SysDictTypeController) Add(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典名称唯一
|
||||
uniqueDictName := s.sysDictTypeService.CheckUniqueDictName(body.DictName, "")
|
||||
if !uniqueDictName {
|
||||
msg := fmt.Sprintf("字典新增【%s】失败,字典名称已存在", body.DictName)
|
||||
// 字典新增【%s】失败,字典名称已存在
|
||||
msg := fmt.Sprintf("Dictionary add [%s] failed, dictionary name already exists", body.DictName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -79,7 +80,8 @@ func (s *SysDictTypeController) Add(c *gin.Context) {
|
||||
// 检查字典类型唯一
|
||||
uniqueDictType := s.sysDictTypeService.CheckUniqueDictType(body.DictType, "")
|
||||
if !uniqueDictType {
|
||||
msg := fmt.Sprintf("字典新增【%s】失败,字典类型已存在", body.DictType)
|
||||
// 字典新增【%s】失败,字典类型已存在
|
||||
msg := fmt.Sprintf("Dictionary add [%s] failed, dictionary type already exists", body.DictType)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -100,21 +102,23 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
dictInfo := s.sysDictTypeService.SelectDictTypeByID(body.DictID)
|
||||
if dictInfo.DictID != body.DictID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典名称唯一
|
||||
uniqueDictName := s.sysDictTypeService.CheckUniqueDictName(body.DictName, body.DictID)
|
||||
if !uniqueDictName {
|
||||
msg := fmt.Sprintf("字典修改【%s】失败,字典名称已存在", body.DictName)
|
||||
// 字典修改【%s】失败,字典名称已存在
|
||||
msg := fmt.Sprintf("Dictionary modification [%s] failed, dictionary name already exists", body.DictName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -122,7 +126,8 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
// 检查字典类型唯一
|
||||
uniqueDictType := s.sysDictTypeService.CheckUniqueDictType(body.DictType, body.DictID)
|
||||
if !uniqueDictType {
|
||||
msg := fmt.Sprintf("字典修改【%s】失败,字典类型已存在", body.DictType)
|
||||
// 字典修改【%s】失败,字典类型已存在
|
||||
msg := fmt.Sprintf("Dictionary modification [%s] failed, dictionary type already exists", body.DictType)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -142,7 +147,7 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
func (s *SysDictTypeController) Remove(c *gin.Context) {
|
||||
dictIds := c.Param("dictIds")
|
||||
if dictIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -157,7 +162,7 @@ func (s *SysDictTypeController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -201,7 +206,8 @@ func (s *SysDictTypeController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysDictTypeService.SelectDictTypePage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysDictType)
|
||||
@@ -210,18 +216,18 @@ func (s *SysDictTypeController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("dict_type_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "字典主键",
|
||||
"B1": "字典名称",
|
||||
"C1": "字典类型",
|
||||
"D1": "状态",
|
||||
"A1": "DictID",
|
||||
"B1": "DictName",
|
||||
"C1": "DictType",
|
||||
"D1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.DictID,
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *SysLogLoginController) List(c *gin.Context) {
|
||||
func (s *SysLogLoginController) Remove(c *gin.Context) {
|
||||
infoIds := c.Param("infoIds")
|
||||
if infoIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func (s *SysLogLoginController) Remove(c *gin.Context) {
|
||||
}
|
||||
rows := s.sysLogLoginService.DeleteSysLogLoginByIds(uniqueIDs)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (s *SysLogLoginController) Clean(c *gin.Context) {
|
||||
func (s *SysLogLoginController) Unlock(c *gin.Context) {
|
||||
userName := c.Param("userName")
|
||||
if userName == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
ok := s.accountService.ClearLoginRecordCache(userName)
|
||||
@@ -106,7 +106,8 @@ func (s *SysLogLoginController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysLogLoginService.SelectSysLogLoginPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysLogLogin)
|
||||
@@ -115,24 +116,24 @@ func (s *SysLogLoginController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("sys_log_login_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "序号",
|
||||
"B1": "用户账号",
|
||||
"C1": "登录状态",
|
||||
"D1": "登录地址",
|
||||
"E1": "登录地点",
|
||||
"F1": "浏览器",
|
||||
"G1": "操作系统",
|
||||
"H1": "提示消息",
|
||||
"I1": "访问时间",
|
||||
"A1": "ID",
|
||||
"B1": "UserName",
|
||||
"C1": "Status",
|
||||
"D1": "IP",
|
||||
"E1": "Location",
|
||||
"F1": "Browser",
|
||||
"G1": "OS",
|
||||
"H1": "Msg",
|
||||
"I1": "Time",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 状态
|
||||
statusValue := "失败"
|
||||
statusValue := "fail"
|
||||
if row.Status == "1" {
|
||||
statusValue = "成功"
|
||||
statusValue = "successes"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.LoginID,
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *SysLogOperateController) List(c *gin.Context) {
|
||||
func (s *SysLogOperateController) Remove(c *gin.Context) {
|
||||
operIds := c.Param("operIds")
|
||||
if operIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s *SysLogOperateController) Remove(c *gin.Context) {
|
||||
}
|
||||
rows := s.SysLogOperateService.DeleteSysLogOperateByIds(uniqueIDs)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -85,7 +85,8 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.SysLogOperateService.SelectSysLogOperatePage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysLogOperate)
|
||||
@@ -94,22 +95,22 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("sys_log_operate_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "操作序号",
|
||||
"B1": "操作模块",
|
||||
"C1": "业务类型",
|
||||
"D1": "请求方法",
|
||||
"E1": "请求方式",
|
||||
"F1": "操作类别",
|
||||
"G1": "操作人员",
|
||||
"H1": "部门名称",
|
||||
"I1": "请求地址",
|
||||
"J1": "操作地址",
|
||||
"K1": "操作地点",
|
||||
"L1": "请求参数",
|
||||
"M1": "操作消息",
|
||||
"N1": "状态",
|
||||
"O1": "消耗时间(毫秒)",
|
||||
"P1": "操作时间",
|
||||
"A1": "ID",
|
||||
"B1": "Title",
|
||||
"C1": "BusinessType",
|
||||
"D1": "Method",
|
||||
"E1": "RequestMethod",
|
||||
"F1": "OperatorType",
|
||||
"G1": "OperName",
|
||||
"H1": "DeptName",
|
||||
"I1": "URL",
|
||||
"J1": "IP",
|
||||
"K1": "Location",
|
||||
"L1": "Param",
|
||||
"M1": "Msg",
|
||||
"N1": "Status",
|
||||
"O1": "CostTime (ms)",
|
||||
"P1": "OperTime",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
@@ -118,11 +119,11 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
// 业务类型
|
||||
businessType := ""
|
||||
// 操作类别
|
||||
OperatorType := ""
|
||||
operatorType := ""
|
||||
// 状态
|
||||
statusValue := "失败"
|
||||
statusValue := "fail"
|
||||
if row.Status == "1" {
|
||||
statusValue = "成功"
|
||||
statusValue = "success"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.OperID,
|
||||
@@ -130,7 +131,7 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
"C" + idx: businessType,
|
||||
"D" + idx: row.Method,
|
||||
"E" + idx: row.RequestMethod,
|
||||
"F" + idx: OperatorType,
|
||||
"F" + idx: operatorType,
|
||||
"G" + idx: row.OperName,
|
||||
"H" + idx: row.DeptName,
|
||||
"I" + idx: row.OperURL,
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *SysMenuController) List(c *gin.Context) {
|
||||
func (s *SysMenuController) Info(c *gin.Context) {
|
||||
menuId := c.Param("menuId")
|
||||
if menuId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysMenuService.SelectMenuById(menuId)
|
||||
@@ -73,7 +73,7 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.MenuID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
if menu.TYPE_DIR == body.MenuType || menu.TYPE_MENU == body.MenuType {
|
||||
uniqueNenuPath := s.sysMenuService.CheckUniqueMenuPath(body.Path, body.ParentID, "")
|
||||
if !uniqueNenuPath {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,菜单路由地址已存在", body.MenuName)
|
||||
// 菜单新增【%s】失败,菜单路由地址已存在
|
||||
msg := fmt.Sprintf("Menu add [%s] failed, menu routing address already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -90,14 +91,16 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
// 检查名称唯一
|
||||
uniqueNenuName := s.sysMenuService.CheckUniqueMenuName(body.MenuName, body.ParentID, "")
|
||||
if !uniqueNenuName {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,菜单名称已存在", body.MenuName)
|
||||
// 菜单新增【%s】失败,菜单名称已存在
|
||||
msg := fmt.Sprintf("Menu add [%s] failed, menu name already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
// 外链菜单需要符合网站http(s)开头
|
||||
if body.IsFrame == common.STATUS_NO && !regular.ValidHttp(body.Path) {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,非内部地址必须以http(s)://开头", body.MenuName)
|
||||
// 菜单新增【%s】失败,非内部地址必须以http(s)://开头
|
||||
msg := fmt.Sprintf("Menu adds [%s] failure, non-internal addresses must start with http(s)://", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -118,13 +121,14 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.MenuID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 上级菜单不能选自己
|
||||
if body.MenuID == body.ParentID {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,上级菜单不能选择自己", body.MenuName)
|
||||
// 菜单修改【%s】失败,上级菜单不能选择自己
|
||||
msg := fmt.Sprintf("Menu modification [%s] fails, the parent menu cannot select itself", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -132,19 +136,21 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
// 检查数据是否存在
|
||||
menuInfo := s.sysMenuService.SelectMenuById(body.MenuID)
|
||||
if menuInfo.MenuID != body.MenuID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据"))
|
||||
// 没有可访问菜单数据
|
||||
c.JSON(200, result.ErrMsg("No accessible menu data"))
|
||||
return
|
||||
}
|
||||
// 父级ID不为0是要检查
|
||||
if body.ParentID != "0" {
|
||||
menuParent := s.sysMenuService.SelectMenuById(body.ParentID)
|
||||
if menuParent.MenuID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据"))
|
||||
c.JSON(200, result.ErrMsg("No accessible menu data"))
|
||||
return
|
||||
}
|
||||
// 禁用菜单时检查父菜单是否使用
|
||||
if body.Status == common.STATUS_YES && menuParent.Status == common.STATUS_NO {
|
||||
c.JSON(200, result.ErrMsg("上级菜单未启用!"))
|
||||
// 上级菜单未启用!
|
||||
c.JSON(200, result.ErrMsg("The parent menu is not enabled!"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -153,7 +159,8 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
if menu.TYPE_DIR == body.MenuType || menu.TYPE_MENU == body.MenuType {
|
||||
uniqueNenuPath := s.sysMenuService.CheckUniqueMenuPath(body.Path, body.ParentID, body.MenuID)
|
||||
if !uniqueNenuPath {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,菜单路由地址已存在", body.MenuName)
|
||||
// 菜单修改【%s】失败,菜单路由地址已存在
|
||||
msg := fmt.Sprintf("Menu modification [%s] failed, menu routing address already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -162,14 +169,16 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
// 检查名称唯一
|
||||
uniqueNenuName := s.sysMenuService.CheckUniqueMenuName(body.MenuName, body.ParentID, body.MenuID)
|
||||
if !uniqueNenuName {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,菜单名称已存在", body.MenuName)
|
||||
// 菜单修改【%s】失败,菜单名称已存在
|
||||
msg := fmt.Sprintf("Menu modification [%s] failed, menu name already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
// 外链菜单需要符合网站http(s)开头
|
||||
if body.IsFrame == common.STATUS_NO && !regular.ValidHttp(body.Path) {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,非内部地址必须以http(s)://开头", body.MenuName)
|
||||
// 菜单修改【%s】失败,非内部地址必须以http(s)://开头
|
||||
msg := fmt.Sprintf("Menu change [%s] failed, non-internal address must start with http(s)://", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -178,7 +187,8 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
if body.Status == common.STATUS_NO {
|
||||
hasStatus := s.sysMenuService.HasChildByMenuIdAndStatus(body.MenuID, common.STATUS_YES)
|
||||
if hasStatus > 0 {
|
||||
msg := fmt.Sprintf("不允许禁用,存在使用子菜单数:%d", hasStatus)
|
||||
// 不允许禁用,存在使用子菜单数:%d
|
||||
msg := fmt.Sprintf("Disabling is not allowed, number of submenus present for use: %d", hasStatus)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -199,21 +209,23 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
func (s *SysMenuController) Remove(c *gin.Context) {
|
||||
menuId := c.Param("menuId")
|
||||
if menuId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
menu := s.sysMenuService.SelectMenuById(menuId)
|
||||
if menu.MenuID != menuId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据!"))
|
||||
// 没有可访问菜单数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible menu data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在子菜单
|
||||
hasChild := s.sysMenuService.HasChildByMenuIdAndStatus(menuId, "")
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,存在子菜单数:%d", hasChild)
|
||||
// 不允许删除,存在子菜单数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of submenus present: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -221,14 +233,15 @@ func (s *SysMenuController) Remove(c *gin.Context) {
|
||||
// 检查是否分配给角色
|
||||
existRole := s.sysMenuService.CheckMenuExistRole(menuId)
|
||||
if existRole > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,菜单已分配给角色数:%d", existRole)
|
||||
// 不允许删除,菜单已分配给角色数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of roles assigned to the menu: %d", existRole)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
rows := s.sysMenuService.DeleteMenuById(menuId)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -262,7 +275,7 @@ func (s *SysMenuController) TreeSelect(c *gin.Context) {
|
||||
func (s *SysMenuController) RoleMenuTreeSelect(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func (s *SysNoticeController) List(c *gin.Context) {
|
||||
func (s *SysNoticeController) Info(c *gin.Context) {
|
||||
noticeId := c.Param("noticeId")
|
||||
if noticeId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysNoticeService.SelectNoticeById(noticeId)
|
||||
@@ -60,7 +60,7 @@ func (s *SysNoticeController) Add(c *gin.Context) {
|
||||
var body model.SysNotice
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.NoticeID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,14 +80,15 @@ func (s *SysNoticeController) Edit(c *gin.Context) {
|
||||
var body model.SysNotice
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.NoticeID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
notice := s.sysNoticeService.SelectNoticeById(body.NoticeID)
|
||||
if notice.NoticeID != body.NoticeID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问公告信息数据!"))
|
||||
// 没有可访问公告信息数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible bulletin information data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ func (s *SysNoticeController) Edit(c *gin.Context) {
|
||||
func (s *SysNoticeController) Remove(c *gin.Context) {
|
||||
noticeIds := c.Param("noticeIds")
|
||||
if noticeIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -121,6 +122,6 @@ func (s *SysNoticeController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *SysPostController) List(c *gin.Context) {
|
||||
func (s *SysPostController) Info(c *gin.Context) {
|
||||
postId := c.Param("postId")
|
||||
if postId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysPostService.SelectPostById(postId)
|
||||
@@ -63,14 +63,15 @@ func (s *SysPostController) Add(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.PostID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查名称唯一
|
||||
uniqueuPostName := s.sysPostService.CheckUniquePostName(body.PostName, "")
|
||||
if !uniqueuPostName {
|
||||
msg := fmt.Sprintf("岗位新增【%s】失败,岗位名称已存在", body.PostName)
|
||||
// 岗位新增【%s】失败,岗位名称已存在
|
||||
msg := fmt.Sprintf("Job addition [%s] failed, job name already exists", body.PostName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -78,7 +79,8 @@ func (s *SysPostController) Add(c *gin.Context) {
|
||||
// 检查编码属性值唯一
|
||||
uniquePostCode := s.sysPostService.CheckUniquePostCode(body.PostCode, "")
|
||||
if !uniquePostCode {
|
||||
msg := fmt.Sprintf("岗位新增【%s】失败,岗位编码已存在", body.PostCode)
|
||||
// 岗位新增【%s】失败,岗位编码已存在
|
||||
msg := fmt.Sprintf("Job addition [%s] failed, job code already exists", body.PostCode)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -99,21 +101,23 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.PostID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
post := s.sysPostService.SelectPostById(body.PostID)
|
||||
if post.PostID != body.PostID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问岗位数据!"))
|
||||
// 没有可访问岗位数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible post data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查名称唯一
|
||||
uniqueuPostName := s.sysPostService.CheckUniquePostName(body.PostName, body.PostID)
|
||||
if !uniqueuPostName {
|
||||
msg := fmt.Sprintf("岗位修改【%s】失败,岗位名称已存在", body.PostName)
|
||||
// 岗位修改【%s】失败,岗位名称已存在
|
||||
msg := fmt.Sprintf("Post modification [%s] failed, post name already exists", body.PostName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -121,7 +125,8 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
// 检查编码属性值唯一
|
||||
uniquePostCode := s.sysPostService.CheckUniquePostCode(body.PostCode, body.PostID)
|
||||
if !uniquePostCode {
|
||||
msg := fmt.Sprintf("岗位修改【%s】失败,岗位编码已存在", body.PostCode)
|
||||
// 岗位修改【%s】失败,岗位编码已存在
|
||||
msg := fmt.Sprintf("Post modification [%s] failed, post code already exists", body.PostCode)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -141,7 +146,7 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
func (s *SysPostController) Remove(c *gin.Context) {
|
||||
postIds := c.Param("postIds")
|
||||
if postIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -156,7 +161,7 @@ func (s *SysPostController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -168,7 +173,8 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysPostService.SelectPostPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysPost)
|
||||
@@ -177,19 +183,19 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("post_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "岗位编号",
|
||||
"B1": "岗位编码",
|
||||
"C1": "岗位名称",
|
||||
"D1": "岗位排序",
|
||||
"E1": "状态",
|
||||
"A1": "PostID",
|
||||
"B1": "PostCode",
|
||||
"C1": "PostName",
|
||||
"D1": "PostSort",
|
||||
"E1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.PostID,
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s *SysProfileController) Info(c *gin.Context) {
|
||||
}
|
||||
isAdmin := config.IsAdmin(loginUser.UserID)
|
||||
if isAdmin {
|
||||
roleGroup = append(roleGroup, "管理员")
|
||||
roleGroup = append(roleGroup, "Administrator")
|
||||
}
|
||||
|
||||
// 查询用户所属岗位组
|
||||
@@ -93,7 +93,7 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.Sex == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -111,12 +111,14 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, userId)
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码已存在", userName)
|
||||
// 修改用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], cell phone number already exists", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码格式错误", userName)
|
||||
// 修改用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], wrong format of cell phone number", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -127,12 +129,14 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, userId)
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱已存在", userName)
|
||||
// 修改用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox already exists", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱格式错误", userName)
|
||||
// 修改用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox format error", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -165,7 +169,8 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
c.JSON(200, result.Ok(nil))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.ErrMsg("上传图片异常"))
|
||||
// 上传图片异常
|
||||
c.JSON(200, result.ErrMsg("Upload Image Exception"))
|
||||
}
|
||||
|
||||
// 个人重置密码
|
||||
@@ -180,7 +185,7 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -196,19 +201,22 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
// 查询当前登录用户信息得到密码值
|
||||
user := s.sysUserService.SelectUserById(userId)
|
||||
if user.UserID != userId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查匹配用户密码
|
||||
oldCompare := crypto.BcryptCompare(body.OldPassword, user.Password)
|
||||
if !oldCompare {
|
||||
c.JSON(200, result.ErrMsg("修改密码失败,旧密码错误"))
|
||||
// 修改密码失败,旧密码错误
|
||||
c.JSON(200, result.ErrMsg("Failed to change password, old password is wrong"))
|
||||
return
|
||||
}
|
||||
newCompare := crypto.BcryptCompare(body.NewPassword, user.Password)
|
||||
if newCompare {
|
||||
c.JSON(200, result.ErrMsg("新密码不能与旧密码相同"))
|
||||
// 新密码不能与旧密码相同
|
||||
c.JSON(200, result.ErrMsg("The new password cannot be the same as the old one"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -232,7 +240,7 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
func (s *SysProfileController) Avatar(c *gin.Context) {
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ func (s *SysRoleController) List(c *gin.Context) {
|
||||
func (s *SysRoleController) Info(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysRoleService.SelectRoleById(roleId)
|
||||
@@ -69,14 +69,15 @@ func (s *SysRoleController) Add(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.RoleID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 判断角色名称是否唯一
|
||||
uniqueRoleName := s.sysRoleService.CheckUniqueRoleName(body.RoleName, "")
|
||||
if !uniqueRoleName {
|
||||
msg := fmt.Sprintf("角色新增【%s】失败,角色名称已存在", body.RoleName)
|
||||
// 角色新增【%s】失败,角色名称已存在
|
||||
msg := fmt.Sprintf("Character addition [%s] failed, character name already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -84,7 +85,8 @@ func (s *SysRoleController) Add(c *gin.Context) {
|
||||
// 判断角色键值是否唯一
|
||||
uniqueRoleKey := s.sysRoleService.CheckUniqueRoleKey(body.RoleKey, "")
|
||||
if !uniqueRoleKey {
|
||||
msg := fmt.Sprintf("角色新增【%s】失败,角色键值已存在", body.RoleName)
|
||||
// 角色新增【%s】失败,角色键值已存在
|
||||
msg := fmt.Sprintf("Character addition [%s] failed, character key already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -105,27 +107,30 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.RoleID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 判断角色名称是否唯一
|
||||
uniqueRoleName := s.sysRoleService.CheckUniqueRoleName(body.RoleName, body.RoleID)
|
||||
if !uniqueRoleName {
|
||||
msg := fmt.Sprintf("角色修改【%s】失败,角色名称已存在", body.RoleName)
|
||||
// 角色修改【%s】失败,角色名称已存在
|
||||
msg := fmt.Sprintf("Character modification [%s] failed, character name already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -133,7 +138,8 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
// 判断角色键值是否唯一
|
||||
uniqueRoleKey := s.sysRoleService.CheckUniqueRoleKey(body.RoleKey, body.RoleID)
|
||||
if !uniqueRoleKey {
|
||||
msg := fmt.Sprintf("角色修改【%s】失败,角色键值已存在", body.RoleName)
|
||||
// 角色修改【%s】失败,角色键值已存在
|
||||
msg := fmt.Sprintf("Character modification [%s] failed, character key already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -153,7 +159,7 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
roleIds := c.Param("roleIds")
|
||||
if roleIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -166,7 +172,8 @@ func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
// 检查是否管理员角色
|
||||
for _, id := range uniqueIDs {
|
||||
if id == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -175,7 +182,7 @@ func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -191,26 +198,29 @@ func (s *SysRoleController) Status(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if role.Status == body.Status {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -245,20 +255,22 @@ func (s *SysRoleController) DataScope(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -286,14 +298,15 @@ func (s *SysRoleController) AuthUserAllocatedList(c *gin.Context) {
|
||||
querys := ctx.QueryMap(c)
|
||||
roleId, ok := querys["roleId"]
|
||||
if !ok || roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(roleId.(string))
|
||||
if role.RoleID != roleId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -316,7 +329,7 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -331,7 +344,7 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) {
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -357,7 +370,8 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "")
|
||||
data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysRole)
|
||||
@@ -366,26 +380,26 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("role_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "角色序号",
|
||||
"B1": "角色名称",
|
||||
"C1": "角色权限",
|
||||
"D1": "角色排序",
|
||||
"E1": "数据范围",
|
||||
"F1": "角色状态",
|
||||
"A1": "RoleID",
|
||||
"B1": "RoleName",
|
||||
"C1": "RoleKey",
|
||||
"D1": "RoleSort",
|
||||
"E1": "DataScope",
|
||||
"F1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 数据范围
|
||||
dataScope := "空"
|
||||
dataScope := "Empty"
|
||||
if v, ok := roledatascope.RoleDataScope[row.DataScope]; ok {
|
||||
dataScope = v
|
||||
}
|
||||
// 角色状态
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.RoleID,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (s *SysUserController) List(c *gin.Context) {
|
||||
func (s *SysUserController) Info(c *gin.Context) {
|
||||
userId := c.Param("userId")
|
||||
if userId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 查询系统角色列表
|
||||
@@ -95,7 +95,7 @@ func (s *SysUserController) Info(c *gin.Context) {
|
||||
// 检查用户是否存在
|
||||
user := s.sysUserService.SelectUserById(userId)
|
||||
if user.UserID != userId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.UserID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&bodyPassword, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
body.Password = bodyPassword.Password
|
||||
@@ -145,7 +145,8 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
// 检查用户登录账号是否唯一
|
||||
uniqueUserName := s.sysUserService.CheckUniqueUserName(body.UserName, "")
|
||||
if !uniqueUserName {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,登录账号已存在", body.UserName)
|
||||
// 新增用户【%s】失败,登录账号已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], login account already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -155,12 +156,14 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, "")
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,手机号码已存在", body.UserName)
|
||||
// 新增用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], cell phone number already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,手机号码格式错误", body.UserName)
|
||||
// 新增用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to add user [%s], wrong format of cell phone number", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -171,12 +174,14 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, "")
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,邮箱已存在", body.UserName)
|
||||
// 新增用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], mailbox already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,邮箱格式错误", body.UserName)
|
||||
// 新增用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to add user [%s], mailbox format error", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -198,26 +203,29 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.UserID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员用户
|
||||
if config.IsAdmin(body.UserID) {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员用户"))
|
||||
// 不允许操作管理员用户
|
||||
c.JSON(200, result.ErrMsg("Administrator users are not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查用户登录账号是否唯一
|
||||
uniqueUserName := s.sysUserService.CheckUniqueUserName(body.UserName, body.UserID)
|
||||
if !uniqueUserName {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,登录账号已存在", body.UserName)
|
||||
// 修改用户【%s】失败,登录账号已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], login account already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -227,12 +235,14 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, body.UserID)
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码已存在", body.UserName)
|
||||
// 修改用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], cell phone number already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码格式错误", body.UserName)
|
||||
// 修改用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], wrong format of cell phone number", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -243,12 +253,14 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, body.UserID)
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱已存在", body.UserName)
|
||||
// 修改用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱格式错误", body.UserName)
|
||||
// 修改用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox format error", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -273,7 +285,7 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
func (s *SysUserController) Remove(c *gin.Context) {
|
||||
userIds := c.Param("userIds")
|
||||
if userIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -288,7 +300,8 @@ func (s *SysUserController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -301,23 +314,26 @@ func (s *SysUserController) ResetPwd(c *gin.Context) {
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员用户
|
||||
if config.IsAdmin(body.UserID) {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员用户"))
|
||||
// 不允许操作管理员用户
|
||||
c.JSON(200, result.ErrMsg("Administrator users are not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
if !regular.ValidPassword(body.Password) {
|
||||
c.JSON(200, result.ErrMsg("登录密码至少包含大小写字母、数字、特殊符号,且不少于6位"))
|
||||
// 登录密码至少包含大小写字母、数字、特殊符号,且不少于6位
|
||||
c.JSON(200, result.ErrMsg("Login password contains at least upper and lower case letters, numbers, special symbols, and not less than 6 digits"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -344,20 +360,22 @@ func (s *SysUserController) Status(c *gin.Context) {
|
||||
Status string `json:"status" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if user.Status == body.Status {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -384,7 +402,8 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
|
||||
data := s.sysUserService.SelectUserPage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysUser)
|
||||
@@ -393,18 +412,18 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("user_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "用户编号",
|
||||
"B1": "登录名称",
|
||||
"C1": "用户名称",
|
||||
"D1": "用户邮箱",
|
||||
"E1": "手机号码",
|
||||
"F1": "用户性别",
|
||||
"G1": "帐号状态",
|
||||
"H1": "部门编号",
|
||||
"I1": "部门名称",
|
||||
"J1": "部门负责人",
|
||||
"K1": "最后登录IP",
|
||||
"L1": "最后登录时间",
|
||||
"A1": "UserID",
|
||||
"B1": "UserName",
|
||||
"C1": "NickName",
|
||||
"D1": "Email",
|
||||
"E1": "PhoneNumber",
|
||||
"F1": "UserSex",
|
||||
"G1": "Status",
|
||||
"H1": "DeptID",
|
||||
"I1": "DeptName",
|
||||
"J1": "DeptLeader",
|
||||
"K1": "LoginIP",
|
||||
"L1": "LoginDate",
|
||||
}
|
||||
// 读取用户性别字典数据
|
||||
dictSysUserSex := s.sysDictDataService.SelectDictDataByType("sys_user_sex")
|
||||
@@ -413,7 +432,7 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 用户性别
|
||||
sysUserSex := "未知"
|
||||
sysUserSex := "unknown"
|
||||
for _, v := range dictSysUserSex {
|
||||
if row.Sex == v.DictValue {
|
||||
sysUserSex = v.DictLabel
|
||||
@@ -421,9 +440,9 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
// 帐号状态
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.UserID,
|
||||
@@ -485,7 +504,7 @@ func (s *SysUserController) ImportData(c *gin.Context) {
|
||||
// 上传的文件
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil || updateSupport == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user