fix:: 请求响应码用常量
This commit is contained in:
@@ -82,7 +82,7 @@ func (s *SysMenuController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
menuId := parse.Number(c.Param("menuId"))
|
||||
if menuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.MenuId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -158,11 +158,11 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.MenuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ func (s SysMenuController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
menuId := parse.Number(c.Param("menuId"))
|
||||
if menuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ func (s *SysMenuController) TreeRole(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := parse.Number(c.Param("roleId"))
|
||||
if roleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user