修改代码

This commit is contained in:
lyb
2018-08-10 17:30:07 +08:00
parent 5cccfd532f
commit aac9881f6a
3 changed files with 11 additions and 29 deletions

View File

@@ -15,7 +15,6 @@ import (
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/scheduler"
"git.rosy.net.cn/jx-callback/business/util"
"git.rosy.net.cn/jx-callback/legacy/freshfood"
)
@@ -198,24 +197,20 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
}
func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) {
var skuTotalPmFee, orderPmFee, skuTotalPmSubsidy, orderPmSubsidy int64
orderActivities := result["orderActivities"].([]interface{})
for _, value := range orderActivities {
activity := value.(map[string]interface{})
categoryId := utils.MustInterface2Int64(activity["categoryId"])
isHave, _ := util.ContainForInt64Arry(categoryId, model.ElmSkuPromotion)
if isHave == true {
skuTotalPmFee += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
skuTotalPmSubsidy += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
if _, isHave := model.ElmSkuPromotion[int(categoryId)]; isHave {
order.SkuPmFee += restaurantPart
order.SkuPmSubsidy += elemePart
} else {
orderPmFee += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
orderPmSubsidy += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
order.OrderPmFee += restaurantPart
order.OrderPmSubsidy += elemePart
}
}
order.SkuPmSubsidy = skuTotalPmSubsidy
order.SkuPmFee = skuTotalPmFee
order.OrderPmFee = orderPmFee
order.OrderPmSubsidy = orderPmSubsidy
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
}