修改代码
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/scheduler"
|
"git.rosy.net.cn/jx-callback/business/scheduler"
|
||||||
"git.rosy.net.cn/jx-callback/business/util"
|
|
||||||
"git.rosy.net.cn/jx-callback/legacy/freshfood"
|
"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) {
|
func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) {
|
||||||
var skuTotalPmFee, orderPmFee, skuTotalPmSubsidy, orderPmSubsidy int64
|
|
||||||
orderActivities := result["orderActivities"].([]interface{})
|
orderActivities := result["orderActivities"].([]interface{})
|
||||||
for _, value := range orderActivities {
|
for _, value := range orderActivities {
|
||||||
activity := value.(map[string]interface{})
|
activity := value.(map[string]interface{})
|
||||||
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
categoryId := utils.MustInterface2Int64(activity["categoryId"])
|
||||||
isHave, _ := util.ContainForInt64Arry(categoryId, model.ElmSkuPromotion)
|
restaurantPart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
||||||
if isHave == true {
|
elemePart := -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
||||||
skuTotalPmFee += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
if _, isHave := model.ElmSkuPromotion[int(categoryId)]; isHave {
|
||||||
skuTotalPmSubsidy += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
order.SkuPmFee += restaurantPart
|
||||||
|
order.SkuPmSubsidy += elemePart
|
||||||
} else {
|
} else {
|
||||||
orderPmFee += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
order.OrderPmFee += restaurantPart
|
||||||
orderPmSubsidy += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
order.OrderPmSubsidy += elemePart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
order.SkuPmSubsidy = skuTotalPmSubsidy
|
|
||||||
order.SkuPmFee = skuTotalPmFee
|
|
||||||
order.OrderPmFee = orderPmFee
|
|
||||||
order.OrderPmSubsidy = orderPmSubsidy
|
|
||||||
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
JdSkuPromotion = []int64{2, 3, 4, 6, 8, 1203, 8001, 9998, 9997, 9996}
|
ElmSkuPromotion = map[int]string{
|
||||||
ElmSkuPromotion = []int64{11, 200}
|
11: "1",
|
||||||
|
200: "1",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -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")
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user