- avoid panic in setOrederDetailFee.
This commit is contained in:
@@ -197,18 +197,20 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) {
|
func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) {
|
||||||
orderActivities := result["orderActivities"].([]interface{})
|
orderActivities, ok := result["orderActivities"].([]interface{})
|
||||||
for _, value := range orderActivities {
|
if ok {
|
||||||
activity := value.(map[string]interface{})
|
for _, value := range orderActivities {
|
||||||
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
activity := value.(map[string]interface{})
|
||||||
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
||||||
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
||||||
if _, ok := model.ElmSkuPromotion[int(categoryId)]; ok {
|
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
||||||
order.SkuPmFee += restaurantPart
|
if _, ok := model.ElmSkuPromotion[int(categoryId)]; ok {
|
||||||
order.SkuPmSubsidy += elemePart
|
order.SkuPmFee += restaurantPart
|
||||||
} else {
|
order.SkuPmSubsidy += elemePart
|
||||||
order.OrderPmFee += restaurantPart
|
} else {
|
||||||
order.OrderPmSubsidy += elemePart
|
order.OrderPmFee += restaurantPart
|
||||||
|
order.OrderPmSubsidy += elemePart
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
||||||
|
|||||||
Reference in New Issue
Block a user