From 185ebf7d10383ea1007abed5f73131ced64e9983 Mon Sep 17 00:00:00 2001 From: renyutian Date: Wed, 24 Apr 2019 13:41:27 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=A5=BF=E7=99=BE=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E8=AE=A2=E5=8D=95=E6=BC=8F=E5=8D=95=EF=BC=8C?= =?UTF-8?q?=E5=8F=96=E9=94=99=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/order_financial.go | 3 ++- business/partner/purchase/ebai/financial.go | 4 +++- business/partner/purchase/jd/financial.go | 8 +++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/business/model/order_financial.go b/business/model/order_financial.go index a667749ed..3c63c0725 100644 --- a/business/model/order_financial.go +++ b/business/model/order_financial.go @@ -53,6 +53,7 @@ type OrderDiscountFinancial struct { VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有 VendorActivityID string `orm:"column(vendor_activity_id);size(48)" json:"vendorActivityID"` // 活动ID 活动ID的存在,使原本的通过城市/下单时间-活动时间/金额……一系列匹配来确认活动归属的费时且准确度低的行为有了改变的可能--通过编码精确定位 + Type string `orm:"size(48)" json:"type"` // 活动type 美团订单存在不同的活动,活动ID是一样的,type不一样 如订单34399553040365354 // ActivityName string `orm:"size(255)" json:"activityName"` // 活动名 // ActivityMoney int64 `json:"activityMoney"` // 优惠金额 // Remark string `orm:"size(255)" json:"remark"` // 备注 @@ -61,7 +62,7 @@ type OrderDiscountFinancial struct { // 设置主键 "VendorOrderID", "DiscountCode", "VendorID" 一个订单不可能享受同一优惠2次 func (o *OrderDiscountFinancial) TableUnique() [][]string { return [][]string{ - []string{"VendorOrderID", "VendorActivityID", "VendorID"}, + []string{"VendorOrderID", "VendorActivityID", "Type", "VendorID"}, } } diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 65b6870bd..01ea3a6d4 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -13,7 +13,8 @@ import ( func OnFinancialMsg(msg *ebaiapi.CallbackMsg) (err error) { if msg.Cmd == ebaiapi.CmdOrderPartRefund { // 部分退款处理 if utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"])) == ebaiapi.OrderPartRefundSuccess { - orderData, err2 := api.EbaiAPI.OrderPartrefundGet(utils.Interface2String(msg.Body["refund_id"])) + afsOrderID := utils.Interface2String(msg.Body["order_id"]) + orderData, err2 := api.EbaiAPI.OrderPartrefundGet(afsOrderID) if err = err2; err == nil { afsOrder := CurPurchaseHandler.AfsOrderDetail2Financial(orderData) err = partner.CurOrderManager.SaveAfsOrderFinancialInfo(afsOrder) @@ -233,6 +234,7 @@ func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) ( // ActivityName: utils.Interface2String(xMap["desc"]), // ActivityMoney: discountPrice, VendorActivityID: utils.Interface2String(xMap["activity_id"]), + Type: utils.Interface2String(xMap["type"]), } orderFinancial.Discounts = append(orderFinancial.Discounts, activity) // 通过活动Id去取,京西活动补贴 diff --git a/business/partner/purchase/jd/financial.go b/business/partner/purchase/jd/financial.go index be0d3c756..1c4fef6ba 100644 --- a/business/partner/purchase/jd/financial.go +++ b/business/partner/purchase/jd/financial.go @@ -99,6 +99,7 @@ func (p *PurchaseHandler) OrderDetail2Financial(orderData map[string]interface{} // 如果为自配送,自配送补贴=订单初始运费,远距离费=0 orderFinancial.SelfDeliveryDiscountMoney = utils.MustInterface2Int64(orderData["orderReceivableFreight"]) orderFinancial.DistanceFreightMoney = 0 + orderFinancial.FreightTipsMoney = 0 // 通过本地数据库去取是否转美团/达达,并计算运费 // wayBill, err2 := partner.CurOrderManager.LoadWaybill(orderFinancial.VendorOrderID, orderFinancial.VendorID) // if err = err2; err == nil { @@ -127,11 +128,12 @@ func (p *PurchaseHandler) OrderDetail2Financial(orderData map[string]interface{} if xMap["orderShareRatioData"] != nil { orderShareRatioData, _ := utils.HTTPBody2Values([]byte(utils.Interface2String(xMap["orderShareRatioData"])), false) activity := &model.OrderDiscountFinancial{ - VendorID: orderFinancial.VendorID, - VendorOrderID: orderFinancial.VendorOrderID, + VendorID: orderFinancial.VendorID, + VendorOrderID: orderFinancial.VendorOrderID, + VendorActivityID: utils.Interface2String(orderShareRatioData["promotionId"][0]), + Type: utils.Int64ToStr(int64(discountType)), // ActivityName: utils.Interface2String(xMap["discountName"]), // ActivityMoney: discountPrice, - VendorActivityID: utils.Interface2String(orderShareRatioData["promotionId"][0]), // Remark: utils.Interface2String(xMap["orderShareRatioData"]), } orderFinancial.Discounts = append(orderFinancial.Discounts, activity) From 32924c7262556f5d07c558b322b111ccbb227852 Mon Sep 17 00:00:00 2001 From: renyutian Date: Wed, 24 Apr 2019 15:30:35 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=A5=BF=E7=99=BE=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E8=AE=A2=E5=8D=95=E9=80=80=E6=AC=BE=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E7=94=B1=E4=BA=8E=E5=8E=9F=E6=AD=A3=E5=90=91=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BD=A3=E9=87=91=E6=94=B9=E5=8F=98=E8=80=8C=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=89=A3=E6=AC=BE=E9=87=91=E9=A2=9D=E4=B8=8D=E5=87=86?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/financial.go | 2 +- business/model/order_financial.go | 1 + business/partner/purchase/ebai/ebai_test.go | 1 + business/partner/purchase/ebai/financial.go | 10 +++++++++ .../partner/purchase/ebai/financial_test.go | 22 +++++++++++-------- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/business/jxcallback/orderman/financial.go b/business/jxcallback/orderman/financial.go index 4e0e76898..e3718efc1 100644 --- a/business/jxcallback/orderman/financial.go +++ b/business/jxcallback/orderman/financial.go @@ -158,7 +158,7 @@ func (c *OrderManager) SaveAfsOrderFinancialInfo(afsOrder *model.AfsOrder) (err }() // 平台结算扣除汇总--平台补贴,售后产生运费,平台收包装费,同城运费、、、 deductionsByPm := afsOrder.PmSubsidyMoney + afsOrder.AfsFreightMoney + afsOrder.BoxMoney + afsOrder.TongchengFreightMoney - afsOrder.RefundMoneyByCal = afsOrder.SkuUserMoney + afsOrder.FreightUserMoney + deductionsByPm + afsOrder.RefundMoneyByCal = afsOrder.SkuUserMoney + afsOrder.FreightUserMoney + deductionsByPm - afsOrder.PmRefundMoney // order.TotalMoney += order.SkuJxMoney // 退款单京西补贴部分先不作计算 if err = dao.CreateEntity(db, afsOrder); err != nil { if !dao.IsDuplicateError(err) { diff --git a/business/model/order_financial.go b/business/model/order_financial.go index 3c63c0725..5eb38bef3 100644 --- a/business/model/order_financial.go +++ b/business/model/order_financial.go @@ -85,6 +85,7 @@ type AfsOrder struct { SkuBoxMoney int64 `json:"skuBoxMoney"` // 应退订单餐盒费 PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台总补贴金额 PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台sku补贴金额 + PmRefundMoney int64 `json:"pmRefundMoney"` // 订单取消后可能存在佣金减少,平台退回部分金额的情况 RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1 RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M // JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴 diff --git a/business/partner/purchase/ebai/ebai_test.go b/business/partner/purchase/ebai/ebai_test.go index 37f0870e7..b82d6bdb4 100644 --- a/business/partner/purchase/ebai/ebai_test.go +++ b/business/partner/purchase/ebai/ebai_test.go @@ -6,6 +6,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" + _ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman" _ "git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch" "git.rosy.net.cn/jx-callback/globals/testinit" ) diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 01ea3a6d4..c4dd53b9a 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -13,7 +13,9 @@ import ( func OnFinancialMsg(msg *ebaiapi.CallbackMsg) (err error) { if msg.Cmd == ebaiapi.CmdOrderPartRefund { // 部分退款处理 if utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"])) == ebaiapi.OrderPartRefundSuccess { + // 获取到部分退款订单id afsOrderID := utils.Interface2String(msg.Body["order_id"]) + // 处理部分退款信息 orderData, err2 := api.EbaiAPI.OrderPartrefundGet(afsOrderID) if err = err2; err == nil { afsOrder := CurPurchaseHandler.AfsOrderDetail2Financial(orderData) @@ -114,6 +116,14 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac globals.SugarLogger.Warnf("ebai AfsOrderDetail2Financial, afsOrderID:%s is not found from partner.CurOrderManager.LoadOrder", afsOrder.VendorOrderID) err = nil } + // 部分退款订单,第三方平台佣金会变化,金额为 orderData["commission"],是否将该字段更新到正向订单结算表中 + // 不作更新的话,商户可以得到的钱会少几毛钱,最终京西收益 + // 如果要更新,总佣金,京西佣金是否都要更新,而其它一系列连锁反应,是否需要考虑更新 + // 或者换个思路,不考虑变更之前的正向订单,在佣金上入手,退款金额减去佣金减少的部分 + orderFinancial, err := partner.CurOrderManager.LoadOrderFinancial(afsOrder.VendorOrderID, model.VendorIDEBAI) + if err == nil { + afsOrder.PmRefundMoney = orderFinancial.PmMoney - utils.MustInterface2Int64(orderData["commission"]) + } if orderData["refund_detail"] != nil { refundDetail := orderData["refund_detail"].([]interface{}) for _, refundInfo := range refundDetail { diff --git a/business/partner/purchase/ebai/financial_test.go b/business/partner/purchase/ebai/financial_test.go index 9e601de51..198272c13 100644 --- a/business/partner/purchase/ebai/financial_test.go +++ b/business/partner/purchase/ebai/financial_test.go @@ -7,20 +7,24 @@ import ( "time" "git.rosy.net.cn/baseapi/platformapi/ebaiapi" - "git.rosy.net.cn/baseapi/utils" ) func TestOnFinancialMsg(t *testing.T) { msg := &ebaiapi.CallbackMsg{ - // Cmd: "order.partrefund.push", - Cmd: "order.user.cancel", - Body: make(map[string]interface{}), + Timestamp: time.Now().Unix(), + Body: make(map[string]interface{}), } - msg.Body["refund_id"] = "15531567190216" - msg.Body["timestamp"] = utils.Int64ToStr(time.Now().Unix()) - // msg.Body["status"] = json.Number("20") - msg.Body["type"] = json.Number("40") - msg.Body["cancel_type"] = json.Number("2") + msg.Body["order_id"] = "1554939646172038357" + + // 部分退款 + msg.Cmd = "order.partrefund.push" + msg.Body["status"] = json.Number("20") + + // 全单退款 + // msg.Cmd = "order.user.cancel" + // msg.Body["type"] = json.Number("40") + // msg.Body["cancel_type"] = json.Number("2") + res := OnFinancialMsg(msg) fmt.Println(res) } From f54a8981037c516283807fda3e48e9d296cde018 Mon Sep 17 00:00:00 2001 From: renyutian Date: Wed, 24 Apr 2019 15:36:19 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8A=A5=E9=94=99=EF=BC=8C=E9=A5=BF=E7=99=BE=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E5=8D=95=E5=8E=BB=E5=8F=96=E6=AD=A3=E5=90=91=E5=8D=95=E6=AF=94?= =?UTF-8?q?=E5=AF=B9=E4=BD=A3=E9=87=91=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=EF=BC=8C=E6=8A=A5=E9=94=99=E3=80=82?= =?UTF-8?q?=E3=80=82=E3=80=82=E5=8F=96=E4=B8=8D=E5=88=B0=E4=BB=A3=E8=A1=A8?= =?UTF-8?q?=E6=BC=8F=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/financial.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index c4dd53b9a..8cb59a916 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -123,6 +123,10 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac orderFinancial, err := partner.CurOrderManager.LoadOrderFinancial(afsOrder.VendorOrderID, model.VendorIDEBAI) if err == nil { afsOrder.PmRefundMoney = orderFinancial.PmMoney - utils.MustInterface2Int64(orderData["commission"]) + } else { + // 此处应该报错 + globals.SugarLogger.Warnf("ebai AfsOrderDetail2Financial, afsOrderID:%s is not found from partner.CurOrderManager.LoadOrderFinancial", afsOrder.VendorOrderID) + err = nil } if orderData["refund_detail"] != nil { refundDetail := orderData["refund_detail"].([]interface{}) From b9112379dfefd489852ca6a81b82a2a408d1a7a2 Mon Sep 17 00:00:00 2001 From: renyutian Date: Wed, 24 Apr 2019 16:04:29 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E7=94=B1=E4=BA=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=99=8D=E7=BA=A7=E8=80=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=BB=93=E8=B4=A6=E6=95=B0=E6=8D=AE=E6=9C=89=E8=AF=AF=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/financial.go | 13 ++++++++++++- business/partner/purchase/ebai/financial_test.go | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 8cb59a916..ebb444b0a 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -161,10 +161,21 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac // 存储饿百正向订单结账信息 func (p *PurchaseHandler) OnOrderDetail(result map[string]interface{}, operation string) (err error) { - err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(result), operation) + err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(p.GetTrueEbaiOrder(result)), operation) return err } +func (p *PurchaseHandler) GetTrueEbaiOrder(result1 map[string]interface{}) (result2 map[string]interface{}) { + order := result1["order"].(map[string]interface{}) + if utils.MustInterface2Int64(order["down_flag"]) == 1 { + result, err := api.EbaiAPI.OrderGet(utils.Interface2String(order["order_id"])) + if err == nil { + return p.GetTrueEbaiOrder(result) + } + } + return result1 +} + func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) (orderFinancial *model.OrderFinancial) { orderFinancial = &model.OrderFinancial{ VendorID: model.VendorIDEBAI, diff --git a/business/partner/purchase/ebai/financial_test.go b/business/partner/purchase/ebai/financial_test.go index 198272c13..723ec6e75 100644 --- a/business/partner/purchase/ebai/financial_test.go +++ b/business/partner/purchase/ebai/financial_test.go @@ -7,6 +7,8 @@ import ( "time" "git.rosy.net.cn/baseapi/platformapi/ebaiapi" + "git.rosy.net.cn/jx-callback/business/partner" + "git.rosy.net.cn/jx-callback/globals/api" ) func TestOnFinancialMsg(t *testing.T) { @@ -28,3 +30,11 @@ func TestOnFinancialMsg(t *testing.T) { res := OnFinancialMsg(msg) fmt.Println(res) } + +func TestOnOrderDetail(t *testing.T) { + orderID := "1554939646172038357" + result, err := api.EbaiAPI.OrderGet(orderID) + if err == nil { + new(PurchaseHandler).OnOrderDetail(result, partner.CreatedPeration) + } +} From dcb912242592beda40800733d2bb52c0b4be6c2b Mon Sep 17 00:00:00 2001 From: renyutian Date: Wed, 24 Apr 2019 17:02:42 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BA=AC=E8=A5=BF?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=B4=B9=E6=97=B6=EF=BC=8C=E9=87=87=E7=94=A8?= =?UTF-8?q?=E5=9B=9B=E8=88=8D=E4=BA=94=E5=85=A5=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/financial.go | 4 ++-- business/partner/purchase/ebai/financial.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxcallback/orderman/financial.go b/business/jxcallback/orderman/financial.go index e3718efc1..1647af77a 100644 --- a/business/jxcallback/orderman/financial.go +++ b/business/jxcallback/orderman/financial.go @@ -62,8 +62,8 @@ func (c *OrderManager) SaveOrderFinancialInfo(order *model.OrderFinancial, opera } } order.ShopMoneyByCal = order.SalePriceMoney - order.TotalDiscountMoney - order.PointsDeductionMoney + order.PmFreightDiscountMoney - order.DistanceFreightMoney - order.FreightTipsMoney - order.DonationMoney + order.SelfDeliveryDiscountMoney + order.PmSubsidyMoney + order.SkuBoxMoney + order.BoxMoney - order.PmMoney - order.JxPmMoney = (order.ShopMoney+order.PmMoney)*TotalRate/1000 - order.PmMoney // 京西平台费 = 总金额*20%-第三方平台费 - if order.JxPmMoney < 0 { // 如果算出京西平台费为负数,则置0 + order.JxPmMoney = utils.Float64TwoInt64(float64(order.ShopMoney+order.PmMoney)*TotalRate/1000) - order.PmMoney // 京西平台费 = 总金额*20%-第三方平台费 + if order.JxPmMoney < 0 { // 如果算出京西平台费为负数,则置0 order.JxPmMoney = 0 } diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index ebb444b0a..a3b375964 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -117,7 +117,7 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac err = nil } // 部分退款订单,第三方平台佣金会变化,金额为 orderData["commission"],是否将该字段更新到正向订单结算表中 - // 不作更新的话,商户可以得到的钱会少几毛钱,最终京西收益 + // 不作更新的话,商户可以得到的钱会少几毛钱,最终京西受益 // 如果要更新,总佣金,京西佣金是否都要更新,而其它一系列连锁反应,是否需要考虑更新 // 或者换个思路,不考虑变更之前的正向订单,在佣金上入手,退款金额减去佣金减少的部分 orderFinancial, err := partner.CurOrderManager.LoadOrderFinancial(afsOrder.VendorOrderID, model.VendorIDEBAI) From 9000937294cb78e0bbc1253ae9765913ad2c1336 Mon Sep 17 00:00:00 2001 From: renyutian Date: Sun, 28 Apr 2019 16:04:27 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=99=8D=E7=BA=A7=E5=8F=B7=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/order_financial.go | 1 + business/partner/purchase/ebai/financial.go | 23 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/business/model/order_financial.go b/business/model/order_financial.go index 5eb38bef3..d92c493a4 100644 --- a/business/model/order_financial.go +++ b/business/model/order_financial.go @@ -36,6 +36,7 @@ type OrderFinancial struct { JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴 JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴给单条sku的金额 JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M + DownFlag int64 `json:"downFlag"` // 0--正常单, 1--降级单 Skus []*OrderSkuFinancial `orm:"-" json:"skus"` // 正向订单购买商品列表 Discounts []*OrderDiscountFinancial `orm:"-" json:"discounts"` // 正向订单享受优惠列表 } diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index a3b375964..015b4c691 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -161,20 +161,20 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac // 存储饿百正向订单结账信息 func (p *PurchaseHandler) OnOrderDetail(result map[string]interface{}, operation string) (err error) { - err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(p.GetTrueEbaiOrder(result)), operation) + err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(result), operation) return err } -func (p *PurchaseHandler) GetTrueEbaiOrder(result1 map[string]interface{}) (result2 map[string]interface{}) { - order := result1["order"].(map[string]interface{}) - if utils.MustInterface2Int64(order["down_flag"]) == 1 { - result, err := api.EbaiAPI.OrderGet(utils.Interface2String(order["order_id"])) - if err == nil { - return p.GetTrueEbaiOrder(result) - } - } - return result1 -} +// func (p *PurchaseHandler) GetTrueEbaiOrder(result1 map[string]interface{}) (result2 map[string]interface{}) { +// order := result1["order"].(map[string]interface{}) +// if utils.MustInterface2Int64(order["down_flag"]) == 1 { +// result, err := api.EbaiAPI.OrderGet(utils.Interface2String(order["order_id"])) +// if err == nil { +// return p.GetTrueEbaiOrder(result) +// } +// } +// return result1 +// } func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) (orderFinancial *model.OrderFinancial) { orderFinancial = &model.OrderFinancial{ @@ -186,6 +186,7 @@ func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) ( // orderFinancial.DeliveryConfirmTime = getTimeFromInterface(order1["finished_time"]) orderFinancial.TotalDiscountMoney = utils.MustInterface2Int64(order1["discount_fee"]) orderFinancial.ReceivableFreight = utils.MustInterface2Int64(order1["send_fee"]) + orderFinancial.DownFlag = utils.MustInterface2Int64(order1["down_flag"]) if int(getInt64FromInterface(order1["delivery_party"])) == ebaiapi.SendImmediatelySelf { orderFinancial.SelfDeliveryDiscountMoney = orderFinancial.ReceivableFreight From 54854f05b5feb11b22f3b3ddbfe7a999d2624e1a Mon Sep 17 00:00:00 2001 From: renyutian Date: Sun, 28 Apr 2019 16:35:14 +0800 Subject: [PATCH 7/7] down_flag --- business/model/order_financial.go | 2 +- business/partner/purchase/ebai/financial.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/model/order_financial.go b/business/model/order_financial.go index d92c493a4..28ab408c9 100644 --- a/business/model/order_financial.go +++ b/business/model/order_financial.go @@ -36,7 +36,7 @@ type OrderFinancial struct { JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴 JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴给单条sku的金额 JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M - DownFlag int64 `json:"downFlag"` // 0--正常单, 1--降级单 + DownFlag int8 `json:"downFlag"` // 0--正常单, 1--降级单 Skus []*OrderSkuFinancial `orm:"-" json:"skus"` // 正向订单购买商品列表 Discounts []*OrderDiscountFinancial `orm:"-" json:"discounts"` // 正向订单享受优惠列表 } diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 015b4c691..12a986ddc 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -186,7 +186,7 @@ func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) ( // orderFinancial.DeliveryConfirmTime = getTimeFromInterface(order1["finished_time"]) orderFinancial.TotalDiscountMoney = utils.MustInterface2Int64(order1["discount_fee"]) orderFinancial.ReceivableFreight = utils.MustInterface2Int64(order1["send_fee"]) - orderFinancial.DownFlag = utils.MustInterface2Int64(order1["down_flag"]) + orderFinancial.DownFlag = int8(utils.MustInterface2Int64(order1["down_flag"])) if int(getInt64FromInterface(order1["delivery_party"])) == ebaiapi.SendImmediatelySelf { orderFinancial.SelfDeliveryDiscountMoney = orderFinancial.ReceivableFreight