From 571e28abc0f2ee468e138e7920a06f435fb7b293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 08:44:58 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 70 ++++++++++++++++------------------- business/jxstore/misc/misc.go | 6 ++- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 19dd6dfd9..4cc0b1726 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1098,8 +1098,8 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i var ( db = dao.GetDB() ) - storeSkus, _ := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil) - _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步京东商城库存商品信息:%v", storeIDs), isAsync, true, []int{model.VendorIDJDShop}, storeIDs, false, + // storeSkus, _ := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil) + _, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步京东商城门店的可售信息:%v", storeIDs), isAsync, true, []int{model.VendorIDJDShop}, storeIDs, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { @@ -1107,7 +1107,7 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i if storeMap.Status > model.StoreStatusDisabled && storeMap.StoreID != model.JdShopMainStoreID && storeMap.SyncRule != 0 { err = syncJdsStoresSkus(ctx, db, t, storeMap, isAsync, isContinueWhenError) } - err = syncJdsStoreStock(ctx, db, t, storeSkus, storeMap, isAsync, isContinueWhenError) + // err = syncJdsStoreStock(ctx, db, t, storeSkus, storeMap, isAsync, isContinueWhenError) } } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) @@ -1115,44 +1115,36 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i return hint, err } -func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeSkus []*model.StoreSkuBind, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) { - // for _, storeSku := range storeSkus { - // stock := 0 - // storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) - // if storeSku.JdsID != 0 { - // if len(storeSku2) > 0 { - // if storeSku2[0].Status == model.StoreSkuBindStatusNormal && storeSku.Status == model.StoreSkuBindStatusNormal { - // stock = 9999 - // } - // if storeMap.VendorStoreID != "" { - // err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) - // } - // } else { - // err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID)) - // } - // } - // } - task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError).SetParallelCount(1), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - storeSku := batchItemList[0].(*model.StoreSkuBind) - stock := 0 - storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) - if storeSku.JdsID != 0 { - if len(storeSku2) > 0 { - if storeSku2[0].Status == model.StoreSkuBindStatusNormal && storeSku.Status == model.StoreSkuBindStatusNormal { - stock = 9999 +func SyncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, isAsync, isContinueWhenError bool) (err error) { + storeMaps, err := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") + if err != nil { + return err + } + storeSkus, err := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil) + if err != nil { + return err + } + for _, storeMap := range storeMaps { + task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError).SetParallelCount(1), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + storeSku := batchItemList[0].(*model.StoreSkuBind) + stock := 0 + storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) + if storeSku.JdsID != 0 { + if len(storeSku2) > 0 { + if storeSku2[0].Status == model.StoreSkuBindStatusNormal && storeSku.Status == model.StoreSkuBindStatusNormal { + stock = 9999 + } + if storeMap.VendorStoreID != "" { + err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) + } + } else { + err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID)) } - if storeMap.VendorStoreID != "" { - err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) - } - } else { - err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID)) } - } - return retVal, err - }, storeSkus) - tasksch.HandleTask(task, parentTask, true).Run() - if !isAsync { + return retVal, err + }, storeSkus) + tasksch.HandleTask(task, parentTask, true).Run() _, err = task.GetResult(0) } return err diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 3670ef0c5..93869eff9 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -46,7 +46,7 @@ var ( "20:30:00", } dailyWorkTimeList2 = []string{ - "18:30:00", + "02:00:00", } priceReferTimeList = []string{ "03:00:00", @@ -383,8 +383,10 @@ func syncStoreSku() { func doDailyWork2() { globals.SugarLogger.Debug("doDailyWork2") - //同步京东商城门店库存和商品 + //同步京东商城门店的商品 cms.CurVendorSync.SyncJdsStoresSkus(jxcontext.AdminCtx, nil, true, true) + //刷新京东商城的门店库存 + cms.SyncJdsStoreStock(jxcontext.AdminCtx, dao.GetDB(), nil, true, true) } func doDailyWork() { From 115a961d076c494f1e359a91e1021375bb82cfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 09:06:14 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=B8=8D=E5=9C=A8?= =?UTF-8?q?=E8=90=A5=E4=B8=9A=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E5=86=85?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch_ext.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 8dd8af124..7d02055dd 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -97,12 +97,12 @@ func (s *DefScheduler) canOrderCreateWaybillNormally(order *model.GoodsOrder, sa time3 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime2, time.Now()) time4 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime2, time.Now()) if time.Now().Sub(time3) < 0 || time.Now().Sub(time4) > 0 { - globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内1!", order.VendorOrderID) - return fmt.Errorf("不在门店营业时间范围内!") + // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内1!", order.VendorOrderID) + err = fmt.Errorf("不在门店营业时间范围内!") } } else { - globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内2!", order.VendorOrderID) - return fmt.Errorf("不在门店营业时间范围内!") + // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内2!", order.VendorOrderID) + err = fmt.Errorf("不在门店营业时间范围内!") } } } From 1161b44c4d2e65bdaa7fe0ae4d067a51ab8fced7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 09:17:17 +0800 Subject: [PATCH 03/11] =?UTF-8?q?pushgy=E8=A7=82=E5=AF=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/waybill.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 6b814c520..bab269c74 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -130,6 +130,7 @@ func (c *DeliveryHandler) pushToGy(msg *mtpsapi.CallbackOrderMsg) { urls := utils.Map2URLValues(params) sign := signParams(urls) params["sign"] = sign + globals.SugarLogger.Debugf("pushToGy", utils.Format4Output(msg, false)) request, err := http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/mtps/status", strings.NewReader(utils.Map2URLValues(params).Encode())) if err != nil { return From c4ea35efa03a59efba3fd2a84ccdac3438e8041d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 10:35:00 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=90=A5=E4=B8=9A?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/orderman_ext.go | 5 +++++ business/model/dao/dao_order.go | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 044ef4745..bba87c154 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -698,6 +698,9 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID } saleInfoMap[index] = saleInfo } + if v.EarningType == model.EarningTypeQuote { + saleInfo.RealEarningPrice += v.ShopPrice * int64(v.Count) + } saleInfo.ShopPrice += v.ShopPrice * int64(v.Count) saleInfo.VendorPrice += v.VendorPrice * int64(v.Count) saleInfo.SalePrice += v.SalePrice * int64(v.Count) @@ -705,10 +708,12 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID if v.VendorOrderID == flagVendorOrderID { if k == 0 { saleInfo.EarningPrice = v.NewEarningPrice + saleInfo.RealEarningPrice += v.NewEarningPrice } } else { flagVendorOrderID = v.VendorOrderID saleInfo.EarningPrice += v.NewEarningPrice + saleInfo.RealEarningPrice += v.NewEarningPrice } universalOrderID := jxutils.ComposeUniversalOrderID(v.VendorOrderID, v.VendorID) diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index d2198f926..b85b302af 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -31,6 +31,8 @@ type StoresOrderSaleInfo struct { DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值) WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费 + + RealEarningPrice int64 `json:"realEarningPrice"` } type OrderSkuWithActualPayPrice struct { @@ -45,6 +47,7 @@ type OrderSkuWithActualPayPrice struct { PayPercentage int `json:"payPercentage"` NewEarningPrice int64 `json:"newEarningPrice"` + EarningType int `json:"earningType"` } type tGoodsAndOrder struct { @@ -373,7 +376,7 @@ func GetStoreOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAt sql := ` SELECT t1.*, IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) store_id, t2.status, t2.actual_pay_price, t2.distance_freight_money, t2.waybill_tip_money, t2.new_earning_price, - t3.pay_percentage + t3.pay_percentage, t2.earning_type FROM order_sku t1 JOIN goods_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id LEFT JOIN store t3 ON t3.id = IF(t2.jx_store_id > 0, t2.jx_store_id, t2.store_id) From 3943fa93140f0cb7cbbafe402b4067141358e2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 11:55:52 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E8=90=A5=E4=B8=9A=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/orderman_ext.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index bba87c154..d65d4b612 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -708,12 +708,16 @@ func (c *OrderManager) GetStoresOrderSaleInfoNew(ctx *jxcontext.Context, storeID if v.VendorOrderID == flagVendorOrderID { if k == 0 { saleInfo.EarningPrice = v.NewEarningPrice - saleInfo.RealEarningPrice += v.NewEarningPrice + if v.EarningType == model.EarningTypePoints { + saleInfo.RealEarningPrice += v.NewEarningPrice + } } } else { flagVendorOrderID = v.VendorOrderID saleInfo.EarningPrice += v.NewEarningPrice - saleInfo.RealEarningPrice += v.NewEarningPrice + if v.EarningType == model.EarningTypePoints { + saleInfo.RealEarningPrice += v.NewEarningPrice + } } universalOrderID := jxutils.ComposeUniversalOrderID(v.VendorOrderID, v.VendorID) From c8d921a74f4d43b0b8edd91904610baa1fb03de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 14:22:45 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=8F=91=E5=88=B0=E5=93=AA=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=E9=97=A8=E5=BA=97=E8=90=A5=E4=B8=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jxcallback/scheduler/defsch/defsch_ext.go | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 7d02055dd..9ad7f3e83 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -89,20 +89,22 @@ func (s *DefScheduler) canOrderCreateWaybillNormally(order *model.GoodsOrder, sa } if savedOrderInfo != nil { //TODO 2020-07-21 发单时间要在门店的营业时间内 - if savedOrderInfo.storeDetail.OpenTime1 != 0 && savedOrderInfo.storeDetail.CloseTime1 != 0 { - time1 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime1, time.Now()) - time2 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime1, time.Now()) - if time.Now().Sub(time1) < 0 || time.Now().Sub(time2) > 0 { - if savedOrderInfo.storeDetail.OpenTime2 != 0 && savedOrderInfo.storeDetail.CloseTime2 != 0 { - time3 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime2, time.Now()) - time4 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime2, time.Now()) - if time.Now().Sub(time3) < 0 || time.Now().Sub(time4) > 0 { - // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内1!", order.VendorOrderID) + if savedOrderInfo.storeDetail != nil { + if savedOrderInfo.storeDetail.OpenTime1 != 0 && savedOrderInfo.storeDetail.CloseTime1 != 0 { + time1 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime1, time.Now()) + time2 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime1, time.Now()) + if time.Now().Sub(time1) < 0 || time.Now().Sub(time2) > 0 { + if savedOrderInfo.storeDetail.OpenTime2 != 0 && savedOrderInfo.storeDetail.CloseTime2 != 0 { + time3 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.OpenTime2, time.Now()) + time4 := jxutils.JxOperationTime2TimeByDate(savedOrderInfo.storeDetail.CloseTime2, time.Now()) + if time.Now().Sub(time3) < 0 || time.Now().Sub(time4) > 0 { + // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内1!", order.VendorOrderID) + err = fmt.Errorf("不在门店营业时间范围内!") + } + } else { + // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内2!", order.VendorOrderID) err = fmt.Errorf("不在门店营业时间范围内!") } - } else { - // globals.SugarLogger.Warnf("createWaybillOn3rdProviders return orderID: %s,不在门店营业时间范围内2!", order.VendorOrderID) - err = fmt.Errorf("不在门店营业时间范围内!") } } } From 2f00f49849d8c84b9ea9c17a9816ffa117282c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 17:34:03 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E9=BC=8E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index af60425aa..d2e0b602d 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -1,11 +1,14 @@ package jdshop import ( + "fmt" + "git.rosy.net.cn/baseapi/platformapi/jdshopapi" + "git.rosy.net.cn/baseapi/utils" ) func OnCallbackMsg(msg *jdshopapi.CallBackResult) { - // fmt.Println("testcallback", utils.Format4Output(msg, false)) + fmt.Println("testcallback", utils.Format4Output(msg, false)) // if CurPurchaseHandler != nil { // if msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged { // response = CurPurchaseHandler.onStoreStatusChanged(msg) From e6381eca6a3434f29c778a6016dc089106ea9249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 17:37:23 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E9=BC=8E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/callback.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index d2e0b602d..797d0a3f5 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -7,7 +7,7 @@ import ( "git.rosy.net.cn/baseapi/utils" ) -func OnCallbackMsg(msg *jdshopapi.CallBackResult) { +func OnCallbackMsg(msg *jdshopapi.GetOrderResult) { fmt.Println("testcallback", utils.Format4Output(msg, false)) // if CurPurchaseHandler != nil { // if msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged { From 8971f78fe7aad4ba160b4d72e45b5f9c72d6ef11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 18:19:48 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/jds_callback.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/controllers/jds_callback.go b/controllers/jds_callback.go index af05c996d..35bfb65b3 100644 --- a/controllers/jds_callback.go +++ b/controllers/jds_callback.go @@ -2,7 +2,6 @@ package controllers import ( "bytes" - "fmt" "io/ioutil" "net/http" @@ -19,7 +18,6 @@ type JdsController struct { } func (c *JdsController) Msg() { - fmt.Println("testjdscll") if c.Ctx.Input.Method() == http.MethodPost { ctx := c.Ctx ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody)) From 8862d00d1830b85b47a9fdd437df85843bdf6bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 28 Jul 2020 18:28:53 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=95=B4=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 327f28075..afe67673b 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -591,9 +591,9 @@ func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder { func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *model.GoodsOrder { if order.EarningType == model.EarningTypePoints { if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX { - order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100 - } else { order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100 + } else { + order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100 } } else { order.NewEarningPrice = order.EarningPrice From e721482608fce71a33fe52e2a5fd4ee28d7dc282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 29 Jul 2020 11:43:17 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jd/order.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index d6b301726..f13e25557 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -155,17 +155,21 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi. func updateOrderBySettleMent(order *model.GoodsOrder, orderSettlement *jdapi.OrderSettlementInfo) { if orderSettlement != nil { - // order.WaybillTipMoney = orderSettlement.VenderPaidTips order.TotalShopMoney = orderSettlement.SettlementAmount order.PmSubsidyMoney = orderSettlement.PlatOrderGoodsDiscountMoney + orderSettlement.PlatSkuGoodsDiscountMoney if order.TotalShopMoney > 0 { - order2, err := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID) - if order2 != nil && err == nil { - storeDetail, err := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order2), order.VendorID) + if jxutils.GetSaleStoreIDFromOrder(order) != 0 { + storeDetail, err := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) if storeDetail != nil && err == nil { jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage) - } else { - globals.SugarLogger.Warnf("updateOrderBySettleMent,%v,%v,%v", order.VendorOrderID, orderSettlement.SettlementAmount) + } + } else { + order2, err := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID) + if order2 != nil && err == nil { + storeDetail, err := partner.CurOrderManager.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order2), order.VendorID) + if storeDetail != nil && err == nil { + jxutils.RefreshOrderEarningPrice2(order, storeDetail.PayPercentage) + } } } } else {