acceptance_task.go
1.1 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
package command
import (
"fmt"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
"github.com/astaxie/beego/validation"
)
type AcceptanceTaskCommand struct {
// 任务ID
TaskId int64 `json:"taskId" valid:"Required"`
// 操作人uid
Operator int64 `json:"operator" valid:"Required"`
// 任务参与者UID列表
Participators []int64 `json:"participators,omitempty"`
// 任务贡献占比
TaskPercentage []*domain.TaskPercentageItem `json:"taskPercentage"`
// 解决报告
SolveReport string `json:"solveReport,omitempty"`
// 解决图片URL列表
SolvePictureUrls []string `json:"solvePictureUrls,omitempty"`
}
//func (acceptanceTaskCommand *AcceptanceTaskCommand) Valid(validation *validation.Validation) {
// validation.SetError("CustomValid", "未实现的自定义认证")
//}
func (acceptanceTaskCommand *AcceptanceTaskCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(acceptanceTaskCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}