package command import ( "time" "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib" ) type UpdatePartnerInfoCommand struct { // 合伙人Id Id int64 `json:"id"` // 状态(1:启用或者0:禁用) Status int `json:"status"` // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) PartnerCategory []int64 `json:"partnerCategory,omitempty"` // 区域 RegionInfo *domain.RegionInfo `json:"regionInfo"` //关联业务员 Salesman []domain.Salesman `json:"salesman,omitempty"` //合作时间 CooperateTime time.Time `json:"cooperateTime"` //公司id CompanyId int64 `json:"companyId"` } func (command *UpdatePartnerInfoCommand) ValidateCommand() error { if !(command.Status == domain.PARTNER_STATUS_NO || command.Status == domain.PARTNER_STATUS_YES) { return lib.ThrowError(lib.ARG_ERROR, "合伙人状态错误") } if command.RegionInfo == nil { return lib.ThrowError(lib.ARG_ERROR, "区域必填") } if command.Id == 0 { return lib.ThrowError(lib.ARG_ERROR, "合伙人id错误") } // if len(command.Salesman) == 0 { // return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填") // } // for i := range command.Salesman { // if len(command.Salesman[i].Name) == 0 { // return lib.ThrowError(lib.ARG_ERROR, "关联业务员名称必填") // } // if len(command.Salesman[i].Telephone) == 0 { // return lib.ThrowError(lib.ARG_ERROR, "关联业务员电话必填") // } // } return nil }