作者 唐旭辉

bug 修复

@@ -56,8 +56,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE @@ -56,8 +56,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
56 Title: "调整商品数量", 56 Title: "调整商品数量",
57 Item: currentEvent.GoodName, 57 Item: currentEvent.GoodName,
58 Action: []string{ 58 Action: []string{
59 - fmt.Sprintf("购买数量由%s调整为%s", currentEvent.FormerNumber, currentEvent.NewNumber),  
60 - fmt.Sprintf("商品总价由¥%s调整为¥%s", currentEvent.FormerAmount, currentEvent.NewAmount), 59 + fmt.Sprintf(`购买数量由"%s"调整为"%s"`, currentEvent.FormerNumber, currentEvent.NewNumber),
  60 + fmt.Sprintf(`商品总价由"¥%s"调整为"¥%s"`, currentEvent.FormerAmount, currentEvent.NewAmount),
61 }, 61 },
62 }, 62 },
63 }, 63 },
@@ -85,8 +85,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE @@ -85,8 +85,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
85 Title: "合伙人分红比例", 85 Title: "合伙人分红比例",
86 Item: currentEvent.GoodName, 86 Item: currentEvent.GoodName,
87 Action: []string{ 87 Action: []string{
88 - fmt.Sprintf("分红比例由%s调整为%s", currentEvent.FormerPartnerBonusPercent, currentEvent.NewPartnerBonusPercent),  
89 - fmt.Sprintf("应收分红由¥%s调整为¥%s", currentEvent.FormerPartnerBonus, currentEvent.NewPartnerBonus), 88 + fmt.Sprintf(`分红比例由"%s"调整为"%s"`, currentEvent.FormerPartnerBonusPercent, currentEvent.NewPartnerBonusPercent),
  89 + fmt.Sprintf(`应收分红由"¥%s"调整为"¥%s"`, currentEvent.FormerPartnerBonus, currentEvent.NewPartnerBonus),
90 }, 90 },
91 }, 91 },
92 }, 92 },
@@ -140,7 +140,7 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE @@ -140,7 +140,7 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
140 Title: "支付分红", 140 Title: "支付分红",
141 Item: currentEvent.GoodName, 141 Item: currentEvent.GoodName,
142 Action: []string{ 142 Action: []string{
143 - fmt.Sprintf("支付分红¥%.2f", currentEvent.PartnerBonus), 143 + fmt.Sprintf(`支付分红"¥%.2f"`, currentEvent.PartnerBonus),
144 }, 144 },
145 }, 145 },
146 }, 146 },
@@ -31,7 +31,11 @@ func (o *OrderGoodWithBestshop) UpdateBonusByPertnerBonusPercent(good *OrderGood @@ -31,7 +31,11 @@ func (o *OrderGoodWithBestshop) UpdateBonusByPertnerBonusPercent(good *OrderGood
31 31
32 func (o *OrderGoodWithBestshop) PayPartnerBonus(good *OrderGood) error { 32 func (o *OrderGoodWithBestshop) PayPartnerBonus(good *OrderGood) error {
33 o.currentBonusStatus = OrderGoodBonusBestshopHasPay{} 33 o.currentBonusStatus = OrderGoodBonusBestshopHasPay{}
34 - err := good.CurrentBonusStatus.PayPartnerBonus(good) 34 + err := good.Compute()
  35 + if err != nil {
  36 + return errors.New("核算商品数据失败" + err.Error())
  37 + }
  38 + err = good.CurrentBonusStatus.PayPartnerBonus(good)
35 return err 39 return err
36 } 40 }
37 41
@@ -55,14 +59,22 @@ var _ OrderGoodWithBestshopBonusStatus = (*OrderGoodBonusBestshopWaitPay)(nil) @@ -55,14 +59,22 @@ var _ OrderGoodWithBestshopBonusStatus = (*OrderGoodBonusBestshopWaitPay)(nil)
55 func (waitPay OrderGoodBonusBestshopWaitPay) UpdateOrderGoodNumber(good *OrderGood, number int) error { 59 func (waitPay OrderGoodBonusBestshopWaitPay) UpdateOrderGoodNumber(good *OrderGood, number int) error {
56 good.UseGoodNumber = number 60 good.UseGoodNumber = number
57 //待支付状态计算 61 //待支付状态计算
58 - err := good.CurrentBonusStatus.WartPayPartnerBonus(good) 62 + err := good.Compute()
  63 + if err != nil {
  64 + return errors.New("核算商品数据失败" + err.Error())
  65 + }
  66 + err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
59 return err 67 return err
60 } 68 }
61 69
62 func (waitPay OrderGoodBonusBestshopWaitPay) UpdatePertnerBonusPercent(good *OrderGood, percent float64) error { 70 func (waitPay OrderGoodBonusBestshopWaitPay) UpdatePertnerBonusPercent(good *OrderGood, percent float64) error {
63 good.PartnerBonusPercent = percent 71 good.PartnerBonusPercent = percent
64 //待支付状态计算 72 //待支付状态计算
65 - err := good.CurrentBonusStatus.WartPayPartnerBonus(good) 73 + err := good.Compute()
  74 + if err != nil {
  75 + return errors.New("核算商品数据失败" + err.Error())
  76 + }
  77 + err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
66 return err 78 return err
67 } 79 }
68 80
@@ -82,15 +82,12 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i @@ -82,15 +82,12 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i
82 updateGood = oldOrder.Goods[i] 82 updateGood = oldOrder.Goods[i]
83 formerNumber = updateGood.GetCurrentGoodNumber() 83 formerNumber = updateGood.GetCurrentGoodNumber()
84 formerAmount = updateGood.GetCurrentAmount() 84 formerAmount = updateGood.GetCurrentAmount()
85 - err := new(domain.OrderGoodWithBestshop).UpdateBonusByGoodNumber(&updateGood, goodWithNumber) 85 + err := new(domain.OrderGoodWithBestshop).
  86 + UpdateBonusByGoodNumber(&updateGood, goodWithNumber)
86 if err != nil { 87 if err != nil {
87 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) 88 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
88 } 89 }
89 updateGood.RemarkReason.ModifyGoodNumber = reason 90 updateGood.RemarkReason.ModifyGoodNumber = reason
90 - //计算  
91 - if err := updateGood.Compute(); err != nil {  
92 - return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "核算商品数据失败"+err.Error())  
93 - }  
94 newAmount = updateGood.GetCurrentAmount() 91 newAmount = updateGood.GetCurrentAmount()
95 goodExist = true 92 goodExist = true
96 oldOrder.Goods[i] = updateGood 93 oldOrder.Goods[i] = updateGood
@@ -185,15 +182,12 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64, @@ -185,15 +182,12 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64,
185 updateGood = oldOrder.Goods[i] 182 updateGood = oldOrder.Goods[i]
186 formerPartnerBonusPercent = updateGood.PartnerBonusPercent 183 formerPartnerBonusPercent = updateGood.PartnerBonusPercent
187 formerPartnerBonus = updateGood.GetCurrentPartnerBonus() 184 formerPartnerBonus = updateGood.GetCurrentPartnerBonus()
188 - err := new(domain.OrderGoodWithBestshop).UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent) 185 + err := new(domain.OrderGoodWithBestshop).
  186 + UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent)
189 if err != nil { 187 if err != nil {
190 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) 188 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
191 } 189 }
192 updateGood.RemarkReason.ModifyPartnerBonusPercent = reason 190 updateGood.RemarkReason.ModifyPartnerBonusPercent = reason
193 - //计算  
194 - if err := updateGood.Compute(); err != nil {  
195 - return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "核算商品数据失败"+err.Error())  
196 - }  
197 newPartnerBonus = updateGood.GetCurrentPartnerBonus() 191 newPartnerBonus = updateGood.GetCurrentPartnerBonus()
198 goodExist = true 192 goodExist = true
199 oldOrder.Goods[i] = updateGood 193 oldOrder.Goods[i] = updateGood
@@ -289,10 +283,6 @@ func (serve *OrderBonusService) PayOrderGoodBonus(orderId int64, goodId int64, a @@ -289,10 +283,6 @@ func (serve *OrderBonusService) PayOrderGoodBonus(orderId int64, goodId int64, a
289 if err != nil { 283 if err != nil {
290 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) 284 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
291 } 285 }
292 - //计算  
293 - if err := updateGood.Compute(); err != nil {  
294 - return errors.New("核算商品数据失败" + err.Error())  
295 - }  
296 goodExist = true 286 goodExist = true
297 oldOrder.Goods[i] = updateGood 287 oldOrder.Goods[i] = updateGood
298 } 288 }