正在显示
3 个修改的文件
包含
17 行增加
和
3 行删除
@@ -141,9 +141,10 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -141,9 +141,10 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
141 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创合约异常") | 141 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创合约异常") |
142 | } | 142 | } |
143 | 143 | ||
144 | - // 获取承接人 | 144 | + // 承接人 |
145 | var undertakers []*domain.Undertaker | 145 | var undertakers []*domain.Undertaker |
146 | for _, undertaker := range createCooperationContractCommand.Undertakers { | 146 | for _, undertaker := range createCooperationContractCommand.Undertakers { |
147 | + // 获取承接人 | ||
147 | var undertakerDomain *domain.Undertaker | 148 | var undertakerDomain *domain.Undertaker |
148 | undertakerUid, err := strconv.ParseInt(undertaker.UserId, 10, 64) | 149 | undertakerUid, err := strconv.ParseInt(undertaker.UserId, 10, 64) |
149 | if err != nil { | 150 | if err != nil { |
@@ -156,6 +157,11 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -156,6 +157,11 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
156 | undertakerDomain = data | 157 | undertakerDomain = data |
157 | } | 158 | } |
158 | 159 | ||
160 | + // 校验承接人是否属于承接对象 | ||
161 | + if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType) { | ||
162 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") | ||
163 | + } | ||
164 | + | ||
159 | // 获取推荐人 | 165 | // 获取推荐人 |
160 | var referrerDomain *domain.Referrer | 166 | var referrerDomain *domain.Referrer |
161 | referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64) | 167 | referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64) |
@@ -40,7 +40,7 @@ type UpdateDividendsOrderCommand struct { | @@ -40,7 +40,7 @@ type UpdateDividendsOrderCommand struct { | ||
40 | 40 | ||
41 | func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) { | 41 | func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) { |
42 | if len(updateDividendsOrderCommand.OrderGoods) <= 0 { | 42 | if len(updateDividendsOrderCommand.OrderGoods) <= 0 { |
43 | - validation.Error("激励规则不能为空") | 43 | + validation.Error("订单产品不能为空") |
44 | } else { | 44 | } else { |
45 | for i, _ := range updateDividendsOrderCommand.OrderGoods { | 45 | for i, _ := range updateDividendsOrderCommand.OrderGoods { |
46 | if updateDividendsOrderCommand.OrderGoods[i].OrderGoodId == "" { | 46 | if updateDividendsOrderCommand.OrderGoods[i].OrderGoodId == "" { |
@@ -37,7 +37,15 @@ type UpdateDividendsReturnedOrderCommand struct { | @@ -37,7 +37,15 @@ type UpdateDividendsReturnedOrderCommand struct { | ||
37 | } | 37 | } |
38 | 38 | ||
39 | func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { | 39 | func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { |
40 | - //validation.SetError("CustomValid", "未实现的自定义认证") | 40 | + if len(updateDividendsReturnedOrderCommand.OrderGoods) <= 0 { |
41 | + validation.Error("退货单产品不能为空") | ||
42 | + } else { | ||
43 | + for i, _ := range updateDividendsReturnedOrderCommand.OrderGoods { | ||
44 | + if updateDividendsReturnedOrderCommand.OrderGoods[i].OrderGoodId == "" { | ||
45 | + updateDividendsReturnedOrderCommand.OrderGoods[i].OrderGoodId = "0" | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
41 | } | 49 | } |
42 | 50 | ||
43 | func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) ValidateCommand() error { | 51 | func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) ValidateCommand() error { |
-
请 注册 或 登录 后发表评论