This commit is contained in:
2026-08-16 09:02:39 +08:00
parent c554152f4f
commit f7f6db8695
105 changed files with 2535 additions and 948 deletions
+5 -5
View File
@@ -18,8 +18,8 @@ func NewPermission(service *service.PermissionService) *Permission {
func (h *Permission) Buttons(c *gin.Context) {
var req dto.GetAuthorityButtonsRequest
if c.ShouldBindJSON(&req) != nil {
httpx.Fail(c, "参数错误")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
selected, err := h.service.SelectedButtons(c.Request.Context(), req.AuthorityID, req.MenuID)
@@ -32,8 +32,8 @@ func (h *Permission) Buttons(c *gin.Context) {
func (h *Permission) SetButtons(c *gin.Context) {
var req dto.SetAuthorityButtonsRequest
if c.ShouldBindJSON(&req) != nil {
httpx.Fail(c, "参数错误")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
if err := h.service.SetSelectedButtons(c.Request.Context(), req.AuthorityID, req.MenuID, req.Selected); err != nil {
@@ -47,7 +47,7 @@ func (h *Permission) CanRemoveButton(c *gin.Context) {
id, _ := strconv.ParseUint(c.Query("id"), 10, 64)
allowed, err := h.service.CanRemoveButton(c.Request.Context(), uint(id))
if err != nil {
httpx.Fail(c, "检查失败")
httpx.Fail(c, err.Error())
return
}
if !allowed {