作者 陈志颖

Merge branch 'dev-chenzhiying' into dev

... ... @@ -141,9 +141,10 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创合约异常")
}
// 获取承接人
// 承接人
var undertakers []*domain.Undertaker
for _, undertaker := range createCooperationContractCommand.Undertakers {
// 获取承接人
var undertakerDomain *domain.Undertaker
undertakerUid, err := strconv.ParseInt(undertaker.UserId, 10, 64)
if err != nil {
... ... @@ -156,6 +157,11 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
undertakerDomain = data
}
// 校验承接人是否属于承接对象
if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
}
// 获取推荐人
var referrerDomain *domain.Referrer
referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
... ...
... ... @@ -40,7 +40,7 @@ type UpdateDividendsOrderCommand struct {
func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {
if len(updateDividendsOrderCommand.OrderGoods) <= 0 {
validation.Error("激励规则不能为空")
validation.Error("订单产品不能为空")
} else {
for i, _ := range updateDividendsOrderCommand.OrderGoods {
if updateDividendsOrderCommand.OrderGoods[i].OrderGoodId == "" {
... ...
... ... @@ -37,7 +37,15 @@ type UpdateDividendsReturnedOrderCommand struct {
}
func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
if len(updateDividendsReturnedOrderCommand.OrderGoods) <= 0 {
validation.Error("退货单产品不能为空")
} else {
for i, _ := range updateDividendsReturnedOrderCommand.OrderGoods {
if updateDividendsReturnedOrderCommand.OrderGoods[i].OrderGoodId == "" {
updateDividendsReturnedOrderCommand.OrderGoods[i].OrderGoodId = "0"
}
}
}
}
func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) ValidateCommand() error {
... ...