...
|
...
|
@@ -28,7 +28,6 @@ func NewOrderBonusService(tcx *transaction.TransactionContext) *OrderBonusServic |
|
|
}
|
|
|
|
|
|
//UpdateBounsWithGoodNumber 分红时,因修改订单中商品的数量发生分红变动
|
|
|
//目前只处理 xiangmi的订单 即 order_type = OrderTypeBestShop (3)
|
|
|
func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId int64, goodId int64, goodWithNumber int, reason string) error {
|
|
|
var (
|
|
|
userRepository domain.UsersRepository
|
...
|
...
|
@@ -52,9 +51,6 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i |
|
|
e := fmt.Sprintf("获取订单(id=%d)数据失败,%s", orderId, err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
if oldOrder.OrderType != domain.OrderTypeBestShop {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, "订单类型错误")
|
|
|
}
|
|
|
oldOrder.Goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orderId})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取订单(id=%d)中的货品数据失败,%s", orderId, err)
|
...
|
...
|
@@ -82,8 +78,13 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i |
|
|
updateGood = oldOrder.Goods[i]
|
|
|
formerNumber = updateGood.GetCurrentGoodNumber()
|
|
|
formerAmount = updateGood.GetCurrentAmount()
|
|
|
err := new(domain.OrderGoodWithBestshop).
|
|
|
UpdateBonusByGoodNumber(&updateGood, goodWithNumber)
|
|
|
//TODO
|
|
|
// err := new(domain.OrderGoodWithBestshop).
|
|
|
// UpdateBonusByGoodNumber(&updateGood, goodWithNumber)
|
|
|
// if err != nil {
|
|
|
// return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
|
|
|
// }
|
|
|
err = updateGood.ModifyOrderGoodNumber(goodWithNumber, oldOrder.OrderType)
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -128,7 +129,6 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i |
|
|
}
|
|
|
|
|
|
//UpdateBounsByPartnerBonusPercent 分红时,因修改订单中商品的合伙人分行比例发生分红变动
|
|
|
////目前只处理 xiangmi的订单 即 order_type = OrderTypeBestShop (3)
|
|
|
func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64, adminId int64, goodId int64, partnerPercent float64, reason string) error {
|
|
|
var (
|
|
|
userRepository domain.UsersRepository
|
...
|
...
|
@@ -152,9 +152,7 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64, |
|
|
e := fmt.Sprintf("获取订单(id=%d)数据失败,%s", orderId, err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
if oldOrder.OrderType != domain.OrderTypeBestShop {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, "订单类型错误")
|
|
|
}
|
|
|
|
|
|
oldOrder.Goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orderId})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取订单中(id=%d)的货品数据失败,%s", orderId, err)
|
...
|
...
|
@@ -182,8 +180,10 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64, |
|
|
updateGood = oldOrder.Goods[i]
|
|
|
formerPartnerBonusPercent = updateGood.PartnerBonusPercent
|
|
|
formerPartnerBonus = updateGood.GetCurrentPartnerBonus()
|
|
|
err := new(domain.OrderGoodWithBestshop).
|
|
|
UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent)
|
|
|
// err := new(domain.OrderGoodWithBestshop).
|
|
|
// UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent)
|
|
|
|
|
|
err = updateGood.ModifyPertnerBonusPercent(partnerPercent, oldOrder.OrderType)
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|