release_cooperation_project.go
1.9 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
50
51
52
53
54
55
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ReleaseCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName" valid:"Required"`
// 共创模式ID
CooperationModeId int64 `json:"cooperationModeId" valid:"Required"`
// 手机号码
Phone string `json:"phone" valid:"Required"`
// 共创模式状态,1启用,2禁用
Status int32 `json:"status" valid:"Required"`
// 用户编号
UsersCode string `json:"usersCode" valid:"Required"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
// 用户姓名
UsersName string `json:"usersName" valid:"Required"`
// 邮箱
Email string `json:"email" valid:"Required"`
// 共创公司
CooperationCompany string `json:"cooperationCompany" valid:"Required"`
// 共创公司到期时间
CooperationDeadline string `json:"cooperationDeadline" valid:"Required"`
// 共创项目承接对象,1员工,2共创用户,3公开,可以多选
CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType" valid:"Required"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
}
func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(releaseCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}