reset_column.go 867 字节
package command

import (
	"fmt"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"

	"github.com/astaxie/beego/validation"
)

type ResetColumnCommand struct {
	// 公司id
	CompanyId int `json:"companyId"`
	// 用户uid
	Uid int64 `json:"uid"`
	// 默认栏目
	Value []domain.Column `json:"value"`
	// 默认无效栏目
	InvalidValue []domain.Column `json:"invalidValue"`
}

//func (resetColumnCommand *ResetColumnCommand) Valid(validation *validation.Validation) {
//	_ = validation.SetError("CustomValid", "未实现的自定义认证")
//}

func (resetColumnCommand *ResetColumnCommand) ValidateCommand() error {
	valid := validation.Validation{}
	b, err := valid.Valid(resetColumnCommand)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}