- 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) {
|
||||
orderActivities := result["orderActivities"].([]interface{})
|
||||
for _, value := range orderActivities {
|
||||
activity := value.(map[string]interface{})
|
||||
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
||||
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
||||
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
||||
if _, ok := model.ElmSkuPromotion[int(categoryId)]; ok {
|
||||
order.SkuPmFee += restaurantPart
|
||||
order.SkuPmSubsidy += elemePart
|
||||
} else {
|
||||
order.OrderPmFee += restaurantPart
|
||||
order.OrderPmSubsidy += elemePart
|
||||
orderActivities, ok := result["orderActivities"].([]interface{})
|
||||
if ok {
|
||||
for _, value := range orderActivities {
|
||||
activity := value.(map[string]interface{})
|
||||
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
||||
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
||||
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
||||
if _, ok := model.ElmSkuPromotion[int(categoryId)]; ok {
|
||||
order.SkuPmFee += restaurantPart
|
||||
order.SkuPmSubsidy += elemePart
|
||||
} else {
|
||||
order.OrderPmFee += restaurantPart
|
||||
order.OrderPmSubsidy += elemePart
|
||||
}
|
||||
}
|
||||
}
|
||||
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
||||
|
||||
Reference in New Issue
Block a user