user_menu.go
935 字节
package command
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"github.com/beego/beego/v2/core/validation"
)
type UserMenusCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 菜单类别 web app
MenuCategory string `cname:"菜单类别 web app" json:"menuCategory,omitempty"`
// 返回所有不可以用的菜单
ALLDisableMenu int `cname:"同时返回所有不可以用的菜单 1:包含不可用的菜单 0:过滤不可用的菜单 " json:"allDisableMenu"`
}
func (userMenusCommand *UserMenusCommand) Valid(validation *validation.Validation) {
}
func (userMenusCommand *UserMenusCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(userMenusCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}