From 0ef674c0728f4b978052157ef93df7e29f7b4e49 Mon Sep 17 00:00:00 2001 From: lyb Date: Thu, 9 Aug 2018 16:37:38 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/jd/order.go | 45 ++++++++++++++++++++++++++++++++- business/model/const.go | 9 +++++++ business/model/order.go | 13 ++++++++-- business/util/Contain.go | 25 ++++++++++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 business/util/Contain.go diff --git a/business/controller/jd/order.go b/business/controller/jd/order.go index 142a570ea..cbd686685 100644 --- a/business/controller/jd/order.go +++ b/business/controller/jd/order.go @@ -10,6 +10,7 @@ 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/globals" "git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/legacy/freshfood" @@ -70,8 +71,10 @@ func (c *OrderController) onOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err error) { result, err := api.JdAPI.QuerySingleOrder(orderID) + bussResult, bussErr := api.JdAPI.QueryOassBussMoney(orderID) // globals.SugarLogger.Info(result) - if err == nil { + //todo 将API获取的信息填入新字段里 + if err == nil && bussErr == nil { order = &model.GoodsOrder{ VendorOrderID: orderID, VendorID: model.VendorIDJD, @@ -91,6 +94,7 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]), Skus: []*model.OrderSku{}, } + order.Status = c.GetStatusFromVendorStatus(order.VendorStatus) businessTage := utils.Interface2String(result["businessTag"]) if strings.Index(businessTage, "dj_aging_immediately") >= 0 { @@ -137,9 +141,48 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err order.Weight += sku.Weight * sku.Count } } + setOrederDetailFee(bussResult, result, order) return order, err } +func setOrederDetailFee(bussResult []interface{}, 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.PlatformFeeRate = model.JdPlatformFeeRate +} + +func setSkuDetailFee(skuPmFee int64, skuPmSubsidy int64, order *model.GoodsOrder, skuId int64) { + for _, value := range order.Skus { + if value.SkuID == int(skuId) { + value.SkuPmSubsidy = skuPmSubsidy + value.SkuPmFee = skuPmFee + } + } +} + // func (c *OrderController) onOrderNew(msg *jdapi.CallbackOrderMsg) (response *jdapi.CallbackResponse) { order, err := c.GetOrder(msg.BillID) diff --git a/business/model/const.go b/business/model/const.go index bc99e4245..93c64fbb1 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -123,3 +123,12 @@ const ( BusinessTypeImmediate = 1 BusinessTypeDingshida = 2 ) + +var ( + JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001} +) + +const ( + JdPlatformFeeRate = 10 + MtPlatformFeeRate = 10 +) diff --git a/business/model/order.go b/business/model/order.go index 2bfc4e331..705292902 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -44,8 +44,15 @@ type GoodsOrder struct { OrderFinishedAt time.Time `orm:"type(datetime)"` StatusTime time.Time `orm:"type(datetime)"` // last status time ModelTimeInfo - OriginalData string `orm:"type(text)"` - Skus []*OrderSku `orm:"-"` + OriginalData string `orm:"type(text)"` + Skus []*OrderSku `orm:"-"` + SkuTotalPmFee int64 //门店商品促销总支出 + OrderPmFee int64 //门店订单促销支出 + SkuTotalPmSubsidy int64 //平台商品促销总补贴 + OrderPmSubsidy int64 //平台订单促销补贴 + BoxFee int64 //餐盒费 + PlatformFeeRate int16 //平台费 + BillStoreFreightFee int64 //需要回调,门店所承担的运费 } func (o *GoodsOrder) TableUnique() [][]string { @@ -69,6 +76,8 @@ type OrderSku struct { SkuType int // 当前如果为gift就为1,否则缺省为0 PromotionType int // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换 OrderCreatedAt time.Time `orm:"type(datetime);index"` // 分区考虑 + SkuPmSubsidy int64 //平台商品活动补贴 + SkuPmFee int64 //门店商品促销支出 } // 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠) diff --git a/business/util/Contain.go b/business/util/Contain.go new file mode 100644 index 000000000..f55b945e3 --- /dev/null +++ b/business/util/Contain.go @@ -0,0 +1,25 @@ +package util + +import ( + "errors" + "reflect" +) + +// 判断obj是否在target中,target支持的类型arrary,slice,map +func Contain(obj interface{}, target interface{}) (bool, error) { + targetValue := reflect.ValueOf(target) + switch reflect.TypeOf(target).Kind() { + case reflect.Slice, reflect.Array: + for i := 0; i < targetValue.Len(); i++ { + if targetValue.Index(i).Interface() == obj { + return true, nil + } + } + case reflect.Map: + if targetValue.MapIndex(reflect.ValueOf(obj)).IsValid() { + return true, nil + } + } + + return false, errors.New("not in array") +} From f281f4e7ab534dcc645bc33a20e57e3af1b9e915 Mon Sep 17 00:00:00 2001 From: lyb Date: Thu, 9 Aug 2018 16:43:36 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/jd/order.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/controller/jd/order.go b/business/controller/jd/order.go index cbd686685..e61d72358 100644 --- a/business/controller/jd/order.go +++ b/business/controller/jd/order.go @@ -73,7 +73,6 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err result, err := api.JdAPI.QuerySingleOrder(orderID) bussResult, bussErr := api.JdAPI.QueryOassBussMoney(orderID) // globals.SugarLogger.Info(result) - //todo 将API获取的信息填入新字段里 if err == nil && bussErr == nil { order = &model.GoodsOrder{ VendorOrderID: orderID, From a873eb5a060feb6946e88737ce017cbb8dbeabd8 Mon Sep 17 00:00:00 2001 From: lyb Date: Thu, 9 Aug 2018 18:47:36 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/jd/order.go | 40 ++++++++-------------------- business/controller/jd/order_test.go | 7 +++++ business/model/const.go | 2 ++ 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/business/controller/jd/order.go b/business/controller/jd/order.go index e61d72358..681f693c1 100644 --- a/business/controller/jd/order.go +++ b/business/controller/jd/order.go @@ -10,7 +10,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/globals" "git.rosy.net.cn/jx-callback/globals/api" "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) { result, err := api.JdAPI.QuerySingleOrder(orderID) - bussResult, bussErr := api.JdAPI.QueryOassBussMoney(orderID) // globals.SugarLogger.Info(result) - if err == nil && bussErr == nil { + if err == nil { order = &model.GoodsOrder{ VendorOrderID: orderID, VendorID: model.VendorIDJD, @@ -140,37 +138,21 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err order.Weight += sku.Weight * sku.Count } } - setOrederDetailFee(bussResult, result, order) + setOrederDetailFee(result, order) return order, err } -func setOrederDetailFee(bussResult []interface{}, 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 +func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) { order.BoxFee = utils.MustInterface2Int64(result["packagingMoney"]) 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) { diff --git a/business/controller/jd/order_test.go b/business/controller/jd/order_test.go index 0cbda7a2c..92d1a9664 100644 --- a/business/controller/jd/order_test.go +++ b/business/controller/jd/order_test.go @@ -33,3 +33,10 @@ func TestSwitch2SelfDeliver(t *testing.T) { t.Fatal(err.Error()) } } + +func Test_GetOrder(t *testing.T) { + _, err := new(OrderController).GetOrder("815536199000222") + if err != nil { + panic(err.Error()) + } +} diff --git a/business/model/const.go b/business/model/const.go index 93c64fbb1..8fa073eb3 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -126,6 +126,8 @@ const ( var ( JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001} + //京东众包编号 + NoJdDeliveryCarrierNo string = "2938" ) const ( From c45858e4e9c1c1156f84f61a0283374098b11daf Mon Sep 17 00:00:00 2001 From: lyb Date: Fri, 10 Aug 2018 10:17:21 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E9=87=8D=E4=BF=AE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/jd/order.go | 10 +--------- business/model/const.go | 2 -- business/model/order.go | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/business/controller/jd/order.go b/business/controller/jd/order.go index 681f693c1..9af2d6276 100644 --- a/business/controller/jd/order.go +++ b/business/controller/jd/order.go @@ -91,7 +91,6 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]), Skus: []*model.OrderSku{}, } - order.Status = c.GetStatusFromVendorStatus(order.VendorStatus) businessTage := utils.Interface2String(result["businessTag"]) if strings.Index(businessTage, "dj_aging_immediately") >= 0 { @@ -145,14 +144,7 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) { order.BoxFee = utils.MustInterface2Int64(result["packagingMoney"]) 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 + order.BillStoreFreightFee = utils.MustInterface2Int64(result["merchantPaymentDistanceFreightMoney"]) + utils.MustInterface2Int64(result["tips"]) } func setSkuDetailFee(skuPmFee int64, skuPmSubsidy int64, order *model.GoodsOrder, skuId int64) { diff --git a/business/model/const.go b/business/model/const.go index 8fa073eb3..93c64fbb1 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -126,8 +126,6 @@ const ( var ( JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001} - //京东众包编号 - NoJdDeliveryCarrierNo string = "2938" ) const ( diff --git a/business/model/order.go b/business/model/order.go index 705292902..8405f3375 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -46,9 +46,9 @@ type GoodsOrder struct { ModelTimeInfo OriginalData string `orm:"type(text)"` Skus []*OrderSku `orm:"-"` - SkuTotalPmFee int64 //门店商品促销总支出 + SkuPmFee int64 //门店商品促销总支出 OrderPmFee int64 //门店订单促销支出 - SkuTotalPmSubsidy int64 //平台商品促销总补贴 + SkuPmSubsidy int64 //平台商品促销总补贴 OrderPmSubsidy int64 //平台订单促销补贴 BoxFee int64 //餐盒费 PlatformFeeRate int16 //平台费 From dad4ab5d733b44cbe87451d0e54a66e1ff1476c5 Mon Sep 17 00:00:00 2001 From: lyb Date: Fri, 10 Aug 2018 10:19:03 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/util/Contain.go | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 business/util/Contain.go diff --git a/business/util/Contain.go b/business/util/Contain.go deleted file mode 100644 index f55b945e3..000000000 --- a/business/util/Contain.go +++ /dev/null @@ -1,25 +0,0 @@ -package util - -import ( - "errors" - "reflect" -) - -// 判断obj是否在target中,target支持的类型arrary,slice,map -func Contain(obj interface{}, target interface{}) (bool, error) { - targetValue := reflect.ValueOf(target) - switch reflect.TypeOf(target).Kind() { - case reflect.Slice, reflect.Array: - for i := 0; i < targetValue.Len(); i++ { - if targetValue.Index(i).Interface() == obj { - return true, nil - } - } - case reflect.Map: - if targetValue.MapIndex(reflect.ValueOf(obj)).IsValid() { - return true, nil - } - } - - return false, errors.New("not in array") -} From 3bc6608e1fa70c537c615833971a964f32465517 Mon Sep 17 00:00:00 2001 From: lyb Date: Fri, 10 Aug 2018 11:02:06 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/elm/order.go | 5 +++++ business/controller/jd/order.go | 9 --------- business/controller/jd/waybill.go | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/business/controller/elm/order.go b/business/controller/elm/order.go index 168a0ea52..fbbf7af30 100644 --- a/business/controller/elm/order.go +++ b/business/controller/elm/order.go @@ -194,6 +194,11 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err } return order, err } +func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) { + //var skuTotalPmFee, orderPmFee, skuTotalPmSubsidy, orderPmSubsidy float64 + + order.BoxFee = jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["packageFee"])) +} // func (c *OrderController) onOrderNew(msg map[string]interface{}) (response *elmapi.CallbackResponse) { diff --git a/business/controller/jd/order.go b/business/controller/jd/order.go index 9af2d6276..64a9d371d 100644 --- a/business/controller/jd/order.go +++ b/business/controller/jd/order.go @@ -147,15 +147,6 @@ func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) order.BillStoreFreightFee = utils.MustInterface2Int64(result["merchantPaymentDistanceFreightMoney"]) + utils.MustInterface2Int64(result["tips"]) } -func setSkuDetailFee(skuPmFee int64, skuPmSubsidy int64, order *model.GoodsOrder, skuId int64) { - for _, value := range order.Skus { - if value.SkuID == int(skuId) { - value.SkuPmSubsidy = skuPmSubsidy - value.SkuPmFee = skuPmFee - } - } -} - // func (c *OrderController) onOrderNew(msg *jdapi.CallbackOrderMsg) (response *jdapi.CallbackResponse) { order, err := c.GetOrder(msg.BillID) diff --git a/business/controller/jd/waybill.go b/business/controller/jd/waybill.go index 718f9786e..0d98972ed 100644 --- a/business/controller/jd/waybill.go +++ b/business/controller/jd/waybill.go @@ -26,7 +26,7 @@ func (c *WaybillController) onWaybillMsg(msg *jdapi.CallbackDeliveryStatusMsg) ( order.Status = model.WaybillStatusNew case jdapi.DeliveryStatusAccepted: if result, err := api.JdAPI.QuerySingleOrder(msg.OrderID); err == nil { - order.DesiredFee = utils.Interface2Int64WithDefault(result["orderFreightMoney"], 0) + + order.DesiredFee = utils.Interface2Int64WithDefault(result["orderReceivableFreight"], 0) + utils.Interface2Int64WithDefault(result["merchantPaymentDistanceFreightMoney"], 0) + utils.Interface2Int64WithDefault(result["tips"], 0) } From 66a90a6f3aa7ecb5d855c842094fe2995b04c43a Mon Sep 17 00:00:00 2001 From: lyb Date: Fri, 10 Aug 2018 11:04:20 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/const.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/const.go b/business/model/const.go index 93c64fbb1..7bed36380 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -125,7 +125,7 @@ const ( ) var ( - JdSkuPromotion = [10]int64{2, 3, 4, 1203, 6, 9998, 9997, 9996, 8, 8001} + JdSkuPromotion = []int64{2, 3, 4, 6, 8, 1203, 8001, 9998, 9997, 9996} ) const ( From 1eb7a1ff03ea7492464f34330c375a28719b62c4 Mon Sep 17 00:00:00 2001 From: lyb Date: Fri, 10 Aug 2018 11:13:51 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E4=BA=AC=E4=B8=9CAPI?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=BB=93=E8=B4=A6=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/controller/elm/order.go | 5 ----- business/controller/jd/waybill.go | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/business/controller/elm/order.go b/business/controller/elm/order.go index fbbf7af30..168a0ea52 100644 --- a/business/controller/elm/order.go +++ b/business/controller/elm/order.go @@ -194,11 +194,6 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err } return order, err } -func setOrederDetailFee(result map[string]interface{}, order *model.GoodsOrder) { - //var skuTotalPmFee, orderPmFee, skuTotalPmSubsidy, orderPmSubsidy float64 - - order.BoxFee = jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["packageFee"])) -} // func (c *OrderController) onOrderNew(msg map[string]interface{}) (response *elmapi.CallbackResponse) { diff --git a/business/controller/jd/waybill.go b/business/controller/jd/waybill.go index 0d98972ed..0aacb59bd 100644 --- a/business/controller/jd/waybill.go +++ b/business/controller/jd/waybill.go @@ -26,6 +26,8 @@ func (c *WaybillController) onWaybillMsg(msg *jdapi.CallbackDeliveryStatusMsg) ( order.Status = model.WaybillStatusNew case jdapi.DeliveryStatusAccepted: if result, err := api.JdAPI.QuerySingleOrder(msg.OrderID); err == nil { + // 默认配送费=订单应付运费(orderReceivableFreight) + //订单应付运费为未优惠前应付运费(满免优惠,运费优惠券,VIP免基础运费,用户小费)ps:用户小费是用户给配送员的小费 order.DesiredFee = utils.Interface2Int64WithDefault(result["orderReceivableFreight"], 0) + utils.Interface2Int64WithDefault(result["merchantPaymentDistanceFreightMoney"], 0) + utils.Interface2Int64WithDefault(result["tips"], 0)