|
@@ -393,7 +393,9 @@ func (serve *OrderBonusService) BatchPayPartnerBonus(orderIds []int64, adminId i |
|
@@ -393,7 +393,9 @@ func (serve *OrderBonusService) BatchPayPartnerBonus(orderIds []int64, adminId i |
393
|
e := fmt.Sprintf("获取管理员用户(id=%d)数据失败,%s", adminId, err)
|
393
|
e := fmt.Sprintf("获取管理员用户(id=%d)数据失败,%s", adminId, err)
|
394
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
394
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
395
|
}
|
395
|
}
|
396
|
- var payEvents []event.PayOrderGoodBonus
|
396
|
+ var (
|
|
|
397
|
+ payEvents []event.PayOrderGoodBonus
|
|
|
398
|
+ )
|
397
|
for _, orderId := range orderIds {
|
399
|
for _, orderId := range orderIds {
|
398
|
var oldOrder *domain.OrderBase
|
400
|
var oldOrder *domain.OrderBase
|
399
|
oldOrder, err = orderBaseReponsitory.FindOne(domain.OrderBaseFindOneQuery{OrderId: orderId})
|
401
|
oldOrder, err = orderBaseReponsitory.FindOne(domain.OrderBaseFindOneQuery{OrderId: orderId})
|
|
@@ -440,17 +442,19 @@ func (serve *OrderBonusService) BatchPayPartnerBonus(orderIds []int64, adminId i |
|
@@ -440,17 +442,19 @@ func (serve *OrderBonusService) BatchPayPartnerBonus(orderIds []int64, adminId i |
440
|
if err != nil {
|
442
|
if err != nil {
|
441
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
443
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
442
|
}
|
444
|
}
|
|
|
445
|
+ //构建事件
|
|
|
446
|
+ payEvent := event.PayOrderGoodBonus{
|
|
|
447
|
+ OrderBase: oldOrder,
|
|
|
448
|
+ Goods: updateGoods,
|
|
|
449
|
+ Admin: &adminUser,
|
|
|
450
|
+ }
|
|
|
451
|
+ payEvents = append(payEvents, payEvent)
|
443
|
}
|
452
|
}
|
444
|
- //构建事件
|
|
|
445
|
- payEvent := event.PayOrderGoodBonus{
|
|
|
446
|
- OrderBase: oldOrder,
|
|
|
447
|
- Goods: updateGoods,
|
|
|
448
|
- Admin: &adminUser,
|
|
|
449
|
- }
|
|
|
450
|
- payEvents = append(payEvents, payEvent)
|
|
|
451
|
}
|
453
|
}
|
452
|
- if err = serve.Publish(event.BatchPayOrderGoodBonus(payEvents)); err != nil {
|
|
|
453
|
- return err
|
454
|
+ if len(payEvents) > 0 {
|
|
|
455
|
+ if err = serve.Publish(event.BatchPayOrderGoodBonus(payEvents)); err != nil {
|
|
|
456
|
+ return err
|
|
|
457
|
+ }
|
454
|
}
|
458
|
}
|
455
|
return nil
|
459
|
return nil
|
456
|
} |
460
|
} |