cooperation_user_add.go
1.2 KB
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
38
39
40
41
42
43
44
45
46
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CooperationUserAddCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersCode string `json:"userCode" valid:"Required"`
// 用户姓名
UsersName string `json:"userName" valid:"Required"`
// 共创公司
CooperationCompany string `json:"cooperationCompany" valid:"Required"`
// 共创公司到期时间
CooperationDeadline int64 `json:"cooperationDeadline" valid:"Required"`
// 启用状态(启用:1 禁用:2)
EnableStatus int `json:"enableStatus" valid:"Required"`
// 邮箱
Email string `json:"email" valid:"Required"`
//头像
Avatar string `json:"avatar"`
Phone string `json:"phone" valid:"Required"`
}
func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
}
func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserAddCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}