update_menu_favorite.go
837 字节
package command
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"github.com/beego/beego/v2/core/validation"
)
type MenuFavoriteCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 1:添加菜单 2:移除菜单 3.全量更新
Action int `json:"action" valid:"Required"`
// 对应菜单的code
FavoriteMenus []string `json:"favoriteMenus,omitempty"`
}
func (menuFavoriteCommand *MenuFavoriteCommand) Valid(validation *validation.Validation) {
}
func (menuFavoriteCommand *MenuFavoriteCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(menuFavoriteCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}