acceptance_task.go 1.1 KB
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
}