cooperation_user_update.go
1.3 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
47
48
49
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CooperationUserUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
// 用户编号
UsersCode string `json:"usersCode" valid:"Required"`
// 用户姓名
UsersName string `json:"usersName" 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 (cooperationUserUpdateCommand *CooperationUserUpdateCommand) Valid(validation *validation.Validation) {
}
func (cooperationUserUpdateCommand *CooperationUserUpdateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserUpdateCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}