acceptance_task.go
1.4 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
package command
import (
"fmt"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
"time"
"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"`
// 实际奖励素币值
SuMoney float64 `jsons:"suMoney"`
// 任务贡献占比
TaskPercentage []*domain.TaskPercentageItem `json:"taskPercentage"`
// 引用资源解决分
ReferenceResourceScore []*domain.ReferenceResourceItem `json:"referenceResourceScore,omitempty"`
// 解决报告
SolveReport string `json:"solveReport,omitempty"`
// 解决图片URL列表
SolvePictureUrls []string `json:"solvePictureUrls,omitempty"`
// 实际完成时间
ActualCompletionTime time.Time `json:"actualCompletionTime"`
}
//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
}