diff --git a/business/controller/elm/order.go b/business/controller/elm/order.go index db411da19..44a5efb4d 100644 --- a/business/controller/elm/order.go +++ b/business/controller/elm/order.go @@ -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"])) } diff --git a/business/model/const.go b/business/model/const.go index f3803b4dc..69097d23e 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -125,8 +125,10 @@ const ( ) var ( - JdSkuPromotion = []int64{2, 3, 4, 6, 8, 1203, 8001, 9998, 9997, 9996} - ElmSkuPromotion = []int64{11, 200} + ElmSkuPromotion = map[int]string{ + 11: "1", + 200: "1", + } ) const ( diff --git a/business/util/Contain.go b/business/util/Contain.go deleted file mode 100644 index 9966db076..000000000 --- a/business/util/Contain.go +++ /dev/null @@ -1,15 +0,0 @@ -package util - -import ( - "errors" -) - -// 判断obj是否在target中,target支持的类型arrary,slice -func ContainForInt64Arry(obj int64, target []int64) (bool, error) { - for _, value := range target { - if value == obj { - return true, nil - } - } - return false, errors.New("not in array") -}