作者 唐旭辉

修复bug

... ... @@ -226,21 +226,20 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
good := domain.NewOrderGood()
orderBestshop.Goods[i].CopyToOrderGood(&good)
good.OrderId = orderbase.Id
good.CompanyId = partnerData.CompanyId
good.Compute()
good.CurrentBonusStatus.WartPayPartnerBonus(&good)
ordergoods = append(ordergoods, good)
}
orderbase.Goods = ordergoods
orderbase.PartnerId = orderBestshop.PartnerId
orderbase.CompanyId = partnerData.CompanyId
orderbase.Compute()
err = orderBaseRepository.Save(&orderbase)
if err != nil {
e := fmt.Sprintf("添加order_base数据失败%s", err)
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
for i := range ordergoods {
ordergoods[i].OrderId = orderbase.Id
}
// 添加goods
err = orderGoodRepository.Save(ordergoods)
if err != nil {
... ...
... ... @@ -221,6 +221,8 @@ func (good *OrderGood) Compute() error {
var partnerBonusPercent float64
if good.PartnerBonusPercent < 0 {
partnerBonusPercent = 0
} else {
partnerBonusPercent = good.PartnerBonusPercent
}
//price*useGoodNumber
planPartnerBonus := planamount.Mul(decimal.NewFromFloat(partnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*planGoodNumber*PartnerBonusPercent
... ...