饿了么可实时获取的结账必要信息。
This commit is contained in:
@@ -15,6 +15,7 @@ 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"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
VendorID: model.VendorIDELM,
|
VendorID: model.VendorIDELM,
|
||||||
Count: int(utils.MustInterface2Int64(product["quantity"])),
|
Count: int(utils.MustInterface2Int64(product["quantity"])),
|
||||||
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["extendCode"]), 0)),
|
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["extendCode"]), 0)),
|
||||||
VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["skuId"])),
|
VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["vfoodId"])),
|
||||||
SkuName: product["name"].(string),
|
SkuName: product["name"].(string),
|
||||||
SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])),
|
SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])),
|
||||||
Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))),
|
Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))),
|
||||||
@@ -192,9 +193,32 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setOrederDetailFee(result, order)
|
||||||
return order, err
|
return order, 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"]))
|
||||||
|
} else {
|
||||||
|
orderPmFee += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["restaurantPart"]))
|
||||||
|
orderPmSubsidy += -jxutils.StandardPrice2Int(utils.MustInterface2Float64(activity["elemePart"]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
order.SkuPmSubsidy = skuTotalPmSubsidy
|
||||||
|
order.SkuPmFee = skuTotalPmFee
|
||||||
|
order.OrderPmFee = orderPmFee
|
||||||
|
order.OrderPmSubsidy = orderPmSubsidy
|
||||||
|
order.PlatformFeeRate = int16(utils.MustInterface2Float64(result["serviceRate"]))
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
func (c *OrderController) onOrderNew(msg map[string]interface{}) (response *elmapi.CallbackResponse) {
|
func (c *OrderController) onOrderNew(msg map[string]interface{}) (response *elmapi.CallbackResponse) {
|
||||||
// todo 这里应该可以直接用msg里的内容,而不用再次去查
|
// todo 这里应该可以直接用msg里的内容,而不用再次去查
|
||||||
|
|||||||
@@ -125,7 +125,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
JdSkuPromotion = []int64{2, 3, 4, 6, 8, 1203, 8001, 9998, 9997, 9996}
|
JdSkuPromotion = []int64{2, 3, 4, 6, 8, 1203, 8001, 9998, 9997, 9996}
|
||||||
|
ElmSkuPromotion = []int64{11, 200}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
Reference in New Issue
Block a user