修改错误代码
This commit is contained in:
@@ -10,7 +10,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/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"git.rosy.net.cn/jx-callback/legacy/freshfood"
|
"git.rosy.net.cn/jx-callback/legacy/freshfood"
|
||||||
@@ -71,9 +70,8 @@ func (c *OrderController) onOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi
|
|||||||
|
|
||||||
func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err error) {
|
func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err error) {
|
||||||
result, err := api.JdAPI.QuerySingleOrder(orderID)
|
result, err := api.JdAPI.QuerySingleOrder(orderID)
|
||||||
bussResult, bussErr := api.JdAPI.QueryOassBussMoney(orderID)
|
|
||||||
// globals.SugarLogger.Info(result)
|
// globals.SugarLogger.Info(result)
|
||||||
if err == nil && bussErr == nil {
|
if err == nil {
|
||||||
order = &model.GoodsOrder{
|
order = &model.GoodsOrder{
|
||||||
VendorOrderID: orderID,
|
VendorOrderID: orderID,
|
||||||
VendorID: model.VendorIDJD,
|
VendorID: model.VendorIDJD,
|
||||||
@@ -140,37 +138,21 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
order.Weight += sku.Weight * sku.Count
|
order.Weight += sku.Weight * sku.Count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setOrederDetailFee(bussResult, result, order)
|
setOrederDetailFee(result, order)
|
||||||
return order, err
|
return order, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setOrederDetailFee(bussResult []interface{}, result map[string]interface{}, order *model.GoodsOrder) {
|
func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) {
|
||||||
var skuTotalPmFee, orderPmFee, skuTotalPmSubsidy, orderPmSubsidy int64
|
|
||||||
for _, value := range bussResult {
|
|
||||||
OassBussinessSkusNew := value.(map[string]interface{})
|
|
||||||
discountlist := OassBussinessSkusNew["discountlist"].([]interface{})
|
|
||||||
promotionType := utils.MustInterface2Int64(OassBussinessSkusNew["promotionType"])
|
|
||||||
skuId := utils.MustInterface2Int64(OassBussinessSkusNew["skuId"])
|
|
||||||
for _, value := range discountlist {
|
|
||||||
OrderBussiDiscountMoney := value.(map[string]interface{})
|
|
||||||
if isHave, _ := util.Contain(promotionType, model.JdSkuPromotion); isHave == true {
|
|
||||||
singleSkuPmFee := utils.MustInterface2Int64(OrderBussiDiscountMoney["saleMoney"])
|
|
||||||
skuTotalPmFee += singleSkuPmFee
|
|
||||||
singleSkuPmSubsidy := utils.MustInterface2Int64(OrderBussiDiscountMoney["costMoney"])
|
|
||||||
skuTotalPmSubsidy += singleSkuPmSubsidy
|
|
||||||
setSkuDetailFee(singleSkuPmFee, singleSkuPmSubsidy, order, skuId)
|
|
||||||
} else {
|
|
||||||
orderPmFee += utils.MustInterface2Int64(OrderBussiDiscountMoney["saleMoney"])
|
|
||||||
orderPmSubsidy += utils.MustInterface2Int64(OrderBussiDiscountMoney["costMoney"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
order.SkuTotalPmFee = skuTotalPmFee
|
|
||||||
order.OrderPmFee = orderPmFee
|
|
||||||
order.SkuTotalPmSubsidy = skuTotalPmSubsidy
|
|
||||||
order.OrderPmSubsidy = orderPmSubsidy
|
|
||||||
order.BoxFee = utils.MustInterface2Int64(result["packagingMoney"])
|
order.BoxFee = utils.MustInterface2Int64(result["packagingMoney"])
|
||||||
order.PlatformFeeRate = model.JdPlatformFeeRate
|
order.PlatformFeeRate = model.JdPlatformFeeRate
|
||||||
|
var StoreFreightFee int64
|
||||||
|
|
||||||
|
if utils.Interface2String(result["deliveryCarrierNo"]) == model.NoJdDeliveryCarrierNo {
|
||||||
|
StoreFreightFee = 0
|
||||||
|
} else {
|
||||||
|
StoreFreightFee = utils.MustInterface2Int64(result["merchantPaymentDistanceFreightMoney"]) + utils.MustInterface2Int64(result["tips"])
|
||||||
|
}
|
||||||
|
order.BillStoreFreightFee = StoreFreightFee
|
||||||
}
|
}
|
||||||
|
|
||||||
func setSkuDetailFee(skuPmFee int64, skuPmSubsidy int64, order *model.GoodsOrder, skuId int64) {
|
func setSkuDetailFee(skuPmFee int64, skuPmSubsidy int64, order *model.GoodsOrder, skuId int64) {
|
||||||
|
|||||||
@@ -33,3 +33,10 @@ func TestSwitch2SelfDeliver(t *testing.T) {
|
|||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_GetOrder(t *testing.T) {
|
||||||
|
_, err := new(OrderController).GetOrder("815536199000222")
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001}
|
JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001}
|
||||||
|
//京东众包编号
|
||||||
|
NoJdDeliveryCarrierNo string = "2938"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
Reference in New Issue
Block a user