reset_column.go
867 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
}