From 284f1cd4425bc5218630fc257f8a9e6e41067545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 5 Jun 2020 14:08:59 +0800 Subject: [PATCH 001/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=8E=A8=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b8254c1d3..92a13d8f2 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1016,7 +1016,9 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti } orders, err := result2Orders(ctx, orderResult) for _, order := range orders { - // partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) + order.StoreID = 102919 + order.StoreName = "商城模板(成都发货)" + partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) globals.SugarLogger.Debugf("SaveJdsOrders, order: [%v]", utils.Format4Output(order, false)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "京东商城来新订单了!", noticeMsg) @@ -1058,6 +1060,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o ActualPayPrice: orderDetail.ActualPayPrice, Status: model.OrderStatusNew, TotalShopMoney: utils.Float64TwoInt64(math.Round(utils.Int64ToFloat64(orderDetail.ActualPayPrice) * jdshopapi.JdsPayPercentage)), + DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled, } //获取真实手机号 fakeMobile, err := api.JdShopAPI.PhoneSensltiveInfo(order.VendorOrderID2, orderDetail.MobileKey) From 7c935624925c258d2e211667cb9622b839ffa194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 5 Jun 2020 14:42:42 +0800 Subject: [PATCH 002/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8Esta?= =?UTF-8?q?tustime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 92a13d8f2..c1d2e1206 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1061,6 +1061,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o Status: model.OrderStatusNew, TotalShopMoney: utils.Float64TwoInt64(math.Round(utils.Int64ToFloat64(orderDetail.ActualPayPrice) * jdshopapi.JdsPayPercentage)), DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled, + StatusTime: utils.Str2Time(jdsOrder.OrderCreateTime + ":00"), } //获取真实手机号 fakeMobile, err := api.JdShopAPI.PhoneSensltiveInfo(order.VendorOrderID2, orderDetail.MobileKey) From 118ade975335431efd0797fd73cefd4b65e6c2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 5 Jun 2020 15:04:07 +0800 Subject: [PATCH 003/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index c1d2e1206..030095ca1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1017,7 +1017,9 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti orders, err := result2Orders(ctx, orderResult) for _, order := range orders { order.StoreID = 102919 + order.JxStoreID = 102919 order.StoreName = "商城模板(成都发货)" + order.VendorStoreID = model.JdShopMainVendorStoreID partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) globals.SugarLogger.Debugf("SaveJdsOrders, order: [%v]", utils.Format4Output(order, false)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) From 051575bd559b6c43dbc535d8ee5cad6d25d26511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 5 Jun 2020 15:09:35 +0800 Subject: [PATCH 004/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9A=82=E6=97=B6=E4=B8=8D=E5=8F=91=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 94c9ad097..6080c5bc4 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1384,9 +1384,11 @@ func (s *DefScheduler) notifyNewOrder(order *model.GoodsOrder) { } else { weixinmsg.NotifyNewOrder(order) } - smsmsg.NotifyNewOrder(order) OrderProfitWarning(order) - smsmsg.NotifyNewUserOrder(order) + if order.VendorID != model.VendorIDJDShop { + smsmsg.NotifyNewOrder(order) + smsmsg.NotifyNewUserOrder(order) + } }) } } From 76977a56edf6e0074028c0665dee5075d50c6f68 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Sun, 7 Jun 2020 20:11:35 +0800 Subject: [PATCH 005/152] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=85=B3=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 88538c5e4..ba0396db0 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -393,7 +393,7 @@ func doDailyWork() { dao.SetStoresMapSyncStatus(dao.GetDB(), nil, nil, model.SyncFlagStoreStatus) cms.CurVendorSync.SyncStore2(jxcontext.AdminCtx, dao.GetDB(), nil, nil, true, true) - syncStoreSku() + // syncStoreSku() InitEx() cms.SyncStoresCourierInfo(jxcontext.AdminCtx, nil, false, true) netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true) From 42f6c7426d8ae9fc13c112077a09394681387ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 11:42:34 +0800 Subject: [PATCH 006/152] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 71 ++++++++++++++++++--------------- business/jxstore/misc/misc.go | 2 +- business/model/dao/store_sku.go | 8 +++- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index e85044885..32f34ba0e 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1092,21 +1092,11 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { - parallelCount := 5 - if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 { - parallelCount = 2 + for _, storeMap := range loopMapInfo.StoreMapList { + if storeMap.Status > model.StoreStatusDisabled && storeMap.StoreID != model.JdShopMainStoreID && storeMap.SyncRule != 0 { + err = syncJdsStoresSkus(ctx, db, nil, storeMap, isAsync, isContinueWhenError) + } } - loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), - tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - storeMap := batchItemList[0].(*model.StoreMap) - if storeMap.Status > model.StoreStatusDisabled && storeMap.StoreID != model.JdShopMainStoreID && storeMap.SyncRule != 0 { - err = syncJdsStoresSkus(ctx, db, task, storeMap, isAsync, isContinueWhenError) - } - return nil, err - }, loopMapInfo.StoreMapList) - t.AddChild(loopStoreTask).Run() - _, err = loopStoreTask.GetResult(0) } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) @@ -1115,28 +1105,47 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) { var ( - mainSkusMap = make(map[int]*model.StoreSkuBind) - skusMap = make(map[int]*model.StoreSkuBind) - updateList []*model.StoreSkuBind - addList []*model.StoreSkuBind + mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) + skusMap = make(map[int][]*dao.StoreSkuSyncInfo) + updateList []*dao.StoreSkuSyncInfo + addList []*dao.StoreSkuSyncInfo skuBindInfos1 []*StoreSkuBindInfo skuBindInfos2 []*StoreSkuBindInfo ) - storeSkusMain, err := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil) + storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0) for _, v := range storeSkusMain { - mainSkusMap[v.SkuID] = v + mainSkusMap[v.NameID] = append(mainSkusMap[v.NameID], v) } - storeSkus, err := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, nil) + storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 0) for _, v := range storeSkus { - skusMap[v.SkuID] = v - if mainSkusMap[v.SkuID] != nil && mainSkusMap[v.SkuID].Status != v.Status { - updateList = append(updateList, mainSkusMap[v.SkuID]) + skusMap[v.NameID] = append(mainSkusMap[v.NameID], v) + } + for k, v := range skusMap { + if mainSkusMap[k] != nil { + flag := false + for _, storeSku := range v { + if storeSku.StoreSkuStatus == model.StoreSkuBindStatusNormal { + flag = true + } + } + if !flag { + continue + } + for _, storeSku := range v { + for _, storeSkuMain := range mainSkusMap[k] { + if storeSkuMain.StoreSkuStatus == model.StoreSkuBindStatusNormal && storeSku.StoreSkuStatus == model.StoreSkuBindStatusDontSale { + updateList = append(updateList, storeSkuMain) + } + } + } } } for k, v := range mainSkusMap { if skusMap[k] == nil { if storeMap.SyncRule == 2 { - addList = append(addList, v) + for _, storeSkuMain := range v { + addList = append(addList, storeSkuMain) + } } } } @@ -1149,18 +1158,14 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch if len(addList) > 0 { for _, v := range addList { - skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) + skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) } _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) } return err } -func buildStoreSkuBindInfo(db *dao.DaoDB, storeID int, storeBind *model.StoreSkuBind, isFocus bool) (skuBindInfo *StoreSkuBindInfo) { - result, err := dao.GetSkus(db, []int{storeBind.SkuID}, nil, nil, nil, nil) - if err != nil || len(result) == 0 { - return nil - } +func buildStoreSkuBindInfo(db *dao.DaoDB, storeID int, storeBind *dao.StoreSkuSyncInfo, isFocus bool) (skuBindInfo *StoreSkuBindInfo) { skus := []*StoreSkuBindSkuInfo{ &StoreSkuBindSkuInfo{ SkuID: storeBind.SkuID, @@ -1168,12 +1173,12 @@ func buildStoreSkuBindInfo(db *dao.DaoDB, storeID int, storeBind *model.StoreSku } skuBindInfo = &StoreSkuBindInfo{ StoreID: storeID, - NameID: result[0].NameID, + NameID: storeBind.NameID, } if isFocus { skuBindInfo.IsFocus = 1 } - if storeBind.Status == model.SkuStatusNormal { + if storeBind.StoreSkuStatus == model.SkuStatusNormal { skus[0].IsSale = 1 } else { skus[0].IsSale = -1 diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index ba0396db0..88538c5e4 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -393,7 +393,7 @@ func doDailyWork() { dao.SetStoresMapSyncStatus(dao.GetDB(), nil, nil, model.SyncFlagStoreStatus) cms.CurVendorSync.SyncStore2(jxcontext.AdminCtx, dao.GetDB(), nil, nil, true, true) - // syncStoreSku() + syncStoreSku() InitEx() cms.SyncStoresCourierInfo(jxcontext.AdminCtx, nil, false, true) netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 404a477e4..af7bee441 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -965,17 +965,21 @@ func DeleteSkuNameExPrefixOverdue(db *DaoDB) (num int64, err error) { func GetStoreSkusByNameIDs(db *DaoDB, storeIDs []int, nameID int) (skuList []*StoreSkuSyncInfo, err error) { sql := ` - SELECT a.*,c.unit,c.name + SELECT a.*, c.unit, c.name, b.name_id, a.status store_sku_status FROM store_sku_bind a JOIN sku b ON a.sku_id = b.id JOIN sku_name c ON b.name_id = c.id - WHERE b.name_id = ? + WHERE 1=1 AND a.deleted_at = ? ` sqlParams := []interface{}{ nameID, utils.DefaultTimeValue, } + if nameID != 0 { + sql += " AND b.name_id = ?" + sqlParams = append(sqlParams, nameID) + } if len(storeIDs) > 0 { sql += " AND a.store_id in (" + GenQuestionMarks(len(storeIDs)) + ")" sqlParams = append(sqlParams, storeIDs) From 6d8e06ee9ad532b6d401bb91b2c359c444a7c6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 11:52:01 +0800 Subject: [PATCH 007/152] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 38 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 32f34ba0e..294716276 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1105,12 +1105,12 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) { var ( - mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) - skusMap = make(map[int][]*dao.StoreSkuSyncInfo) - updateList []*dao.StoreSkuSyncInfo - addList []*dao.StoreSkuSyncInfo - skuBindInfos1 []*StoreSkuBindInfo - skuBindInfos2 []*StoreSkuBindInfo + mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) + skusMap = make(map[int][]*dao.StoreSkuSyncInfo) + updateList []*dao.StoreSkuSyncInfo + addList []*dao.StoreSkuSyncInfo + // skuBindInfos1 []*StoreSkuBindInfo + // skuBindInfos2 []*StoreSkuBindInfo ) storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0) for _, v := range storeSkusMain { @@ -1149,19 +1149,21 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch } } } - if len(updateList) > 0 { - for _, v := range updateList { - skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) - } - _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) - } + fmt.Println("updateList", utils.Format4Output(updateList, false)) + fmt.Println("addList", utils.Format4Output(addList, false)) + // if len(updateList) > 0 { + // for _, v := range updateList { + // skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) + // } + // _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) + // } - if len(addList) > 0 { - for _, v := range addList { - skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) - } - _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) - } + // if len(addList) > 0 { + // for _, v := range addList { + // skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) + // } + // _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) + // } return err } From f70dc4fceb89da5ca601ff7fff40395d11e02527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 14:54:54 +0800 Subject: [PATCH 008/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index af7bee441..f45f1c6c2 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -973,7 +973,6 @@ func GetStoreSkusByNameIDs(db *DaoDB, storeIDs []int, nameID int) (skuList []*St AND a.deleted_at = ? ` sqlParams := []interface{}{ - nameID, utils.DefaultTimeValue, } if nameID != 0 { From 0b5341314b163eb0793147bc591400fe5c7787c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 17:37:40 +0800 Subject: [PATCH 009/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 40 ++++++++++++------------- business/partner/purchase/ebai/order.go | 1 + 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 294716276..5c0b5c7f5 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1105,12 +1105,12 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) { var ( - mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) - skusMap = make(map[int][]*dao.StoreSkuSyncInfo) - updateList []*dao.StoreSkuSyncInfo - addList []*dao.StoreSkuSyncInfo - // skuBindInfos1 []*StoreSkuBindInfo - // skuBindInfos2 []*StoreSkuBindInfo + mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) + skusMap = make(map[int][]*dao.StoreSkuSyncInfo) + updateList []*dao.StoreSkuSyncInfo + addList []*dao.StoreSkuSyncInfo + skuBindInfos1 []*StoreSkuBindInfo + skuBindInfos2 []*StoreSkuBindInfo ) storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0) for _, v := range storeSkusMain { @@ -1149,21 +1149,21 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch } } } - fmt.Println("updateList", utils.Format4Output(updateList, false)) - fmt.Println("addList", utils.Format4Output(addList, false)) - // if len(updateList) > 0 { - // for _, v := range updateList { - // skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) - // } - // _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) - // } + // fmt.Println("updateList", utils.Format4Output(updateList, false)) + // fmt.Println("addList", utils.Format4Output(addList, false)) + if len(updateList) > 0 { + for _, v := range updateList { + skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false)) + } + _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false) + } - // if len(addList) > 0 { - // for _, v := range addList { - // skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) - // } - // _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) - // } + if len(addList) > 0 { + for _, v := range addList { + skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true)) + } + _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false) + } return err } diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 067fbeb2d..ce6549398 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -134,6 +134,7 @@ func (p *PurchaseHandler) GetOrder4PartRefund(vendorOrderID string) (order *mode order.DiscountMoney = discountMoney order.Skus = append(order.Skus, giftSkus...) order.ActualPayPrice = utils.MustInterface2Int64(result2["user_fee"]) + order.TotalShopMoney = utils.MustInterface2Int64(result2["shop_fee"]) jxutils.RefreshOrderSkuRelated(order) } else if err2Ext, ok := err2.(*utils.ErrorWithCode); !ok || err2Ext.IntCode() != ebaiapi.ErrOrderIsNotPartRefund { err = err2 From d5c3f52f920c24fb0fead4e0b5be414b942c08d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 17:50:55 +0800 Subject: [PATCH 010/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 5c0b5c7f5..9138ac29b 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1118,7 +1118,7 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch } storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 0) for _, v := range storeSkus { - skusMap[v.NameID] = append(mainSkusMap[v.NameID], v) + skusMap[v.NameID] = append(skusMap[v.NameID], v) } for k, v := range skusMap { if mainSkusMap[k] != nil { From f29c9514f0ff46ef7510a03d23cb8a54c522d452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 18:10:54 +0800 Subject: [PATCH 011/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 9138ac29b..0d9f799cd 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1112,11 +1112,11 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch skuBindInfos1 []*StoreSkuBindInfo skuBindInfos2 []*StoreSkuBindInfo ) - storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0) + storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 11433) for _, v := range storeSkusMain { mainSkusMap[v.NameID] = append(mainSkusMap[v.NameID], v) } - storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 0) + storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 11433) for _, v := range storeSkus { skusMap[v.NameID] = append(skusMap[v.NameID], v) } @@ -1134,6 +1134,7 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch for _, storeSku := range v { for _, storeSkuMain := range mainSkusMap[k] { if storeSkuMain.StoreSkuStatus == model.StoreSkuBindStatusNormal && storeSku.StoreSkuStatus == model.StoreSkuBindStatusDontSale { + fmt.Println("test1", utils.Format4Output(storeSkuMain, false)) updateList = append(updateList, storeSkuMain) } } From 99882198898d356d9548cc77efb5b34e1cb9f524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 18:16:43 +0800 Subject: [PATCH 012/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 0d9f799cd..0b56e32c7 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1133,7 +1133,8 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch } for _, storeSku := range v { for _, storeSkuMain := range mainSkusMap[k] { - if storeSkuMain.StoreSkuStatus == model.StoreSkuBindStatusNormal && storeSku.StoreSkuStatus == model.StoreSkuBindStatusDontSale { + if storeSkuMain.StoreSkuStatus == model.StoreSkuBindStatusNormal && storeSku.StoreSkuStatus == model.StoreSkuBindStatusDontSale && + storeSkuMain.SkuID == storeSku.SkuID { fmt.Println("test1", utils.Format4Output(storeSkuMain, false)) updateList = append(updateList, storeSkuMain) } From aa58117e650e3727aacdaf44eef2152d0ffb7c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Jun 2020 19:48:24 +0800 Subject: [PATCH 013/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=8F=A4=E5=95=86?= =?UTF-8?q?=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 0b56e32c7..7847ed885 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1135,7 +1135,6 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch for _, storeSkuMain := range mainSkusMap[k] { if storeSkuMain.StoreSkuStatus == model.StoreSkuBindStatusNormal && storeSku.StoreSkuStatus == model.StoreSkuBindStatusDontSale && storeSkuMain.SkuID == storeSku.SkuID { - fmt.Println("test1", utils.Format4Output(storeSkuMain, false)) updateList = append(updateList, storeSkuMain) } } From cd013169c0e20c8cf3651d9c378934b1e5f601a6 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, 9 Jun 2020 10:03:17 +0800 Subject: [PATCH 014/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 3 --- business/partner/purchase/jdshop/store_sku.go | 2 +- main.go | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 030095ca1..eba84c152 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -434,9 +434,6 @@ func updateSingleOrderEarningPrice(order *model.GoodsOrder, db *dao.DaoDB) { } } if len(skuIDMap) > 0 { - if order.VendorOrderID == "5000356075877900459" { - fmt.Println("testupdateSingleOrderEarningPrice", order.VendorOrderID) - } actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, []int{order.VendorID}, model.ActTypeAll, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt) if err != nil { globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index c824cb56d..2978c7500 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -773,7 +773,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf multiPropSku []*jdshopapi.CreateSkuParamAttrs ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit + specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID diff --git a/main.go b/main.go index 59532647a..88dbd1969 100644 --- a/main.go +++ b/main.go @@ -146,6 +146,7 @@ func main() { } orderman.LoadPendingOrders() + orderman.SaveJdsOrders(nil, time.Now().Add(-2*time.Hour), time.Now()) // 延时的原因是等回调准备好 if globals.IsProductEnv() || beego.BConfig.RunMode == "beta" { From 71921160970796117d1e5a6bd65819b805f1a2eb 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, 9 Jun 2020 10:15:58 +0800 Subject: [PATCH 015/152] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=AF=94=E4=BE=8B?= =?UTF-8?q?=E4=BD=8E=E4=BA=8E50=E7=9A=84=E9=97=A8=E5=BA=97=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=9B=B4=E6=8E=A5=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 7 +++++++ business/partner/purchase/jdshop/store_sku.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index eb46d94c1..700488c08 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4504,6 +4504,13 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto time.Sleep(time.Second / 5) db := dao.GetDB() for _, storeID := range storeIDs { + stores, _ := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") + if len(stores) > 0 { + if stores[0].PayPercentage <= 50 { + globals.SugarLogger.Debugf("doStoreSkuAudit return0 storeID : %v", storeID) + return false, err + } + } for _, skuBindInfo := range skuBindInfos { globals.SugarLogger.Debugf("doStoreSkuAudit storeID: %v , nameID: %v", storeID, skuBindInfo.NameID) storeAudits, err := dao.GetStoreSkuAuditLight(db, []int{storeID}, []int{skuBindInfo.NameID}, model.StoreAuditStatusOnline) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 2978c7500..044cb0997 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -662,7 +662,7 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j multiPropSku []*jdshopapi.CreateSkuParamAttrs ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit + specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID From 5ea4cc0d27caf0443198b5e6b19f1a6e2ef68ad0 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, 9 Jun 2020 10:22:46 +0800 Subject: [PATCH 016/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 044cb0997..583ff026c 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -663,6 +663,9 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + if v.Comment != "" { + specQuality += " " + v.Comment + } for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID @@ -774,6 +777,9 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + if v.Comment != "" { + specQuality += " " + v.Comment + } for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID From d0d8817313939e89f070ba1e63bea2c45e69f5f4 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, 9 Jun 2020 10:26:38 +0800 Subject: [PATCH 017/152] =?UTF-8?q?beta=E7=82=B8=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 88dbd1969..9485047cf 100644 --- a/main.go +++ b/main.go @@ -143,10 +143,12 @@ func main() { if err := tasks.RefreshYilianyunToken(); err != nil { globals.SugarLogger.Errorf("RefreshYilianyunToken failed with error:%s", err) return - } + } + if globals.IsProductEnv() { + orderman.SaveJdsOrders(nil, time.Now().Add(-2*time.Hour), time.Now()) + } orderman.LoadPendingOrders() - orderman.SaveJdsOrders(nil, time.Now().Add(-2*time.Hour), time.Now()) // 延时的原因是等回调准备好 if globals.IsProductEnv() || beego.BConfig.RunMode == "beta" { From 93cd4b688f175794a018236f0e33255d04e1eadc 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, 9 Jun 2020 10:30:27 +0800 Subject: [PATCH 018/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=8B=89=E8=AE=A2=E5=8D=95=E6=8A=A5=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index eba84c152..43af66488 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1009,7 +1009,7 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti noticeMsg := fmt.Sprintf("京东商城保存订单出错!(多半是cookie过期了),err :[%v]", err) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "cookie", noticeMsg) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "1439B3E07D3911EA881A525400E86DC0", "cookie", noticeMsg) - globals.SugarLogger.Errorf("SaveJdsOrders : %v", err) + return err } orders, err := result2Orders(ctx, orderResult) for _, order := range orders { From 3b2843aeb30f1641bc7357844c7a54b2d1339414 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, 9 Jun 2020 10:45:00 +0800 Subject: [PATCH 019/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=EF=BC=8C=E8=AE=A2=E5=8D=95=E8=AF=95=E8=AF=95=E5=88=B0=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 43af66488..6fc521c88 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -355,7 +355,13 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. if intVendorSkuID != 0 && v.VendorSkuID != "-70000" { // todo hard code skuBindInfo := skumapper[v.VendorSkuID] if skuBindInfo == nil { - globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) + //京东商城的话,门店里可能取不到对应商品 + if order.VendorID == model.VendorIDJDShop { + v.JxSkuID = v.SkuID + v.ShopPrice = v.SalePrice * 70 / 100 + } else { + globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) + } } else { v.JxSkuID = skuBindInfo.SkuID // TODO 客户端当前逻辑认为SkuID为0为赠品 @@ -1002,7 +1008,7 @@ func GetOrderSimpleInfo(ctx *jxcontext.Context, vendorOrderID string) (getOrderS func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) { var ( pageNo = 1 - pageSize = 10 + pageSize = 20 ) orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNo, pageSize) if err != nil { @@ -1013,10 +1019,10 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti } orders, err := result2Orders(ctx, orderResult) for _, order := range orders { - order.StoreID = 102919 - order.JxStoreID = 102919 - order.StoreName = "商城模板(成都发货)" - order.VendorStoreID = model.JdShopMainVendorStoreID + // order.StoreID = 102919 + // order.JxStoreID = 102919 + // order.StoreName = "商城模板(成都发货)" + // order.VendorStoreID = model.JdShopMainVendorStoreID partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) globals.SugarLogger.Debugf("SaveJdsOrders, order: [%v]", utils.Format4Output(order, false)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) From ede4b95e5b72fd55177d8e9031cc406bc46caea6 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, 9 Jun 2020 15:05:19 +0800 Subject: [PATCH 020/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 6fc521c88..15005729c 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -363,11 +363,11 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) } } else { - v.JxSkuID = skuBindInfo.SkuID // TODO 客户端当前逻辑认为SkuID为0为赠品 if v.SkuID == 0 { v.SkuID = v.JxSkuID } + v.JxSkuID = skuBindInfo.SkuID v.ShopPrice = int64(skuBindInfo.Price) v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准 if skuBindInfo.Price == 0 { From c804383158b8ae5bac85332439bf0db62ad9b21e 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, 9 Jun 2020 15:09:16 +0800 Subject: [PATCH 021/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 583ff026c..1fc73c87a 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -662,7 +662,7 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j multiPropSku []*jdshopapi.CreateSkuParamAttrs ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit if v.Comment != "" { specQuality += " " + v.Comment } @@ -776,7 +776,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf multiPropSku []*jdshopapi.CreateSkuParamAttrs ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit if v.Comment != "" { specQuality += " " + v.Comment } From 95a1d133a319de2f670809d3ab2b50171d08d83e 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, 9 Jun 2020 16:50:24 +0800 Subject: [PATCH 022/152] =?UTF-8?q?=E5=85=88=E8=AF=95=E8=AF=95=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 1fc73c87a..ec36f882c 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -774,16 +774,39 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf attrsPropSku []*jdshopapi.CreateSkuParamAttrs skus []*jdshopapi.UpdateSkusParamSkus multiPropSku []*jdshopapi.CreateSkuParamAttrs + specQuality string ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit - if v.Comment != "" { - specQuality += " " + v.Comment + if v.SpecUnit == model.SpecUnitNames[1] || v.SpecUnit == model.SpecUnitNames[2] { + specQuality = strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + } else { + specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit } - for _, v := range valuesSku { - if v.Name == specQuality { - ggValueID = v.ID + // if v.Comment != "" { + // specQuality += " " + v.Comment + // } + for _, vv := range valuesSku { + if vv.Name == specQuality { + // if v.Comment == "" { + ggValueID = vv.ID + break } + // } + // else { + // //要更新原规格 + // break + // } + // } else { + // if v.Comment != "" { + // if vv.Name == specQuality+" "+v.Comment { + // ggValueID = vv.ID + // break + // } else { + // specQuality += " " + v.Comment + // break + // } + // } + // } } if ggValueID == 0 { //说明没有建这个规格,要建上 catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) From d2a7e9f7d7ffbd076f93b4a7653e35c034a43d9e 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, 9 Jun 2020 16:50:58 +0800 Subject: [PATCH 023/152] =?UTF-8?q?=E5=85=88=E8=AF=95=E8=AF=95=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index ec36f882c..cf6a85256 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -660,12 +660,18 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j ggValueID int64 //规格的属性id attrsPropSku []*jdshopapi.CreateSkuParamAttrs multiPropSku []*jdshopapi.CreateSkuParamAttrs + specQuality string ) valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit - if v.Comment != "" { - specQuality += " " + v.Comment + if v.SpecUnit == model.SpecUnitNames[1] || v.SpecUnit == model.SpecUnitNames[2] { + specQuality = strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + } else { + specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit } + // specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit + // if v.Comment != "" { + // specQuality += " " + v.Comment + // } for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID From 2910a9278bdc79b6cbc2ccf685e0d245e334f0c8 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, 9 Jun 2020 17:31:16 +0800 Subject: [PATCH 024/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jdshop/store_sku.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index cf6a85256..7efea8196 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -178,11 +178,12 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v imageURL, err = uploadImg(img, name, "tou") } } - err2 := api.JdShopAPI.TransparentImageAdd(v.JdsWareID, imageURL) - if err2 != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - return failedList, err - } + // err2 := + api.JdShopAPI.TransparentImageAdd(v.JdsWareID, imageURL) + // if err2 != nil { + // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + // return failedList, err + // } } for _, vv := range v.StoreSkuSyncInfoJds { updateSkusParam, err := buildUpdateSkusParam(v, vv, false) From 2262840f781486b84d3009d1c649a46e2d493a97 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, 9 Jun 2020 17:35:02 +0800 Subject: [PATCH 025/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jdshop/store_sku.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 7efea8196..49cc1e68e 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -837,10 +837,13 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf } else { sku.StockNum = "0" } + fmt.Println("test1") if !isCreate { + fmt.Println("test2") result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { + fmt.Println("test3") api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } } From a9b30ddd3f11d2f7cf6ba1a4e66028168db355fe 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, 9 Jun 2020 17:35:15 +0800 Subject: [PATCH 026/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jdshop/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 49cc1e68e..519bd039b 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -843,7 +843,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { - fmt.Println("test3") + fmt.Println("test3", specQuality) api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } } From 0dc87a120e7321e7067d93da091999952a74fc5b 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, 9 Jun 2020 17:37:50 +0800 Subject: [PATCH 027/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jdshop/store_sku.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 519bd039b..81237a0e9 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -837,13 +837,11 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf } else { sku.StockNum = "0" } - fmt.Println("test1") if !isCreate { - fmt.Println("test2") + fmt.Println("test2", specQuality, v.VendorSkuID) result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { - fmt.Println("test3", specQuality) api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } } From 31014da7a5d46642beed1f153ea203c6872e3a28 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, 9 Jun 2020 17:54:23 +0800 Subject: [PATCH 028/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jdshop/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 81237a0e9..ac189ba46 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -838,9 +838,9 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf sku.StockNum = "0" } if !isCreate { - fmt.Println("test2", specQuality, v.VendorSkuID) result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 + fmt.Println("test2", specQuality, v.VendorSkuID, utils.Format4Output(result, false)) if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } From a2a28d2b591d324ca11918f8f798c7d2cc2ec9cf 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, 9 Jun 2020 18:45:47 +0800 Subject: [PATCH 029/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jxstore/tempop/tempop.go | 137 +++++++++++++++++- business/partner/purchase/jdshop/store_sku.go | 1 - 2 files changed, 131 insertions(+), 7 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 59bd8017c..45567ef95 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -8,8 +8,6 @@ import ( "strings" "time" - "git.rosy.net.cn/baseapi/platformapi/jdshopapi" - "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/partner/delivery" "github.com/360EntSecGroup-Skylar/excelize" @@ -1611,10 +1609,137 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - _, err = api.JdShopAPI.AllOrders(&jdshopapi.AllOrdersParam{ - Current: 1, - PageSize: 10, - }) + var storeSkus []*model.StoreSkuBind + sql := ` + SELECT a.* FROM store_sku_bind a WHERE a.store_id = 102919 + AND a.jds_ware_id IN (14518860227, + 14518865342, + 14518857791, + 14518863440, + 14518850181, + 14518869426, + 14518865836, + 14518860282, + 14518862865, + 14518860089, + 14518861773, + 14518857091, + 14518859794, + 14518878413, + 14518874243, + 14518992990, + 14519010404, + 14519010010, + 14519006838, + 14519009822, + 14541114008, + 14542371664, + 14542409106, + 14542477967, + 14542585438, + 14542602011, + 14542586377, + 14542927723, + 14542946611, + 14542948535, + 14543031285, + 14543077206, + 14544951705, + 14546014638, + 14565258994, + 14565275855, + 14566133342, + 14566144059, + 14566419305, + 14566403990, + 14566408956, + 14567187277, + 14567793468, + 14567911336, + 14567910034, + 14567907049, + 14567904981, + 14567909664, + 14567907786, + 14568001774, + 14568152611, + 14568138877, + 14568146252, + 14568161923, + 14568508881, + 14568512475, + 14568524772, + 14568533264, + 14568540322, + 14568534834, + 14568546936, + 14568542882, + 14568806841, + 14576405495, + 14576832607, + 14576832017, + 14576946037, + 14576974106, + 14576993226, + 14579143223, + 14581769973, + 14581773059, + 14581773646, + 14581780520, + 14581782920, + 14581768094, + 14581788365, + 14581805504, + 14581919920, + 14581915051, + 14581920950, + 14581971709, + 14581979302, + 14581974927, + 14581974739, + 14581964099, + 14581974639, + 14581976637, + 14581979946, + 14581989815, + 14581987337, + 14581987251, + 14581981273, + 14581996123, + 14581984285, + 14581994544, + 14581996576, + 14582006319, + 14582000952, + 14582000668, + 14581993998, + 14581996999, + 14582016736, + 14582053303, + 14594027838, + 14594055255, + 14594104816, + 14594233747, + 14594245738, + 14594249079, + 14594296303, + 14594987858, + 14596828148, + 14600091528, + 14600094614, + 14600087648, + 14566414324) + ` + err = dao.GetRows(dao.GetDB(), &storeSkus, sql, nil) + for _, v := range storeSkus { + result, _ := api.JdShopAPI.SearchSkuList(v.JdsWareID) + for _, vv := range result { + if vv.SkuID != v.JdsID { + api.JdShopAPI.DeleteSku(vv.SkuID) + break + } + } + } return err } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index ac189ba46..7efea8196 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -840,7 +840,6 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf if !isCreate { result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 - fmt.Println("test2", specQuality, v.VendorSkuID, utils.Format4Output(result, false)) if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } From 6776ea04eeeff9f38ee160831d8e7bef327e0212 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, 9 Jun 2020 18:56:26 +0800 Subject: [PATCH 030/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= =?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/jxstore/tempop/tempop.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 45567ef95..beed8eb36 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1736,7 +1736,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { for _, vv := range result { if vv.SkuID != v.JdsID { api.JdShopAPI.DeleteSku(vv.SkuID) - break } } } From b1634f2422285f9092e7ac91eff9b1336ce66faa 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, 10 Jun 2020 09:02:47 +0800 Subject: [PATCH 031/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=A7=84=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 154 +++--------------- business/partner/purchase/jdshop/store_sku.go | 1 + 2 files changed, 28 insertions(+), 127 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index beed8eb36..b07a89148 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,136 +1609,36 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - var storeSkus []*model.StoreSkuBind - sql := ` - SELECT a.* FROM store_sku_bind a WHERE a.store_id = 102919 - AND a.jds_ware_id IN (14518860227, - 14518865342, - 14518857791, - 14518863440, - 14518850181, - 14518869426, - 14518865836, - 14518860282, - 14518862865, - 14518860089, - 14518861773, - 14518857091, - 14518859794, - 14518878413, - 14518874243, - 14518992990, - 14519010404, - 14519010010, - 14519006838, - 14519009822, - 14541114008, - 14542371664, - 14542409106, - 14542477967, - 14542585438, - 14542602011, - 14542586377, - 14542927723, - 14542946611, - 14542948535, - 14543031285, - 14543077206, - 14544951705, - 14546014638, - 14565258994, - 14565275855, - 14566133342, - 14566144059, - 14566419305, - 14566403990, - 14566408956, - 14567187277, - 14567793468, - 14567911336, - 14567910034, - 14567907049, - 14567904981, - 14567909664, - 14567907786, - 14568001774, - 14568152611, - 14568138877, - 14568146252, - 14568161923, - 14568508881, - 14568512475, - 14568524772, - 14568533264, - 14568540322, - 14568534834, - 14568546936, - 14568542882, - 14568806841, - 14576405495, - 14576832607, - 14576832017, - 14576946037, - 14576974106, - 14576993226, - 14579143223, - 14581769973, - 14581773059, - 14581773646, - 14581780520, - 14581782920, - 14581768094, - 14581788365, - 14581805504, - 14581919920, - 14581915051, - 14581920950, - 14581971709, - 14581979302, - 14581974927, - 14581974739, - 14581964099, - 14581974639, - 14581976637, - 14581979946, - 14581989815, - 14581987337, - 14581987251, - 14581981273, - 14581996123, - 14581984285, - 14581994544, - 14581996576, - 14582006319, - 14582000952, - 14582000668, - 14581993998, - 14581996999, - 14582016736, - 14582053303, - 14594027838, - 14594055255, - 14594104816, - 14594233747, - 14594245738, - 14594249079, - 14594296303, - 14594987858, - 14596828148, - 14600091528, - 14600094614, - 14600087648, - 14566414324) - ` - err = dao.GetRows(dao.GetDB(), &storeSkus, sql, nil) - for _, v := range storeSkus { - result, _ := api.JdShopAPI.SearchSkuList(v.JdsWareID) - for _, vv := range result { - if vv.SkuID != v.JdsID { - api.JdShopAPI.DeleteSku(vv.SkuID) + var ( + pageNo = 1 + pageSize = 100 + rr []int64 + ) + pageResult, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) + for ; pageNo <= pageResult.TotalItem/pageSize+1; pageNo++ { + result, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) + if err == nil { + for _, v := range result.Data { + result, _ := api.JdShopAPI.SearchSkuList(v.WareID) + for _, vv := range result { + result2, _ := api.JdShopAPI.FindSkuById(vv.SkuID) + _, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(result2.SaleAttrs[0].AttrValueAlias[0]) + if specQuality < 100 && specUnit != "kg" && specUnit != "L" { + var storeSku []*model.StoreSkuBind + sql := ` + SELECT * FROM store_sku_bind WHERE store_id = 102919 AND jds_id = ? + ` + sqlParams := []interface{}{vv.SkuID} + err = dao.GetRow(dao.GetDB(), &storeSku, sql, sqlParams) + if len(storeSku) == 0 { + rr = append(rr, vv.SkuID) + } + } + } } } } + fmt.Println("test", rr) return err } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 7efea8196..83d602463 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -122,6 +122,7 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v VenderID: jdshopapi.VenderID, PromiseID: jdshopapi.JdsPromiseID, ShopCategorys: []int{utils.Str2Int(v.VendorCatID)}, + JdPrice: jxutils.IntPrice2Standard(v.UnitPrice), } var desc string if v.DescImg != "" { From 3adb04beba430c5985dd63678c1c59684cce8d1a 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, 10 Jun 2020 09:13:04 +0800 Subject: [PATCH 032/152] =?UTF-8?q?=E5=85=88=E5=B1=8F=E8=94=BDmain=20?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 9485047cf..6d77b0f82 100644 --- a/main.go +++ b/main.go @@ -145,9 +145,9 @@ func main() { return } - if globals.IsProductEnv() { - orderman.SaveJdsOrders(nil, time.Now().Add(-2*time.Hour), time.Now()) - } + // if globals.IsProductEnv() { + // orderman.SaveJdsOrders(nil, time.Now().Add(-2*time.Hour), time.Now()) + // } orderman.LoadPendingOrders() // 延时的原因是等回调准备好 From cc0e795c16c4600cf12fb09711e34f056fcd6572 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, 10 Jun 2020 09:19:05 +0800 Subject: [PATCH 033/152] =?UTF-8?q?=E5=85=88=E5=B1=8F=E8=94=BDmain=20?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index b07a89148..3cee051d1 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1638,7 +1638,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } } - fmt.Println("test", rr) + fmt.Println("testrr", rr) return err } From 89a88e27b38edd4fbc624d18836d513a8bb07e91 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, 10 Jun 2020 09:28:50 +0800 Subject: [PATCH 034/152] =?UTF-8?q?=E5=85=88=E5=B1=8F=E8=94=BDmain=20?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 3cee051d1..b026e7bfd 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1624,13 +1624,13 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { result2, _ := api.JdShopAPI.FindSkuById(vv.SkuID) _, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(result2.SaleAttrs[0].AttrValueAlias[0]) if specQuality < 100 && specUnit != "kg" && specUnit != "L" { - var storeSku []*model.StoreSkuBind + var storeSku *model.StoreSkuBind sql := ` SELECT * FROM store_sku_bind WHERE store_id = 102919 AND jds_id = ? ` sqlParams := []interface{}{vv.SkuID} err = dao.GetRow(dao.GetDB(), &storeSku, sql, sqlParams) - if len(storeSku) == 0 { + if storeSku == nil { rr = append(rr, vv.SkuID) } } @@ -1638,7 +1638,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } } - fmt.Println("testrr", rr) + fmt.Println("testrr1", rr) return err } From e9191465886f1842f882e7b0c77cddf2ecdeae1a 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, 10 Jun 2020 10:59:01 +0800 Subject: [PATCH 035/152] =?UTF-8?q?=E5=85=88=E5=B1=8F=E8=94=BDmain=20?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index b026e7bfd..356544e59 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1610,12 +1610,11 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } var ( - pageNo = 1 pageSize = 100 rr []int64 ) - pageResult, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) - for ; pageNo <= pageResult.TotalItem/pageSize+1; pageNo++ { + pageResult, err := api.JdShopAPI.SearchWare4Valid("", 1, 1) + for pageNo := 1; pageNo <= pageResult.TotalItem/pageSize+1; pageNo++ { result, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) if err == nil { for _, v := range result.Data { @@ -1638,7 +1637,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } } - fmt.Println("testrr1", rr) + fmt.Println("testrr2", rr) return err } From c4d6ee61482c787e0c85ec1e49965892c287bc5e 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, 10 Jun 2020 11:44:13 +0800 Subject: [PATCH 036/152] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index f45f1c6c2..9337a472e 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1599,7 +1599,7 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int } if auditTimeStart != utils.ZeroTimeValue && auditTimeEnd != utils.ZeroTimeValue { sql += " AND a.updated_at BETWEEN ? AND ?" - sqlParams = append(sqlParams, applyTimeStart, applyTimeEnd) + sqlParams = append(sqlParams, auditTimeStart, auditTimeEnd) } if len(types) > 0 { sql += " AND a.type IN (" + GenQuestionMarks(len(types)) + ")" From dfee2dd53f608b27d320960ef372027e8fa5a10a 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, 10 Jun 2020 11:45:52 +0800 Subject: [PATCH 037/152] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 9337a472e..a010b2c14 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1617,7 +1617,7 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int sql += " AND f.name LIKE ? " sqlParams = append(sqlParams, "%"+cityName+"%") } - sql += " ORDER BY a.updated_at DESC LIMIT ? OFFSET ?" + sql += " ORDER BY a.updated_at LIMIT ? OFFSET ?" pageSize = jxutils.FormalizePageSize(pageSize) sqlParams = append(sqlParams, pageSize, offset) Begin(db) From b2d760289ee3850135e416b308fca579ff889862 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, 10 Jun 2020 13:11:46 +0800 Subject: [PATCH 038/152] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 46 ++++++++++++++----------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 356544e59..ec3a22fe6 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,35 +1609,31 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - var ( - pageSize = 100 - rr []int64 - ) - pageResult, err := api.JdShopAPI.SearchWare4Valid("", 1, 1) - for pageNo := 1; pageNo <= pageResult.TotalItem/pageSize+1; pageNo++ { - result, err := api.JdShopAPI.SearchWare4Valid("", pageNo, pageSize) - if err == nil { - for _, v := range result.Data { - result, _ := api.JdShopAPI.SearchSkuList(v.WareID) - for _, vv := range result { - result2, _ := api.JdShopAPI.FindSkuById(vv.SkuID) - _, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(result2.SaleAttrs[0].AttrValueAlias[0]) - if specQuality < 100 && specUnit != "kg" && specUnit != "L" { - var storeSku *model.StoreSkuBind - sql := ` - SELECT * FROM store_sku_bind WHERE store_id = 102919 AND jds_id = ? - ` - sqlParams := []interface{}{vv.SkuID} - err = dao.GetRow(dao.GetDB(), &storeSku, sql, sqlParams) - if storeSku == nil { - rr = append(rr, vv.SkuID) + storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), []int{667112}, nil) + task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + v := batchItemList[0].(*model.StoreSkuBind) + skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil) + if len(skus) > 0 { + sku := skus[0] + if v.Price == v.UnitPrice { + if sku.Unit == model.UnitNames[0] { + if sku.SpecUnit == model.SpecUnitNames[1] || sku.SpecUnit == model.SpecUnitNames[2] { + v.Price = utils.Float64TwoInt(utils.Int2Float64(v.UnitPrice) * float64(sku.SpecQuality) * 2) + } else { + v.Price = utils.Float64TwoInt(utils.Int2Float64(v.UnitPrice) * float64(sku.SpecQuality/500)) } + v.JdsSyncStatus = v.JdsSyncStatus | 16 + v.MtwmSyncStatus = v.MtwmSyncStatus | 16 + v.EbaiSyncStatus = v.EbaiSyncStatus | 16 + dao.UpdateEntity(dao.GetDB(), v, "Price", "JdsSyncStatus", "MtwmSyncStatus", "EbaiSyncStatus") } } } - } - } - fmt.Println("testrr2", rr) + return retVal, err + }, storeSkus) + tasksch.HandleTask(task, nil, true).Run() + task.GetID() return err } From 8935212f5e28f00e5d3a071339b4f5b7f69c6078 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, 10 Jun 2020 13:15:16 +0800 Subject: [PATCH 039/152] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index ec3a22fe6..316d9d739 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,7 +1609,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), []int{667112}, nil) + storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), []int{102891}, nil) task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { v := batchItemList[0].(*model.StoreSkuBind) From cd1f0a23f2f9e37d7ef96e953c57698b00655348 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, 10 Jun 2020 13:16:23 +0800 Subject: [PATCH 040/152] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 316d9d739..619aadff8 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,7 +1609,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), []int{102891}, nil) + storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), nil, nil) task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { v := batchItemList[0].(*model.StoreSkuBind) From 05ae5497e96e93bfb0c5bd2992ebf46673658290 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, 10 Jun 2020 15:02:36 +0800 Subject: [PATCH 041/152] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order_afs.go | 1 + business/jxstore/tempop/tempop.go | 36 +++++++++++------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/business/jxcallback/orderman/order_afs.go b/business/jxcallback/orderman/order_afs.go index dbb58cae3..6cc91da54 100644 --- a/business/jxcallback/orderman/order_afs.go +++ b/business/jxcallback/orderman/order_afs.go @@ -295,6 +295,7 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af globals.SugarLogger.Infof("updateAfsOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) } else { v.JxSkuID = skuBindInfo.SkuID + v.ShopPrice = int64(skuBindInfo.Price) } } if actStoreSkuMap != nil { diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 619aadff8..8e3c1cbf5 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,29 +1609,27 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - storeSkus, err := dao.GetStoresSkusInfo(dao.GetDB(), nil, nil) + var orders []*model.GoodsOrder + sql := ` + SELECT * FROM goods_order + WHERE order_created_at > '2020-06-10 12:20:00' AND vendor_id <> 5 + AND vendor_order_id = '88033321555614726' + ` + dao.GetRows(dao.GetDB(), &orders, sql, nil) task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - v := batchItemList[0].(*model.StoreSkuBind) - skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil) - if len(skus) > 0 { - sku := skus[0] - if v.Price == v.UnitPrice { - if sku.Unit == model.UnitNames[0] { - if sku.SpecUnit == model.SpecUnitNames[1] || sku.SpecUnit == model.SpecUnitNames[2] { - v.Price = utils.Float64TwoInt(utils.Int2Float64(v.UnitPrice) * float64(sku.SpecQuality) * 2) - } else { - v.Price = utils.Float64TwoInt(utils.Int2Float64(v.UnitPrice) * float64(sku.SpecQuality/500)) - } - v.JdsSyncStatus = v.JdsSyncStatus | 16 - v.MtwmSyncStatus = v.MtwmSyncStatus | 16 - v.EbaiSyncStatus = v.EbaiSyncStatus | 16 - dao.UpdateEntity(dao.GetDB(), v, "Price", "JdsSyncStatus", "MtwmSyncStatus", "EbaiSyncStatus") - } - } + v := batchItemList[0].(*model.GoodsOrder) + var sumPrice int64 + skus, _ := dao.GetSimpleOrderSkus(dao.GetDB(), v.VendorOrderID) + for _, vv := range skus { + sumPrice += vv.ShopPrice + } + if sumPrice != v.ShopPrice { + v.ShopPrice = sumPrice + dao.UpdateEntity(dao.GetDB(), v, "ShopPrice") } return retVal, err - }, storeSkus) + }, orders) tasksch.HandleTask(task, nil, true).Run() task.GetID() return err From f3093a5ebf6a961198f15dd11c0375082f480061 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, 10 Jun 2020 15:06:07 +0800 Subject: [PATCH 042/152] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 8e3c1cbf5..712d4027a 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1613,7 +1613,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { sql := ` SELECT * FROM goods_order WHERE order_created_at > '2020-06-10 12:20:00' AND vendor_id <> 5 - AND vendor_order_id = '88033321555614726' ` dao.GetRows(dao.GetDB(), &orders, sql, nil) task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, From 8d80a5219b2881d60fec7090c31975f71da20150 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, 10 Jun 2020 16:13:50 +0800 Subject: [PATCH 043/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 285 ++++++++++++++++-- business/partner/purchase/jdshop/store_sku.go | 13 +- 2 files changed, 269 insertions(+), 29 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 712d4027a..720ce71e6 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1609,28 +1609,269 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - var orders []*model.GoodsOrder - sql := ` - SELECT * FROM goods_order - WHERE order_created_at > '2020-06-10 12:20:00' AND vendor_id <> 5 - ` - dao.GetRows(dao.GetDB(), &orders, sql, nil) - task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - v := batchItemList[0].(*model.GoodsOrder) - var sumPrice int64 - skus, _ := dao.GetSimpleOrderSkus(dao.GetDB(), v.VendorOrderID) - for _, vv := range skus { - sumPrice += vv.ShopPrice - } - if sumPrice != v.ShopPrice { - v.ShopPrice = sumPrice - dao.UpdateEntity(dao.GetDB(), v, "ShopPrice") - } - return retVal, err - }, orders) - tasksch.HandleTask(task, nil, true).Run() - task.GetID() + var jdsIds = []int64{69355523686, + 69353698875, + 69353633443, + 69353579080, + 69353592976, + 69353575450, + 69353669915, + 69353617240, + 69353711276, + 69355552630, + 69353579078, + 69633169613, + 69353608855, + 69634881612, + 69353634806, + 69353675911, + 69353698186, + 69353698877, + 69607962771, + 69608002604, + 69666543870, + 69353541693, + 69411607058, + 69353594629, + 69353602818, + 69353698187, + 69355538267, + 69353633269, + 69355549016, + 69411607059, + 69593365617, + 69353589341, + 69353618034, + 69353633445, + 69353644658, + 69353644659, + 69353664332, + 69355505481, + 69355531215, + 69355552632, + 69353618035, + 69353619589, + 69353684423, + 69353687174, + 69353722053, + 69355493882, + 69627859883, + 69680935348, + 69353555847, + 69353570677, + 69353589397, + 69353592975, + 69353594611, + 69353602819, + 69353616402, + 69353624528, + 69353654004, + 69353668114, + 69353687173, + 69353701089, + 69353722052, + 69353723922, + 69355527850, + 69355552631, + 69628257042, + 69636525703, + 69680935349, + 69353579081, + 69353589342, + 69353632136, + 69353654006, + 69353726354, + 69355496067, + 69355515747, + 69355516049, + 69355527036, + 69355532703, + 69355558164, + 69355560640, + 69608002434, + 69608089252, + 69626869676, + 69628142211, + 69651275202, + 69665458721, + 69980157422, + 69353511255, + 69353550931, + 69353555846, + 69353579079, + 69353593375, + 69353595563, + 69353603501, + 69353608856, + 69353618036, + 69353628469, + 69353628470, + 69353632137, + 69353633267, + 69353633444, + 69353651935, + 69353668115, + 69353683331, + 69353684157, + 69353701088, + 69353723844, + 69353723845, + 69353726353, + 69355490631, + 69355493881, + 69355493884, + 69355520278, + 69355523687, + 69355532705, + 69355533814, + 69355536851, + 69355538268, + 69355538269, + 69593321185, + 69593321186, + 69607997022, + 69626638026, + 69626638027, + 69626872037, + 69627693305, + 69627954144, + 69628180933, + 69633580083, + 69633580085, + 69634881613, + 69635037810, + 69635204944, + 69636212985, + 69636446354, + 69659137913, + 69659219611, + 69665406179, + 69666460731, + 69673523007, + 69680905913, + 69681869918, + 69821176674, + 69913341309, + 69916445013, + 69353511254, + 69353570678, + 69353581400, + 69353589343, + 69353589398, + 69353593376, + 69353594630, + 69353609816, + 69353616406, + 69353617241, + 69353619591, + 69353633268, + 69353634833, + 69353642793, + 69353647695, + 69353651934, + 69353654005, + 69353664333, + 69353669914, + 69353673334, + 69353684159, + 69353684603, + 69353684604, + 69353684605, + 69353684607, + 69353698876, + 69353701090, + 69353711277, + 69353711278, + 69353713475, + 69353726357, + 69355496066, + 69355520277, + 69355523688, + 69355527851, + 69355533813, + 69355533815, + 69355538270, + 69355559874, + 69355559875, + 69355559876, + 69355560641, + 69607988687, + 69608089253, + 69625036409, + 69625436705, + 69626674146, + 69626756838, + 69626849783, + 69626872040, + 69627211928, + 69627823696, + 69627823697, + 69627824429, + 69627859882, + 69627954146, + 69628055157, + 69628209840, + 69628220046, + 69628244518, + 69628620179, + 69628645373, + 69633038980, + 69633169614, + 69633311068, + 69633433209, + 69634285577, + 69634285578, + 69634566319, + 69634566320, + 69634620948, + 69635037811, + 69635075404, + 69635108188, + 69636525704, + 69636563250, + 69636658901, + 69636658902, + 69651265114, + 69659219612, + 69659883978, + 69662122661, + 69666543871, + 69666543872, + 69666660395, + 69666907986, + 69666931214, + 69673508504, + 69680887348, + 69814931154, + 69818078270, + 69881553035, + 69901783885, + 69913362221, + 69916396643, + 69925717199, + 69933144351, + 69933974117, + 69935756246, + 69935768981, + 69935855227, + 69935915640, + 69937601360, + 69937642148, + 69939562884, + 69939571687, + 69948026907} + db := dao.GetDB() + for _, v := range jdsIds { + var storeSkus *model.StoreSkuBind + sql := ` + SELECT * FROM store_sku_bind WHERE store_id = 102919 AND jds_id = ? + ` + sqlParams := []interface{}{v} + err = dao.GetRow(db, &storeSkus, sql, sqlParams) + if storeSkus != nil { + cms.CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, []int{model.VendorIDJDShop}, []int{model.JdShopMainStoreID}, []int{storeSkus.SkuID}, false, true, true) + } + } return err } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 83d602463..16f3c6ec6 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -271,9 +271,9 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID { for _, v := range storeSkuList { err = api.JdShopAPI.UpdateSkuJdPrice(utils.Str2Int(v.VendorSkuID), jxutils.IntPrice2Standard(v.VendorPrice)) - } - if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格") + if err != nil { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格") + } } } return failedList, err @@ -670,10 +670,9 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j } else { specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit } - // specQuality := fmt.Sprintf("%.2f", float64(v.SpecQuality)) + v.SpecUnit - // if v.Comment != "" { - // specQuality += " " + v.Comment - // } + if v.Comment != "" { + specQuality += " " + v.Comment + } for _, v := range valuesSku { if v.Name == specQuality { ggValueID = v.ID From 9c4b1acd74f2f7c68b8ff35778ecd9518f5d21db 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, 10 Jun 2020 16:28:26 +0800 Subject: [PATCH 044/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 16f3c6ec6..465e0f049 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -272,7 +272,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg for _, v := range storeSkuList { err = api.JdShopAPI.UpdateSkuJdPrice(utils.Str2Int(v.VendorSkuID), jxutils.IntPrice2Standard(v.VendorPrice)) if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格") + failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格")...) } } } From ee3a06988807539f054a8c6aa5e04aa565112339 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, 10 Jun 2020 16:30:56 +0800 Subject: [PATCH 045/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 465e0f049..576686fc0 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -211,9 +211,10 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v if err == nil { err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2)) } - } - if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "删除商品") + if err != nil { + failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "删除商品")...) + + } } } return failedList, err From d29e7aaa9f39ef540d2193c3134e0ec0adc3b3dc 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, 10 Jun 2020 16:44:03 +0800 Subject: [PATCH 046/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 576686fc0..63d5d5770 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -273,6 +273,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg for _, v := range storeSkuList { err = api.JdShopAPI.UpdateSkuJdPrice(utils.Str2Int(v.VendorSkuID), jxutils.IntPrice2Standard(v.VendorPrice)) if err != nil { + fmt.Println("testerr", err.Error()) failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格")...) } } From 1fa21146f935321f1064c12bfa7266bf41d14514 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, 10 Jun 2020 16:55:21 +0800 Subject: [PATCH 047/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 1 + business/partner/purchase/jdshop/store_sku.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index d5f5786a9..c73e581d5 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -743,6 +743,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag failedList, err = storeSkuHandler.UpdateStoreSkusPrice(ctx, storeDetail.VendorOrgCode, storeID, vendorStoreID, batchedStoreSkuList) failedList, err = buildFailedListAndErr(failedList, err, batchedStoreSkuList, nil, storeID, vendorID, "更新门店商品价格") if len(failedList) > 0 { + fmt.Println("testerr2") task.AddFailedList(failedList) } successList := putils.UnselectStoreSkuListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList)) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 63d5d5770..576686fc0 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -273,7 +273,6 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg for _, v := range storeSkuList { err = api.JdShopAPI.UpdateSkuJdPrice(utils.Str2Int(v.VendorSkuID), jxutils.IntPrice2Standard(v.VendorPrice)) if err != nil { - fmt.Println("testerr", err.Error()) failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "修改商品价格")...) } } From 9e485ee9053772cf84d700d7ac037643fb1026e9 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, 10 Jun 2020 16:59:31 +0800 Subject: [PATCH 048/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 1 + business/jxstore/cms/sync_store_sku.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 7847ed885..8da0e4f2d 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -676,6 +676,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I if !isAsync { resultList, err2 := task.GetResult(0) if len(task.GetFailedList()) > 0 { + fmt.Println("testerr3") err2 = buildErrMsg(task) } if err = err2; err == nil { diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index c73e581d5..d5f5786a9 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -743,7 +743,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag failedList, err = storeSkuHandler.UpdateStoreSkusPrice(ctx, storeDetail.VendorOrgCode, storeID, vendorStoreID, batchedStoreSkuList) failedList, err = buildFailedListAndErr(failedList, err, batchedStoreSkuList, nil, storeID, vendorID, "更新门店商品价格") if len(failedList) > 0 { - fmt.Println("testerr2") task.AddFailedList(failedList) } successList := putils.UnselectStoreSkuListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList)) From 22ae839456af065017ab7398d2d4ead38695fc7a 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, 10 Jun 2020 17:05:08 +0800 Subject: [PATCH 049/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 8da0e4f2d..6f45fb6fc 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -478,7 +478,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { globals.SugarLogger.Debug("SyncStoresSkus2") isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 - task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, + _, hint, err = v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { @@ -505,9 +505,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) - if task != nil { - err = makeSyncError(err) - } + // if task != nil { + // err = makeSyncError(err) + // } return hint, err } @@ -676,7 +676,6 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I if !isAsync { resultList, err2 := task.GetResult(0) if len(task.GetFailedList()) > 0 { - fmt.Println("testerr3") err2 = buildErrMsg(task) } if err = err2; err == nil { From 3ef70e750407ecb70095a0ab54d34146824b9f18 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, 10 Jun 2020 17:13:18 +0800 Subject: [PATCH 050/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 6f45fb6fc..fd6ce03a4 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -478,7 +478,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { globals.SugarLogger.Debug("SyncStoresSkus2") isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 - _, hint, err = v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, + task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { @@ -505,9 +505,10 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) - // if task != nil { - // err = makeSyncError(err) - // } + if task != nil { + err = makeSyncError(err) + } + fmt.Println("testerr4", err.Error()) return hint, err } From 3f71c43fa97f702037f8fbbf7a2d0f70b371bbd7 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, 10 Jun 2020 17:27:20 +0800 Subject: [PATCH 051/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index fd6ce03a4..bc6000520 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -508,7 +508,7 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. if task != nil { err = makeSyncError(err) } - fmt.Println("testerr4", err.Error()) + fmt.Println("testerr4", err) return hint, err } From ded30b2a6b31b7b9e94081a71489cd4ab17ef6ca 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, 10 Jun 2020 17:40:08 +0800 Subject: [PATCH 052/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 3 ++- business/partner/purchase/jdshop/store_sku.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index bc6000520..f8c2f02dd 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -506,9 +506,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) if task != nil { + fmt.Println("testerr4", err) err = makeSyncError(err) } - fmt.Println("testerr4", err) return hint, err } @@ -689,6 +689,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I } else { hint = task.GetID() } + fmt.Println("testerr5", err) return task, hint, err } diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 576686fc0..e9a3fccd8 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -672,7 +672,7 @@ func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *j specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit } if v.Comment != "" { - specQuality += " " + v.Comment + specQuality = v.Comment } for _, v := range valuesSku { if v.Name == specQuality { @@ -790,9 +790,9 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf } else { specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit } - // if v.Comment != "" { - // specQuality += " " + v.Comment - // } + if v.Comment != "" { + specQuality = v.Comment + } for _, vv := range valuesSku { if vv.Name == specQuality { // if v.Comment == "" { From d97c89797770308cafd3c286866633939f2c4ec9 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, 10 Jun 2020 17:43:39 +0800 Subject: [PATCH 053/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index f8c2f02dd..0ba674e16 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -506,7 +506,6 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) if task != nil { - fmt.Println("testerr4", err) err = makeSyncError(err) } return hint, err @@ -678,6 +677,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I resultList, err2 := task.GetResult(0) if len(task.GetFailedList()) > 0 { err2 = buildErrMsg(task) + err = err2 } if err = err2; err == nil { if len(resultList) == 0 { @@ -686,6 +686,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I hint = jxutils.TaskResult2Hint(resultList) } } + fmt.Println("testerr6", err) } else { hint = task.GetID() } From 494e15b057dfe0579c91e2abf040c56d596026f6 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, 10 Jun 2020 17:47:03 +0800 Subject: [PATCH 054/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 0ba674e16..fbced0e04 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -478,7 +478,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { globals.SugarLogger.Debug("SyncStoresSkus2") isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 - task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, + _, hint, err = v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { @@ -505,9 +505,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) - if task != nil { - err = makeSyncError(err) - } + // if task != nil { + // err = makeSyncError(err) + // } return hint, err } @@ -686,11 +686,9 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I hint = jxutils.TaskResult2Hint(resultList) } } - fmt.Println("testerr6", err) } else { hint = task.GetID() } - fmt.Println("testerr5", err) return task, hint, err } From 778a6cb686acf5b322820bdfbe2b0fcafacfe9b0 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, 10 Jun 2020 17:49:49 +0800 Subject: [PATCH 055/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=94=B9=E4=BB=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index fbced0e04..f11aa151d 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -478,7 +478,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { globals.SugarLogger.Debug("SyncStoresSkus2") isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 - _, hint, err = v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, + task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { @@ -505,9 +505,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch. } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) - // if task != nil { - // err = makeSyncError(err) - // } + if task != nil { + err = makeSyncError(err) + } return hint, err } From d59ac46f566690eb7324630f1c834db72659bfbf 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, 10 Jun 2020 18:19:43 +0800 Subject: [PATCH 056/152] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E5=A2=9E=E9=87=8F=E4=BF=9D=E5=AD=98sku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index e9a3fccd8..536e8791b 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -186,15 +186,15 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v // return failedList, err // } } - for _, vv := range v.StoreSkuSyncInfoJds { - updateSkusParam, err := buildUpdateSkusParam(v, vv, false) - if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - return failedList, err - } - vendorSkuID, err := api.JdShopAPI.UpdateSkus(updateSkusParam) - vv.VendorSkuID = vendorSkuID - } + // for _, vv := range v.StoreSkuSyncInfoJds { + // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) + // if err != nil { + // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + // return failedList, err + // } + // vendorSkuID, err := api.JdShopAPI.UpdateSkus(updateSkusParam) + // vv.VendorSkuID = vendorSkuID + // } } if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") From d674568cb47bab809efdebc35657d0a76c207e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 11:18:56 +0800 Subject: [PATCH 057/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- business/jxstore/tempop/tempop.go | 41 ++++++++++++++++--- business/model/dao/store_sku.go | 3 +- business/partner/purchase/jdshop/store_sku.go | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 700488c08..d25feca42 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4591,7 +4591,7 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku if status == model.StoreAuditStatusOnline { return "", fmt.Errorf("审核标志不正确!") } - task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx, + task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { storeAudit := batchItemList[0].(*model.StoreSkuAudit) storeAudits, err := dao.GetStoreSkuAuditLight(db, []int{storeAudit.StoreID}, []int{storeAudit.NameID}, model.StoreAuditStatusOnline) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 720ce71e6..339602576 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -8,6 +8,8 @@ import ( "strings" "time" + "git.rosy.net.cn/baseapi/platformapi/jdshopapi" + "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/partner/delivery" "github.com/360EntSecGroup-Skylar/excelize" @@ -1862,15 +1864,44 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { 69948026907} db := dao.GetDB() for _, v := range jdsIds { - var storeSkus *model.StoreSkuBind + vendorSku, _ := api.JdShopAPI.FindSkuById(v) + var sku *model.Sku sql := ` - SELECT * FROM store_sku_bind WHERE store_id = 102919 AND jds_id = ? + SELECT b.* FROM store_sku_bind a,sku b WHERE a.sku_id = b.id AND a.store_id = 102919 AND a.jds_id = ? ` sqlParams := []interface{}{v} - err = dao.GetRow(db, &storeSkus, sql, sqlParams) - if storeSkus != nil { - cms.CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, []int{model.VendorIDJDShop}, []int{model.JdShopMainStoreID}, []int{storeSkus.SkuID}, false, true, true) + err = dao.GetRow(db, &sku, sql, sqlParams) + skus, _ := dao.GetStoreSkus(db, model.VendorIDJDShop, model.JdShopMainStoreID, []int{sku.ID}) + storeSku := skus[0] + if storeSku.Comment != "" { + var specQuality = utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit + flag := false + valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(utils.Str2Int(vendorSku.SaleAttrs[0].AttrID)) + for _, vv := range valuesSku { + if vv.Name == specQuality { + flag = true + } + } + if !flag { + err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ + WareID: vendorSku.WareID, + Props: []*jdshopapi.CreateSkuParamAttrs2{ + &jdshopapi.CreateSkuParamAttrs2{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + AttrValueAlias: []string{sku.Comment}, + }, + }, + }) + } else { + api.JdShopAPI.SaveVenderAttrValue(specQuality, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) + } } + // attrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] + // if storeSkus != nil { + // cms.CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, []int{model.VendorIDJDShop}, []int{model.JdShopMainStoreID}, []int{storeSkus.SkuID}, false, true, true) + // } + break } return err } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index a010b2c14..259365ed6 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1525,13 +1525,14 @@ func UpdateYbOtherSku(db *DaoDB, storeSkuSyncInfo *StoreSkuSyncInfo) (err error) func UpdateJdsWareID(db *DaoDB, storeSkuSyncInfo *StoreSkuSyncInfo) (err error) { sql := ` UPDATE store_sku_bind - SET jds_ware_id = ? + SET jds_ware_id = ?, jds_id = ? WHERE store_id = ? AND sku_id = ? AND deleted_at = ? ` sqlParams := []interface{}{ storeSkuSyncInfo.JdsWareID, + storeSkuSyncInfo.VendorSkuID, storeSkuSyncInfo.StoreID, storeSkuSyncInfo.SkuID, utils.DefaultTimeValue, diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 536e8791b..1af0d1779 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -842,7 +842,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { - api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) + err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } } if attrIDs["类别"] != 0 { From 04556e4ec037a62c4044ba4378f5b5204fce4433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 11:28:13 +0800 Subject: [PATCH 058/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 339602576..802d591b6 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1873,7 +1873,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.GetRow(db, &sku, sql, sqlParams) skus, _ := dao.GetStoreSkus(db, model.VendorIDJDShop, model.JdShopMainStoreID, []int{sku.ID}) storeSku := skus[0] - if storeSku.Comment != "" { + if sku.Comment != "" { var specQuality = utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit flag := false valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(utils.Str2Int(vendorSku.SaleAttrs[0].AttrID)) @@ -1882,7 +1882,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { flag = true } } - if !flag { + if flag { err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ WareID: vendorSku.WareID, Props: []*jdshopapi.CreateSkuParamAttrs2{ @@ -1894,7 +1894,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { }, }) } else { - api.JdShopAPI.SaveVenderAttrValue(specQuality, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) + api.JdShopAPI.SaveVenderAttrValue(sku.Comment, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) } } // attrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] From c4d2330120bdf8b1cf489d58777c351a7cf604ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 11:40:15 +0800 Subject: [PATCH 059/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 802d591b6..5b3608193 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1890,6 +1890,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { AttrID: vendorSku.SaleAttrs[0].AttrID, AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, AttrValueAlias: []string{sku.Comment}, + Type: "com.jd.pop.ware.ic.api.domain.prop", + Type2: "com.jd.pop.ware.ic.api.domain.Prop", }, }, }) From 5d096d92388790ca843ad2c5c3f8c2fad61725d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 13:41:39 +0800 Subject: [PATCH 060/152] =?UTF-8?q?store=20=E5=A2=9E=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5level?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/store.go | 1 + business/partner/purchase/jdshop/store_sku.go | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/business/model/store.go b/business/model/store.go index 918c4e38d..fe2dc0655 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -292,6 +292,7 @@ type Store struct { SMSNotifyMark int8 `orm:"column(sms_notify_mark);" json:"smsNotifyMark"` //今天是否已经推送过订单消息 AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型 LinkStoreID int `orm:"column(link_store_id);default(0);index" json:"linkStoreID"` // 关联门店ID + StoreLevel string `orm:"size(32)" json:"storeLevel"` // 门店等级(筛选用,京西的) PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机 PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-1:小,0:正常,1:大 diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 1af0d1779..ae1ff283d 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -186,15 +186,23 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v // return failedList, err // } } - // for _, vv := range v.StoreSkuSyncInfoJds { - // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) - // if err != nil { - // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - // return failedList, err - // } - // vendorSkuID, err := api.JdShopAPI.UpdateSkus(updateSkusParam) - // vv.VendorSkuID = vendorSkuID - // } + for _, vv := range v.StoreSkuSyncInfoJds { + vendorSku, _ := api.JdShopAPI.FindSkuById(utils.Str2Int64(vv.VendorSkuID)) + if vv.Comment != "" { + err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ + WareID: vv.JdsWareID, + Props: []*jdshopapi.CreateSkuParamAttrs2{ + &jdshopapi.CreateSkuParamAttrs2{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + AttrValueAlias: []string{vv.Comment}, + Type: "com.jd.pop.ware.ic.api.domain.prop", + Type2: "com.jd.pop.ware.ic.api.domain.Prop", + }, + }, + }) + } + } } if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") From 14c1ee13a0461c5750ebebc4230477109e02d10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 13:44:27 +0800 Subject: [PATCH 061/152] =?UTF-8?q?store=20=E5=A2=9E=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5level?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/store.go b/business/model/store.go index fe2dc0655..6ef606bfa 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -292,7 +292,7 @@ type Store struct { SMSNotifyMark int8 `orm:"column(sms_notify_mark);" json:"smsNotifyMark"` //今天是否已经推送过订单消息 AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型 LinkStoreID int `orm:"column(link_store_id);default(0);index" json:"linkStoreID"` // 关联门店ID - StoreLevel string `orm:"size(32)" json:"storeLevel"` // 门店等级(筛选用,京西的) + StoreLevel string `orm:"default(C);size(32)" json:"storeLevel"` // 门店等级(筛选用,京西的) PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机 PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-1:小,0:正常,1:大 From d624b5a06f05ce0fed83820cad4328a0181ef27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 13:56:03 +0800 Subject: [PATCH 062/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 11 +++++++++++ controllers/cms_store.go | 1 + 2 files changed, 12 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 714fe5943..4f8f76c24 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -370,6 +370,17 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte } } + if params["storeLevels"] != nil { + var storeLevels []string + if err = jxutils.Strings2Objs(utils.Interface2String(params["storeLevels"]), &storeLevels); err != nil { + return "", nil, "", nil, err + } + if len(storeLevels) > 0 { + sqlWhere += " AND t1.store_level IN (" + dao.GenQuestionMarks(len(storeLevels)) + ")" + sqlWhereParams = append(sqlWhereParams, storeLevels) + } + } + sql = sqlFrom + sqlWhere sqlParams = append(sqlParams, sqlFromParams...) sqlParams = append(sqlParams, sqlWhereParams...) diff --git a/controllers/cms_store.go b/controllers/cms_store.go index d24330b3c..01c32e164 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -42,6 +42,7 @@ type StoreController struct { // @Param orderCountTo query int false "订单量结束" // @Param marketManPhone query string false "市场负责人电话" // @Param briefLevel query int false "返回信息精简模式" +// @Param storeLevels query string false "门店等级" // @Param offset query int false "门店列表起始序号(以0开始,缺省为0)" // @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)" // @Success 200 {object} controllers.CallResult From b1e2775ecb747bb14b1ad091c0d3f825966e9627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 13:57:13 +0800 Subject: [PATCH 063/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 15005729c..2845122c2 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1084,21 +1084,21 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) } - if order.StoreName != "" { - storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", order.StoreName) - if len(storeMaps) > 0 { - order.StoreID = storeMaps[0].StoreID - order.VendorStoreID = storeMaps[0].VendorStoreID - } - } else { - storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true) - if err != nil { - globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error()) - continue - } - order.StoreID = storeList[0].ID - order.StoreName = storeList[0].Name + // if order.StoreName != "" { + // storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", order.StoreName) + // if len(storeMaps) > 0 { + // order.StoreID = storeMaps[0].StoreID + // order.VendorStoreID = storeMaps[0].VendorStoreID + // } + // } else { + storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true) + if err != nil { + globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error()) + continue } + order.StoreID = storeList[0].ID + order.StoreName = storeList[0].Name + // } //如果是暂停,表示是预订单 if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusPause { order.BusinessType = model.BusinessTypeDingshida From 62633160d1746c9d0dd7333de111e4e9fcb91cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 14:02:11 +0800 Subject: [PATCH 064/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 500 +++++++++++++++--------------- 1 file changed, 250 insertions(+), 250 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 5b3608193..2b75fd4c3 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1613,255 +1613,256 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } var jdsIds = []int64{69355523686, 69353698875, - 69353633443, - 69353579080, - 69353592976, - 69353575450, - 69353669915, - 69353617240, - 69353711276, - 69355552630, - 69353579078, - 69633169613, - 69353608855, - 69634881612, - 69353634806, - 69353675911, - 69353698186, - 69353698877, - 69607962771, - 69608002604, - 69666543870, - 69353541693, - 69411607058, - 69353594629, - 69353602818, - 69353698187, - 69355538267, - 69353633269, - 69355549016, - 69411607059, - 69593365617, - 69353589341, - 69353618034, - 69353633445, - 69353644658, - 69353644659, - 69353664332, - 69355505481, - 69355531215, - 69355552632, - 69353618035, - 69353619589, - 69353684423, - 69353687174, - 69353722053, - 69355493882, - 69627859883, - 69680935348, - 69353555847, - 69353570677, - 69353589397, - 69353592975, - 69353594611, - 69353602819, - 69353616402, - 69353624528, - 69353654004, - 69353668114, - 69353687173, - 69353701089, - 69353722052, - 69353723922, - 69355527850, - 69355552631, - 69628257042, - 69636525703, - 69680935349, - 69353579081, - 69353589342, - 69353632136, - 69353654006, - 69353726354, - 69355496067, - 69355515747, - 69355516049, - 69355527036, - 69355532703, - 69355558164, - 69355560640, - 69608002434, - 69608089252, - 69626869676, - 69628142211, - 69651275202, - 69665458721, - 69980157422, - 69353511255, - 69353550931, - 69353555846, - 69353579079, - 69353593375, - 69353595563, - 69353603501, - 69353608856, - 69353618036, - 69353628469, - 69353628470, - 69353632137, - 69353633267, - 69353633444, - 69353651935, - 69353668115, - 69353683331, - 69353684157, - 69353701088, - 69353723844, - 69353723845, - 69353726353, - 69355490631, - 69355493881, - 69355493884, - 69355520278, - 69355523687, - 69355532705, - 69355533814, - 69355536851, - 69355538268, - 69355538269, - 69593321185, - 69593321186, - 69607997022, - 69626638026, - 69626638027, - 69626872037, - 69627693305, - 69627954144, - 69628180933, - 69633580083, - 69633580085, - 69634881613, - 69635037810, - 69635204944, - 69636212985, - 69636446354, - 69659137913, - 69659219611, - 69665406179, - 69666460731, - 69673523007, - 69680905913, - 69681869918, - 69821176674, - 69913341309, - 69916445013, - 69353511254, - 69353570678, - 69353581400, - 69353589343, - 69353589398, - 69353593376, - 69353594630, - 69353609816, - 69353616406, - 69353617241, - 69353619591, - 69353633268, - 69353634833, - 69353642793, - 69353647695, - 69353651934, - 69353654005, - 69353664333, - 69353669914, - 69353673334, - 69353684159, - 69353684603, - 69353684604, - 69353684605, - 69353684607, - 69353698876, - 69353701090, - 69353711277, - 69353711278, - 69353713475, - 69353726357, - 69355496066, - 69355520277, - 69355523688, - 69355527851, - 69355533813, - 69355533815, - 69355538270, - 69355559874, - 69355559875, - 69355559876, - 69355560641, - 69607988687, - 69608089253, - 69625036409, - 69625436705, - 69626674146, - 69626756838, - 69626849783, - 69626872040, - 69627211928, - 69627823696, - 69627823697, - 69627824429, - 69627859882, - 69627954146, - 69628055157, - 69628209840, - 69628220046, - 69628244518, - 69628620179, - 69628645373, - 69633038980, - 69633169614, - 69633311068, - 69633433209, - 69634285577, - 69634285578, - 69634566319, - 69634566320, - 69634620948, - 69635037811, - 69635075404, - 69635108188, - 69636525704, - 69636563250, - 69636658901, - 69636658902, - 69651265114, - 69659219612, - 69659883978, - 69662122661, - 69666543871, - 69666543872, - 69666660395, - 69666907986, - 69666931214, - 69673508504, - 69680887348, - 69814931154, - 69818078270, - 69881553035, - 69901783885, - 69913362221, - 69916396643, - 69925717199, - 69933144351, - 69933974117, - 69935756246, - 69935768981, - 69935855227, - 69935915640, - 69937601360, - 69937642148, - 69939562884, - 69939571687, - 69948026907} + // 69353633443, + // 69353579080, + // 69353592976, + // 69353575450, + // 69353669915, + // 69353617240, + // 69353711276, + // 69355552630, + // 69353579078, + // 69633169613, + // 69353608855, + // 69634881612, + // 69353634806, + // 69353675911, + // 69353698186, + // 69353698877, + // 69607962771, + // 69608002604, + // 69666543870, + // 69353541693, + // 69411607058, + // 69353594629, + // 69353602818, + // 69353698187, + // 69355538267, + // 69353633269, + // 69355549016, + // 69411607059, + // 69593365617, + // 69353589341, + // 69353618034, + // 69353633445, + // 69353644658, + // 69353644659, + // 69353664332, + // 69355505481, + // 69355531215, + // 69355552632, + // 69353618035, + // 69353619589, + // 69353684423, + // 69353687174, + // 69353722053, + // 69355493882, + // 69627859883, + // 69680935348, + // 69353555847, + // 69353570677, + // 69353589397, + // 69353592975, + // 69353594611, + // 69353602819, + // 69353616402, + // 69353624528, + // 69353654004, + // 69353668114, + // 69353687173, + // 69353701089, + // 69353722052, + // 69353723922, + // 69355527850, + // 69355552631, + // 69628257042, + // 69636525703, + // 69680935349, + // 69353579081, + // 69353589342, + // 69353632136, + // 69353654006, + // 69353726354, + // 69355496067, + // 69355515747, + // 69355516049, + // 69355527036, + // 69355532703, + // 69355558164, + // 69355560640, + // 69608002434, + // 69608089252, + // 69626869676, + // 69628142211, + // 69651275202, + // 69665458721, + // 69980157422, + // 69353511255, + // 69353550931, + // 69353555846, + // 69353579079, + // 69353593375, + // 69353595563, + // 69353603501, + // 69353608856, + // 69353618036, + // 69353628469, + // 69353628470, + // 69353632137, + // 69353633267, + // 69353633444, + // 69353651935, + // 69353668115, + // 69353683331, + // 69353684157, + // 69353701088, + // 69353723844, + // 69353723845, + // 69353726353, + // 69355490631, + // 69355493881, + // 69355493884, + // 69355520278, + // 69355523687, + // 69355532705, + // 69355533814, + // 69355536851, + // 69355538268, + // 69355538269, + // 69593321185, + // 69593321186, + // 69607997022, + // 69626638026, + // 69626638027, + // 69626872037, + // 69627693305, + // 69627954144, + // 69628180933, + // 69633580083, + // 69633580085, + // 69634881613, + // 69635037810, + // 69635204944, + // 69636212985, + // 69636446354, + // 69659137913, + // 69659219611, + // 69665406179, + // 69666460731, + // 69673523007, + // 69680905913, + // 69681869918, + // 69821176674, + // 69913341309, + // 69916445013, + // 69353511254, + // 69353570678, + // 69353581400, + // 69353589343, + // 69353589398, + // 69353593376, + // 69353594630, + // 69353609816, + // 69353616406, + // 69353617241, + // 69353619591, + // 69353633268, + // 69353634833, + // 69353642793, + // 69353647695, + // 69353651934, + // 69353654005, + // 69353664333, + // 69353669914, + // 69353673334, + // 69353684159, + // 69353684603, + // 69353684604, + // 69353684605, + // 69353684607, + // 69353698876, + // 69353701090, + // 69353711277, + // 69353711278, + // 69353713475, + // 69353726357, + // 69355496066, + // 69355520277, + // 69355523688, + // 69355527851, + // 69355533813, + // 69355533815, + // 69355538270, + // 69355559874, + // 69355559875, + // 69355559876, + // 69355560641, + // 69607988687, + // 69608089253, + // 69625036409, + // 69625436705, + // 69626674146, + // 69626756838, + // 69626849783, + // 69626872040, + // 69627211928, + // 69627823696, + // 69627823697, + // 69627824429, + // 69627859882, + // 69627954146, + // 69628055157, + // 69628209840, + // 69628220046, + // 69628244518, + // 69628620179, + // 69628645373, + // 69633038980, + // 69633169614, + // 69633311068, + // 69633433209, + // 69634285577, + // 69634285578, + // 69634566319, + // 69634566320, + // 69634620948, + // 69635037811, + // 69635075404, + // 69635108188, + // 69636525704, + // 69636563250, + // 69636658901, + // 69636658902, + // 69651265114, + // 69659219612, + // 69659883978, + // 69662122661, + // 69666543871, + // 69666543872, + // 69666660395, + // 69666907986, + // 69666931214, + // 69673508504, + // 69680887348, + // 69814931154, + // 69818078270, + // 69881553035, + // 69901783885, + // 69913362221, + // 69916396643, + // 69925717199, + // 69933144351, + // 69933974117, + // 69935756246, + // 69935768981, + // 69935855227, + // 69935915640, + // 69937601360, + // 69937642148, + // 69939562884, + // 69939571687, + // 69948026907 + } db := dao.GetDB() for _, v := range jdsIds { vendorSku, _ := api.JdShopAPI.FindSkuById(v) @@ -1903,7 +1904,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // if storeSkus != nil { // cms.CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, []int{model.VendorIDJDShop}, []int{model.JdShopMainStoreID}, []int{storeSkus.SkuID}, false, true, true) // } - break } return err } From 27b8b34153097271b2c54b449b27f527df2c087b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 14:44:04 +0800 Subject: [PATCH 065/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 4 ++-- business/partner/purchase/jdshop/store_sku.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 2b75fd4c3..817c25d90 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1612,8 +1612,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } var jdsIds = []int64{69355523686, - 69353698875, - // 69353633443, + // 69353698875, + 69353633443, // 69353579080, // 69353592976, // 69353575450, diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index ae1ff283d..0bb6e409f 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -187,6 +187,12 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v // } } for _, vv := range v.StoreSkuSyncInfoJds { + // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) + // if err != nil { + // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + // return failedList, err + // } + // _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) vendorSku, _ := api.JdShopAPI.FindSkuById(utils.Str2Int64(vv.VendorSkuID)) if vv.Comment != "" { err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ @@ -852,6 +858,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) } + sku.SkuID = utils.Str2Int64(v.VendorSkuID) } if attrIDs["类别"] != 0 { values2, _, err2 := api.JdShopAPI.FindValuesByAttrId(attrIDs["类别"]) From 5cbf60b6c1cc6063a94f710b23eed6b55b021a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 14:55:52 +0800 Subject: [PATCH 066/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 498 +++++++++++++++--------------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 817c25d90..4bac31242 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1612,256 +1612,256 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } var jdsIds = []int64{69355523686, - // 69353698875, + 69353698875, 69353633443, - // 69353579080, - // 69353592976, - // 69353575450, - // 69353669915, - // 69353617240, - // 69353711276, - // 69355552630, - // 69353579078, - // 69633169613, - // 69353608855, - // 69634881612, - // 69353634806, - // 69353675911, - // 69353698186, - // 69353698877, - // 69607962771, - // 69608002604, - // 69666543870, - // 69353541693, - // 69411607058, - // 69353594629, - // 69353602818, - // 69353698187, - // 69355538267, - // 69353633269, - // 69355549016, - // 69411607059, - // 69593365617, - // 69353589341, - // 69353618034, - // 69353633445, - // 69353644658, - // 69353644659, - // 69353664332, - // 69355505481, - // 69355531215, - // 69355552632, - // 69353618035, - // 69353619589, - // 69353684423, - // 69353687174, - // 69353722053, - // 69355493882, - // 69627859883, - // 69680935348, - // 69353555847, - // 69353570677, - // 69353589397, - // 69353592975, - // 69353594611, - // 69353602819, - // 69353616402, - // 69353624528, - // 69353654004, - // 69353668114, - // 69353687173, - // 69353701089, - // 69353722052, - // 69353723922, - // 69355527850, - // 69355552631, - // 69628257042, - // 69636525703, - // 69680935349, - // 69353579081, - // 69353589342, - // 69353632136, - // 69353654006, - // 69353726354, - // 69355496067, - // 69355515747, - // 69355516049, - // 69355527036, - // 69355532703, - // 69355558164, - // 69355560640, - // 69608002434, - // 69608089252, - // 69626869676, - // 69628142211, - // 69651275202, - // 69665458721, - // 69980157422, - // 69353511255, - // 69353550931, - // 69353555846, - // 69353579079, - // 69353593375, - // 69353595563, - // 69353603501, - // 69353608856, - // 69353618036, - // 69353628469, - // 69353628470, - // 69353632137, - // 69353633267, - // 69353633444, - // 69353651935, - // 69353668115, - // 69353683331, - // 69353684157, - // 69353701088, - // 69353723844, - // 69353723845, - // 69353726353, - // 69355490631, - // 69355493881, - // 69355493884, - // 69355520278, - // 69355523687, - // 69355532705, - // 69355533814, - // 69355536851, - // 69355538268, - // 69355538269, - // 69593321185, - // 69593321186, - // 69607997022, - // 69626638026, - // 69626638027, - // 69626872037, - // 69627693305, - // 69627954144, - // 69628180933, - // 69633580083, - // 69633580085, - // 69634881613, - // 69635037810, - // 69635204944, - // 69636212985, - // 69636446354, - // 69659137913, - // 69659219611, - // 69665406179, - // 69666460731, - // 69673523007, - // 69680905913, - // 69681869918, - // 69821176674, - // 69913341309, - // 69916445013, - // 69353511254, - // 69353570678, - // 69353581400, - // 69353589343, - // 69353589398, - // 69353593376, - // 69353594630, - // 69353609816, - // 69353616406, - // 69353617241, - // 69353619591, - // 69353633268, - // 69353634833, - // 69353642793, - // 69353647695, - // 69353651934, - // 69353654005, - // 69353664333, - // 69353669914, - // 69353673334, - // 69353684159, - // 69353684603, - // 69353684604, - // 69353684605, - // 69353684607, - // 69353698876, - // 69353701090, - // 69353711277, - // 69353711278, - // 69353713475, - // 69353726357, - // 69355496066, - // 69355520277, - // 69355523688, - // 69355527851, - // 69355533813, - // 69355533815, - // 69355538270, - // 69355559874, - // 69355559875, - // 69355559876, - // 69355560641, - // 69607988687, - // 69608089253, - // 69625036409, - // 69625436705, - // 69626674146, - // 69626756838, - // 69626849783, - // 69626872040, - // 69627211928, - // 69627823696, - // 69627823697, - // 69627824429, - // 69627859882, - // 69627954146, - // 69628055157, - // 69628209840, - // 69628220046, - // 69628244518, - // 69628620179, - // 69628645373, - // 69633038980, - // 69633169614, - // 69633311068, - // 69633433209, - // 69634285577, - // 69634285578, - // 69634566319, - // 69634566320, - // 69634620948, - // 69635037811, - // 69635075404, - // 69635108188, - // 69636525704, - // 69636563250, - // 69636658901, - // 69636658902, - // 69651265114, - // 69659219612, - // 69659883978, - // 69662122661, - // 69666543871, - // 69666543872, - // 69666660395, - // 69666907986, - // 69666931214, - // 69673508504, - // 69680887348, - // 69814931154, - // 69818078270, - // 69881553035, - // 69901783885, - // 69913362221, - // 69916396643, - // 69925717199, - // 69933144351, - // 69933974117, - // 69935756246, - // 69935768981, - // 69935855227, - // 69935915640, - // 69937601360, - // 69937642148, - // 69939562884, - // 69939571687, - // 69948026907 + 69353579080, + 69353592976, + 69353575450, + 69353669915, + 69353617240, + 69353711276, + 69355552630, + 69353579078, + 69633169613, + 69353608855, + 69634881612, + 69353634806, + 69353675911, + 69353698186, + 69353698877, + 69607962771, + 69608002604, + 69666543870, + 69353541693, + 69411607058, + 69353594629, + 69353602818, + 69353698187, + 69355538267, + 69353633269, + 69355549016, + 69411607059, + 69593365617, + 69353589341, + 69353618034, + 69353633445, + 69353644658, + 69353644659, + 69353664332, + 69355505481, + 69355531215, + 69355552632, + 69353618035, + 69353619589, + 69353684423, + 69353687174, + 69353722053, + 69355493882, + 69627859883, + 69680935348, + 69353555847, + 69353570677, + 69353589397, + 69353592975, + 69353594611, + 69353602819, + 69353616402, + 69353624528, + 69353654004, + 69353668114, + 69353687173, + 69353701089, + 69353722052, + 69353723922, + 69355527850, + 69355552631, + 69628257042, + 69636525703, + 69680935349, + 69353579081, + 69353589342, + 69353632136, + 69353654006, + 69353726354, + 69355496067, + 69355515747, + 69355516049, + 69355527036, + 69355532703, + 69355558164, + 69355560640, + 69608002434, + 69608089252, + 69626869676, + 69628142211, + 69651275202, + 69665458721, + 69980157422, + 69353511255, + 69353550931, + 69353555846, + 69353579079, + 69353593375, + 69353595563, + 69353603501, + 69353608856, + 69353618036, + 69353628469, + 69353628470, + 69353632137, + 69353633267, + 69353633444, + 69353651935, + 69353668115, + 69353683331, + 69353684157, + 69353701088, + 69353723844, + 69353723845, + 69353726353, + 69355490631, + 69355493881, + 69355493884, + 69355520278, + 69355523687, + 69355532705, + 69355533814, + 69355536851, + 69355538268, + 69355538269, + 69593321185, + 69593321186, + 69607997022, + 69626638026, + 69626638027, + 69626872037, + 69627693305, + 69627954144, + 69628180933, + 69633580083, + 69633580085, + 69634881613, + 69635037810, + 69635204944, + 69636212985, + 69636446354, + 69659137913, + 69659219611, + 69665406179, + 69666460731, + 69673523007, + 69680905913, + 69681869918, + 69821176674, + 69913341309, + 69916445013, + 69353511254, + 69353570678, + 69353581400, + 69353589343, + 69353589398, + 69353593376, + 69353594630, + 69353609816, + 69353616406, + 69353617241, + 69353619591, + 69353633268, + 69353634833, + 69353642793, + 69353647695, + 69353651934, + 69353654005, + 69353664333, + 69353669914, + 69353673334, + 69353684159, + 69353684603, + 69353684604, + 69353684605, + 69353684607, + 69353698876, + 69353701090, + 69353711277, + 69353711278, + 69353713475, + 69353726357, + 69355496066, + 69355520277, + 69355523688, + 69355527851, + 69355533813, + 69355533815, + 69355538270, + 69355559874, + 69355559875, + 69355559876, + 69355560641, + 69607988687, + 69608089253, + 69625036409, + 69625436705, + 69626674146, + 69626756838, + 69626849783, + 69626872040, + 69627211928, + 69627823696, + 69627823697, + 69627824429, + 69627859882, + 69627954146, + 69628055157, + 69628209840, + 69628220046, + 69628244518, + 69628620179, + 69628645373, + 69633038980, + 69633169614, + 69633311068, + 69633433209, + 69634285577, + 69634285578, + 69634566319, + 69634566320, + 69634620948, + 69635037811, + 69635075404, + 69635108188, + 69636525704, + 69636563250, + 69636658901, + 69636658902, + 69651265114, + 69659219612, + 69659883978, + 69662122661, + 69666543871, + 69666543872, + 69666660395, + 69666907986, + 69666931214, + 69673508504, + 69680887348, + 69814931154, + 69818078270, + 69881553035, + 69901783885, + 69913362221, + 69916396643, + 69925717199, + 69933144351, + 69933974117, + 69935756246, + 69935768981, + 69935855227, + 69935915640, + 69937601360, + 69937642148, + 69939562884, + 69939571687, + 69948026907, } db := dao.GetDB() for _, v := range jdsIds { From 87ff12014f8ef039af222f88a5579c3a5c910581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:03:28 +0800 Subject: [PATCH 067/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 4bac31242..d8eedbfef 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1784,7 +1784,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { 69353701090, 69353711277, 69353711278, - 69353713475, 69353726357, 69355496066, 69355520277, From 83427db136cb3f030ab05e8f3b840175a2974087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:23:09 +0800 Subject: [PATCH 068/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index d8eedbfef..8a05f9ab6 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1875,14 +1875,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { storeSku := skus[0] if sku.Comment != "" { var specQuality = utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit - flag := false - valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(utils.Str2Int(vendorSku.SaleAttrs[0].AttrID)) - for _, vv := range valuesSku { - if vv.Name == specQuality { - flag = true - } - } - if flag { + vendorSkuAttr := vendorSku.SaleAttrs[0].AttrValueAlias[0] + if vendorSkuAttr == specQuality { err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ WareID: vendorSku.WareID, Props: []*jdshopapi.CreateSkuParamAttrs2{ @@ -1896,7 +1890,10 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { }, }) } else { - api.JdShopAPI.SaveVenderAttrValue(sku.Comment, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) + if vendorSkuAttr != sku.Comment { + _, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(utils.Str2Int(vendorSku.SaleAttrs[0].AttrID)) + api.JdShopAPI.SaveVenderAttrValue(sku.Comment, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) + } } } // attrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] From 45868bbf9a849ca892bcbed79e9cc18653a7282e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:44:34 +0800 Subject: [PATCH 069/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 8a05f9ab6..3f33d72d7 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1843,7 +1843,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { 69666931214, 69673508504, 69680887348, - 69814931154, 69818078270, 69881553035, 69901783885, From 8822cc38f6416776c1c62ee2b1abda736d26f63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:48:30 +0800 Subject: [PATCH 070/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 68 +++++++------------ 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 0bb6e409f..662920ccf 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -179,35 +179,15 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v imageURL, err = uploadImg(img, name, "tou") } } - // err2 := api.JdShopAPI.TransparentImageAdd(v.JdsWareID, imageURL) - // if err2 != nil { - // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - // return failedList, err - // } } for _, vv := range v.StoreSkuSyncInfoJds { - // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) - // if err != nil { - // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - // return failedList, err - // } - // _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) - vendorSku, _ := api.JdShopAPI.FindSkuById(utils.Str2Int64(vv.VendorSkuID)) - if vv.Comment != "" { - err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ - WareID: vv.JdsWareID, - Props: []*jdshopapi.CreateSkuParamAttrs2{ - &jdshopapi.CreateSkuParamAttrs2{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - AttrValueAlias: []string{vv.Comment}, - Type: "com.jd.pop.ware.ic.api.domain.prop", - Type2: "com.jd.pop.ware.ic.api.domain.Prop", - }, - }, - }) + updateSkusParam, err := buildUpdateSkusParam(v, vv, false) + if err != nil { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + return failedList, err } + _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) } } if err != nil { @@ -809,26 +789,9 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf } for _, vv := range valuesSku { if vv.Name == specQuality { - // if v.Comment == "" { ggValueID = vv.ID break } - // } - // else { - // //要更新原规格 - // break - // } - // } else { - // if v.Comment != "" { - // if vv.Name == specQuality+" "+v.Comment { - // ggValueID = vv.ID - // break - // } else { - // specQuality += " " + v.Comment - // break - // } - // } - // } } if ggValueID == 0 { //说明没有建这个规格,要建上 catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) @@ -853,11 +816,26 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf sku.StockNum = "0" } if !isCreate { - result, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) + vendorSku, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) err = err2 - if specQuality != result.SaleAttrs[0].AttrValueAlias[0] { - err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) + var attrValue string + if v.Comment != "" { + attrValue = v.Comment + } else { + attrValue = specQuality } + err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ + WareID: v.JdsWareID, + Props: []*jdshopapi.CreateSkuParamAttrs2{ + &jdshopapi.CreateSkuParamAttrs2{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + AttrValueAlias: []string{attrValue}, + Type: "com.jd.pop.ware.ic.api.domain.prop", + Type2: "com.jd.pop.ware.ic.api.domain.Prop", + }, + }, + }) sku.SkuID = utils.Str2Int64(v.VendorSkuID) } if attrIDs["类别"] != 0 { From a7f2efe4dd5e2e9e3dd309e22539fd54bef3c832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:55:30 +0800 Subject: [PATCH 071/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 662920ccf..eb85fc9f2 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -181,14 +181,14 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v } api.JdShopAPI.TransparentImageAdd(v.JdsWareID, imageURL) } - for _, vv := range v.StoreSkuSyncInfoJds { - updateSkusParam, err := buildUpdateSkusParam(v, vv, false) - if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - return failedList, err - } - _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) - } + // for _, vv := range v.StoreSkuSyncInfoJds { + // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) + // if err != nil { + // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + // return failedList, err + // } + // _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) + // } } if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") From 79cf9956df36cc7a986a598776fa7717d8f05070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 15:56:18 +0800 Subject: [PATCH 072/152] =?UTF-8?q?beta=E7=9A=84=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/app.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.conf b/conf/app.conf index f9ab2bab5..ef6f86ce8 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -395,7 +395,7 @@ enableElmStoreWrite = false enableMtwmStoreWrite = false enableWscStoreWrite = false enableYbStoreWrite = false -enableJdShopWrite = false +enableJdShopWrite = true jdOrgCode = "320406" jdLoginName = "jd_jxcs1223" From 769202e8328e1e8a7e61d56221edeee632358c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 17:26:43 +0800 Subject: [PATCH 073/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E7=AB=A0=EF=BC=8C=E9=A5=BF=E7=99=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 2 +- business/model/dao/store_sku.go | 4 ++++ business/model/sku.go | 1 + business/partner/purchase/ebai/store_sku2.go | 6 ++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index deac305ac..094f9e3a8 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -903,7 +903,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf } } globals.SugarLogger.Debugf("UpdateSkuName valid:%s", utils.Format4Output(valid, false)) - for _, imgName := range []string{"img", "img2"} { + for _, imgName := range []string{"img", "img2", "img3"} { if valid[imgName] != nil { if imgStr := utils.Interface2String(valid[imgName]); imgStr != "" { _, err2 := datares.TryRegisterDataResource(ctx, skuName.Name, valid[imgName].(string), model.ImgTypeMain, true) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 259365ed6..0542f38dc 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -91,6 +91,7 @@ type StoreSkuSyncInfo struct { // 平台相关的图片信息 Img string Img2 string + Img3 string DescImg string VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"` // 平台商品分类(叶子结点) @@ -407,6 +408,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t3.jds_stock_switch, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, + IF(t14.%s <> '', t14.%s, t3.img3) img3, IF(t13.%s <> '', t13.%s, t3.desc_img) desc_img, t4.%s_category_id vendor_vendor_cat_id, t4.name category_name, @@ -416,6 +418,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), + GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), fieldPrefix, } if isSingleStorePF { @@ -441,6 +444,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo LEFT JOIN sku_category t4 ON t3.category_id = t4.id AND t4.deleted_at = ? LEFT JOIN data_resource t11 ON t11.main_url = t3.img LEFT JOIN data_resource t12 ON t12.main_url = t3.img2 + LEFT JOIN data_resource t14 ON t14.main_url = t3.img3 LEFT JOIN data_resource t13 ON t13.main_url = t3.desc_img ` sqlParams := []interface{}{ diff --git a/business/model/sku.go b/business/model/sku.go index 6d1a8e8fb..82598d7fe 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -170,6 +170,7 @@ type SkuName struct { Img string `orm:"size(512)" json:"img"` Img2 string `orm:"size(512)" json:"img2"` // 第二张图片 + Img3 string `orm:"size(512)" json:"img3"` //第三张图片 // ImgEbai string `orm:"size(255)" json:"imgEbai"` // 饿百图片地址 // ImgHashCode string `orm:"size(255);index" json:"img_hash_code"` diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index be00e1a67..399444257 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -328,6 +328,12 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE "url": storeSku.Img2, }) } + if storeSku.Img3 != "" { + photos = append(photos, map[string]interface{}{ + "is_master": false, + "url": storeSku.Img3, + }) + } params = map[string]interface{}{ // "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount), "left_num": model.MaxStoreSkuStockQty, From 9656e7699e739f8f1b811bc77b30a5526edf9431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 17:31:40 +0800 Subject: [PATCH 074/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E7=AB=A0=EF=BC=8C=E9=A5=BF=E7=99=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 094f9e3a8..d4c168b3c 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -588,6 +588,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.price, t1.img, t1.img2, + t1.img3, t1.status, t1.is_spu, t1.desc_img, @@ -624,6 +625,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.price, t1.img, t1.img2, + t1.img3, t1.status, t1.is_spu, t1.desc_img, From d35134fae09f834f122df7a60a2fc61ac277ac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Jun 2020 17:53:36 +0800 Subject: [PATCH 075/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=90=8E=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 662920ccf..b85493b58 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -793,9 +793,11 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf break } } - if ggValueID == 0 { //说明没有建这个规格,要建上 - catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) - ggValueID = catID + if isCreate { + if ggValueID == 0 { //说明没有建这个规格,要建上 + catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) + ggValueID = catID + } } attrSku := &jdshopapi.CreateSkuParamAttrs{ AttrID: utils.Int2Str(attrIDs["规格"]), From 96318f322d8553e4059fe372bdb1fe38498ead81 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 11 Jun 2020 19:56:15 +0800 Subject: [PATCH 076/152] t14 --- business/model/dao/store_sku.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 0542f38dc..b58bf9e50 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -408,7 +408,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t3.jds_stock_switch, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, - IF(t14.%s <> '', t14.%s, t3.img3) img3, + IF(t15.%s <> '', t15.%s, t3.img3) img3, IF(t13.%s <> '', t13.%s, t3.desc_img) desc_img, t4.%s_category_id vendor_vendor_cat_id, t4.name category_name, @@ -444,7 +444,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo LEFT JOIN sku_category t4 ON t3.category_id = t4.id AND t4.deleted_at = ? LEFT JOIN data_resource t11 ON t11.main_url = t3.img LEFT JOIN data_resource t12 ON t12.main_url = t3.img2 - LEFT JOIN data_resource t14 ON t14.main_url = t3.img3 + LEFT JOIN data_resource t15 ON t15.main_url = t3.img3 LEFT JOIN data_resource t13 ON t13.main_url = t3.desc_img ` sqlParams := []interface{}{ From 639feb4ee36b9a8032f4bf445af3dcd6f5d531b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 09:44:46 +0800 Subject: [PATCH 077/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 146 +++++++++--------- 1 file changed, 77 insertions(+), 69 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index b85493b58..2ae8d0dab 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -759,9 +759,30 @@ func filterSensitiveWord(name string) (result string) { } func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInfo, isCreate bool) (updateSkusParam *jdshopapi.UpdateSkusParam, err error) { + var ( + ggValueID int64 //规格的属性id + attrsPropSku []*jdshopapi.CreateSkuParamAttrs + skus []*jdshopapi.UpdateSkusParamSkus + multiPropSku []*jdshopapi.CreateSkuParamAttrs + specQuality string + ) updateSkusParam = &jdshopapi.UpdateSkusParam{ WareID: storeSku.JdsWareID, } + sku := &jdshopapi.UpdateSkusParamSkus{ + WareID: storeSku.JdsWareID, + JdPrice: jxutils.IntPrice2Standard(v.VendorPrice), + Type: "com.jd.pop.ware.ic.api.domain.sku", + Type2: "com.jd.pop.ware.ic.api.domain.Sku", + OuterID: utils.Int2Str(v.SkuID), + } + //库存设置 + if v.Status == model.SkuStatusNormal { + sku.StockNum = "9999" + } else { + sku.StockNum = "0" + } + //规格类别设置 attrIDs := make(map[string]int) attrs, err := api.JdShopAPI.FindAttrs(int(storeSku.VendorVendorCatID)) for _, v := range attrs { @@ -771,75 +792,6 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf attrIDs[v.Name] = v.ID } } - var ( - ggValueID int64 //规格的属性id - attrsPropSku []*jdshopapi.CreateSkuParamAttrs - skus []*jdshopapi.UpdateSkusParamSkus - multiPropSku []*jdshopapi.CreateSkuParamAttrs - specQuality string - ) - valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) - if v.SpecUnit == model.SpecUnitNames[1] || v.SpecUnit == model.SpecUnitNames[2] { - specQuality = strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit - } else { - specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit - } - if v.Comment != "" { - specQuality = v.Comment - } - for _, vv := range valuesSku { - if vv.Name == specQuality { - ggValueID = vv.ID - break - } - } - if isCreate { - if ggValueID == 0 { //说明没有建这个规格,要建上 - catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) - ggValueID = catID - } - } - attrSku := &jdshopapi.CreateSkuParamAttrs{ - AttrID: utils.Int2Str(attrIDs["规格"]), - AttrValues: []string{utils.Int64ToStr(ggValueID)}, - } - attrsPropSku = append(attrsPropSku, attrSku) - sku := &jdshopapi.UpdateSkusParamSkus{ - WareID: storeSku.JdsWareID, - JdPrice: jxutils.IntPrice2Standard(v.VendorPrice), - Type: "com.jd.pop.ware.ic.api.domain.sku", - Type2: "com.jd.pop.ware.ic.api.domain.Sku", - OuterID: utils.Int2Str(v.SkuID), - } - sku.SaleAttrs = attrsPropSku - if v.Status == model.SkuStatusNormal { - sku.StockNum = "9999" - } else { - sku.StockNum = "0" - } - if !isCreate { - vendorSku, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) - err = err2 - var attrValue string - if v.Comment != "" { - attrValue = v.Comment - } else { - attrValue = specQuality - } - err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ - WareID: v.JdsWareID, - Props: []*jdshopapi.CreateSkuParamAttrs2{ - &jdshopapi.CreateSkuParamAttrs2{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - AttrValueAlias: []string{attrValue}, - Type: "com.jd.pop.ware.ic.api.domain.prop", - Type2: "com.jd.pop.ware.ic.api.domain.Prop", - }, - }, - }) - sku.SkuID = utils.Str2Int64(v.VendorSkuID) - } if attrIDs["类别"] != 0 { values2, _, err2 := api.JdShopAPI.FindValuesByAttrId(attrIDs["类别"]) err = err2 @@ -851,6 +803,62 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf multiPropSku = append(multiPropSku, attrlb) } sku.MultiCateProps = multiPropSku + if v.SpecUnit == model.SpecUnitNames[1] || v.SpecUnit == model.SpecUnitNames[2] { + specQuality = strings.TrimRight(fmt.Sprintf("%.2f", float64(v.SpecQuality)), "0.") + v.SpecUnit + } else { + specQuality = utils.Float64ToStr(float64(v.SpecQuality)) + v.SpecUnit + } + valuesSku, maxNo, _ := api.JdShopAPI.FindValuesByAttrId(attrIDs["规格"]) + if isCreate { + for _, vv := range valuesSku { + if vv.Name == specQuality { + ggValueID = vv.ID + break + } + } + if ggValueID == 0 { //说明没有建这个规格,要建上 + catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, attrIDs["规格"], int(storeSku.VendorVendorCatID), maxNo+1) + ggValueID = catID + } + attrSku := &jdshopapi.CreateSkuParamAttrs{ + AttrID: utils.Int2Str(attrIDs["规格"]), + AttrValues: []string{utils.Int64ToStr(ggValueID)}, + } + attrsPropSku = append(attrsPropSku, attrSku) + sku.SaleAttrs = attrsPropSku + } else { + vendorSku, err2 := api.JdShopAPI.FindSkuById(utils.Str2Int64(v.VendorSkuID)) + err = err2 + vendorAttrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] + if v.Comment != "" { + if v.Comment != vendorAttrValue { + err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ + WareID: v.JdsWareID, + Props: []*jdshopapi.CreateSkuParamAttrs2{ + &jdshopapi.CreateSkuParamAttrs2{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + AttrValueAlias: []string{v.Comment}, + Type: "com.jd.pop.ware.ic.api.domain.prop", + Type2: "com.jd.pop.ware.ic.api.domain.Prop", + }, + }, + }) + sku.SkuID = utils.Str2Int64(v.VendorSkuID) + } + } else { + if vendorAttrValue != specQuality { + catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) + attrSku := &jdshopapi.CreateSkuParamAttrs{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{utils.Int64ToStr(catID)}, + } + attrsPropSku = append(attrsPropSku, attrSku) + sku.SaleAttrs = attrsPropSku + err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) + } + } + } skus = append(skus, sku) updateSkusParam.Skus = skus return updateSkusParam, err From 269e19db7dbc3ddba780d1b914a0d9690d478b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 10:26:53 +0800 Subject: [PATCH 078/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 2ae8d0dab..8f8db0faf 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -845,6 +845,12 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf }, }) sku.SkuID = utils.Str2Int64(v.VendorSkuID) + attrSku := &jdshopapi.CreateSkuParamAttrs{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + } + attrsPropSku = append(attrsPropSku, attrSku) + sku.SaleAttrs = attrsPropSku } } else { if vendorAttrValue != specQuality { From 6339eed107e589f505d31e4c9054786d290faaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 10:31:06 +0800 Subject: [PATCH 079/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index 8f8db0faf..f06485231 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -845,13 +845,13 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf }, }) sku.SkuID = utils.Str2Int64(v.VendorSkuID) - attrSku := &jdshopapi.CreateSkuParamAttrs{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - } - attrsPropSku = append(attrsPropSku, attrSku) - sku.SaleAttrs = attrsPropSku } + attrSku := &jdshopapi.CreateSkuParamAttrs{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + } + attrsPropSku = append(attrsPropSku, attrSku) + sku.SaleAttrs = attrsPropSku } else { if vendorAttrValue != specQuality { catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) From 1782dd07d9f39ce3282f72112eed54786215e390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 10:41:29 +0800 Subject: [PATCH 080/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 55 ++++++++----------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index f06485231..d4f7bbbb5 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -831,39 +831,30 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf err = err2 vendorAttrValue := vendorSku.SaleAttrs[0].AttrValueAlias[0] if v.Comment != "" { - if v.Comment != vendorAttrValue { - err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ - WareID: v.JdsWareID, - Props: []*jdshopapi.CreateSkuParamAttrs2{ - &jdshopapi.CreateSkuParamAttrs2{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - AttrValueAlias: []string{v.Comment}, - Type: "com.jd.pop.ware.ic.api.domain.prop", - Type2: "com.jd.pop.ware.ic.api.domain.Prop", - }, - }, - }) - sku.SkuID = utils.Str2Int64(v.VendorSkuID) - } - attrSku := &jdshopapi.CreateSkuParamAttrs{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, - } - attrsPropSku = append(attrsPropSku, attrSku) - sku.SaleAttrs = attrsPropSku - } else { - if vendorAttrValue != specQuality { - catID, _ := api.JdShopAPI.SaveVenderAttrValue(specQuality, utils.Str2Int(vendorSku.SaleAttrs[0].AttrID), int(storeSku.VendorVendorCatID), maxNo+1) - attrSku := &jdshopapi.CreateSkuParamAttrs{ - AttrID: vendorSku.SaleAttrs[0].AttrID, - AttrValues: []string{utils.Int64ToStr(catID)}, - } - attrsPropSku = append(attrsPropSku, attrSku) - sku.SaleAttrs = attrsPropSku - err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID)) - } + specQuality = v.Comment } + if v.Comment != vendorAttrValue { + err = api.JdShopAPI.UpdateWareSaleAttrvalueAlias(&jdshopapi.UpdateWareSaleAttrvalueAliasParam{ + WareID: v.JdsWareID, + Props: []*jdshopapi.CreateSkuParamAttrs2{ + &jdshopapi.CreateSkuParamAttrs2{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + AttrValueAlias: []string{specQuality}, + Type: "com.jd.pop.ware.ic.api.domain.prop", + Type2: "com.jd.pop.ware.ic.api.domain.Prop", + }, + }, + }) + sku.SkuID = utils.Str2Int64(v.VendorSkuID) + } + attrSku := &jdshopapi.CreateSkuParamAttrs{ + AttrID: vendorSku.SaleAttrs[0].AttrID, + AttrValues: []string{vendorSku.SaleAttrs[0].AttrValues[0]}, + } + attrsPropSku = append(attrsPropSku, attrSku) + sku.SaleAttrs = attrsPropSku + } skus = append(skus, sku) updateSkusParam.Skus = skus From a9cc733d3e5de26c061ed3f44c1853fc514d414e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 10:59:47 +0800 Subject: [PATCH 081/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index cc8da482b..ec850a914 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -181,14 +181,14 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v } api.JdShopAPI.TransparentImageAdd(v.JdsWareID, imageURL) } - // for _, vv := range v.StoreSkuSyncInfoJds { - // updateSkusParam, err := buildUpdateSkusParam(v, vv, false) - // if err != nil { - // failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") - // return failedList, err - // } - // _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) - // } + for _, vv := range v.StoreSkuSyncInfoJds { + updateSkusParam, err := buildUpdateSkusParam(v, vv, false) + if err != nil { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") + return failedList, err + } + _, err = api.JdShopAPI.UpdateSkus(updateSkusParam) + } } if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "更新商品基础信息") @@ -854,7 +854,6 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf } attrsPropSku = append(attrsPropSku, attrSku) sku.SaleAttrs = attrsPropSku - } skus = append(skus, sku) updateSkusParam.Skus = skus From ca3d59833f38ba515ae45552f536af383b48d5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 13:40:19 +0800 Subject: [PATCH 082/152] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=89=A3=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index d25feca42..497e114f9 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4505,6 +4505,7 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto db := dao.GetDB() for _, storeID := range storeIDs { stores, _ := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") + //扣点的门店改价不进审核 if len(stores) > 0 { if stores[0].PayPercentage <= 50 { globals.SugarLogger.Debugf("doStoreSkuAudit return0 storeID : %v", storeID) From 290d2f4693f74fb5a4a40e52094f8742b53aaa64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 15:03:43 +0800 Subject: [PATCH 083/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8A=E4=B8=8B=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index ec850a914..d860cb8e6 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -777,7 +777,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf OuterID: utils.Int2Str(v.SkuID), } //库存设置 - if v.Status == model.SkuStatusNormal { + if v.StoreSkuStatus == model.SkuStatusNormal { sku.StockNum = "9999" } else { sku.StockNum = "0" From bb0d49efd445b0d819f179ee59f43c3fc261ea1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 17:13:27 +0800 Subject: [PATCH 084/152] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BA=8F=E6=8D=9F?= =?UTF-8?q?=E8=A7=84=E5=88=99=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=B8=A6=E9=97=A8=E5=BA=97=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 2 +- business/model/dao/store_sku.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 6080c5bc4..05a191a65 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1443,7 +1443,7 @@ func OrderProfitWarning(order *model.GoodsOrder) { if storeDetail != nil && err == nil { payPercentage := storeDetail.PayPercentage if payPercentage >= 50 { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.ShopPrice)) / 100 } else { profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index b58bf9e50..93ca0e6e2 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1558,6 +1558,7 @@ type tStoreSkuAudit struct { MidUnitPrice int `json:"midUnitPrice"` CityName string `json:"cityName"` PayPercentage int `json:"payPercentage"` + StoreLevel string `json:"StoreLevel"` } func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int, name, remark, keyword, marketManPhone, cityName string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) { @@ -1565,7 +1566,7 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int sql := ` SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, c.name sku_name, c.prefix, c.unit, c.spec_quality, c.spec_unit, c.img, - d.name store_name, b.name, e.mid_unit_price, f.name city_name, d.pay_percentage + d.name store_name, b.name, e.mid_unit_price, f.name city_name, d.pay_percentage, d.store_level FROM store_sku_audit a LEFT JOIN user b ON a.user_id = b.user_id LEFT JOIN sku_name c ON c.id = a.name_id AND c.deleted_at = ? From 07593d28869904f945064fc0b07f2670913c6038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 17:17:20 +0800 Subject: [PATCH 085/152] =?UTF-8?q?=E5=A4=A7=E5=86=99=E7=9A=84S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 93ca0e6e2..5468ea5f1 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1558,7 +1558,7 @@ type tStoreSkuAudit struct { MidUnitPrice int `json:"midUnitPrice"` CityName string `json:"cityName"` PayPercentage int `json:"payPercentage"` - StoreLevel string `json:"StoreLevel"` + StoreLevel string `json:"storeLevel"` } func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int, name, remark, keyword, marketManPhone, cityName string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) { From ccc6fbb0e27a37d162b4cf2a7eed70f5397dc30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 17:35:40 +0800 Subject: [PATCH 086/152] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BA=8F=E6=8D=9F?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=BB=99=E9=97=A8=E5=BA=97=E8=B4=9F=E8=B4=A3?= =?UTF-8?q?=E4=BA=BA=E7=BB=84=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jxcallback/scheduler/defsch/defsch.go | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 05a191a65..ab88ab3eb 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -6,6 +6,10 @@ import ( "sync" "time" + "git.rosy.net.cn/jx-callback/business/jxstore/cms" + + "git.rosy.net.cn/jx-callback/business/authz" + "git.rosy.net.cn/jx-callback/business/authz/autils" "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop" @@ -1449,11 +1453,34 @@ func OrderProfitWarning(order *model.GoodsOrder) { } if profit < 0 { operatorPhone, operatorName := getOrderOperatorInfo(order, storeDetail) + operatorRole := getOrderOperatorRoleInfo(order, storeDetail) if operatorPhone != "" { + var ( + roleList []*authz.RoleInfo + userIDs []string + flag = false + ) + roleList = append(roleList, autils.NewRole(operatorRole, 0)) + userIDMap, err := cms.GetRolesUserList(jxcontext.AdminCtx, roleList) noticeMsg := fmt.Sprintf("利润 :[%v],运营负责人:[%v],门店ID:[%v],平台门店ID[%v],门店名:[%v],订单序号:[%v],订单号(点击进入详情):%v", profit, operatorName, order.StoreID, order.VendorStoreID, order.StoreName, order.OrderSeq, globals.BackstageHost+"/#/ordermanager/"+order.VendorOrderID) user, err := dao.GetUserByID(db, "mobile", operatorPhone) if user != nil && err == nil { - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "警告!此订单利润低于0", noticeMsg) + for _, v := range userIDMap { + for _, vv := range v { + userIDs = append(userIDs, vv) + } + } + for _, v := range userIDs { + if v == user.UserID { + flag = true + } + } + if !flag { + userIDs = append(userIDs, user.UserID) + } + for _, v := range userIDs { + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, v, "警告!此订单利润低于0", noticeMsg) + } } } } @@ -1502,3 +1529,15 @@ func getOrderOperatorInfo(order *model.GoodsOrder, storeDetail *dao.StoreDetail) } return operatorPhone, operatorName } + +func getOrderOperatorRoleInfo(order *model.GoodsOrder, storeDetail *dao.StoreDetail) (roleName string) { + switch order.VendorID { + case model.VendorIDJD: + roleName = storeDetail.OperatorRole + case model.VendorIDMTWM: + roleName = storeDetail.OperatorRole2 + case model.VendorIDEBAI: + roleName = storeDetail.OperatorRole3 + } + return roleName +} From 90a55cc5c26c5bc42de644abfd9c5b49c3950eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Jun 2020 17:59:08 +0800 Subject: [PATCH 087/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E5=92=8C=E5=90=88=E6=88=90=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 6 +++++- business/model/sku.go | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index d4c168b3c..00e809004 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -589,6 +589,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.img, t1.img2, t1.img3, + t1.img_watermark, + t1.img_mix, t1.status, t1.is_spu, t1.desc_img, @@ -626,6 +628,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.img, t1.img2, t1.img3, + t1.img_watermark, + t1.img_mix, t1.status, t1.is_spu, t1.desc_img, @@ -905,7 +909,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf } } globals.SugarLogger.Debugf("UpdateSkuName valid:%s", utils.Format4Output(valid, false)) - for _, imgName := range []string{"img", "img2", "img3"} { + for _, imgName := range []string{"img", "img2", "img3", "img_watermark", "img_mix"} { if valid[imgName] != nil { if imgStr := utils.Interface2String(valid[imgName]); imgStr != "" { _, err2 := datares.TryRegisterDataResource(ctx, skuName.Name, valid[imgName].(string), model.ImgTypeMain, true) diff --git a/business/model/sku.go b/business/model/sku.go index 82598d7fe..405c2836f 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -168,9 +168,11 @@ type SkuName struct { SpecUnit string `orm:"size(8)" json:"-"` // 为份必然为克,这个主要作用只是用于确保SkuName的唯一性 Price int `json:"price"` // 单位为分,标准价,不为份的就为实际标准价,为份的为每市斤价,实际还要乘质量。todo 为份的确定必须有质量 - Img string `orm:"size(512)" json:"img"` - Img2 string `orm:"size(512)" json:"img2"` // 第二张图片 - Img3 string `orm:"size(512)" json:"img3"` //第三张图片 + Img string `orm:"size(512)" json:"img"` + Img2 string `orm:"size(512)" json:"img2"` // 第二张图片 + Img3 string `orm:"size(512)" json:"img3"` //第三张图片 + ImgWatermark string `orm:"size(512)" json:"imgWatermark"` //图片水印 + ImgMix string `orm:"size(512)" json:"imgMix"` //图片混合水印的图片 // ImgEbai string `orm:"size(255)" json:"imgEbai"` // 饿百图片地址 // ImgHashCode string `orm:"size(255);index" json:"img_hash_code"` From b238a9354f6783fa33ff7fd17fbd636538313d56 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 12 Jun 2020 21:36:13 +0800 Subject: [PATCH 088/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=80=81=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/model/store.go b/business/model/store.go index 6ef606bfa..4acfb3ba0 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -336,6 +336,7 @@ type Store struct { PayeeBankBranchName string `orm:"size(255)" json:"payeeBankBranchName"` // 开户支行 PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码 PayPercentage int `json:"payPercentage"` + OldPayPercentage int `json:"oldPayPercentage"` // OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名 OperatorPhone string `orm:"size(16)" json:"operatorPhone"` // 京东运营人电话 From 96f660b6e170ca68dbfba9cceccd3e6b5aecba26 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 12 Jun 2020 21:42:03 +0800 Subject: [PATCH 089/152] =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=80=81=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/api.go | 7 ++++--- business/model/dao/dao_order.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/business/model/api.go b/business/model/api.go index b70527b5f..ebf5aeead 100644 --- a/business/model/api.go +++ b/business/model/api.go @@ -35,9 +35,10 @@ type GoodsOrderExt struct { WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"` WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"` - DistrictName string `json:"districtName"` - CityName string `json:"cityName"` - PayPercentage int `json:"payPercentage"` + DistrictName string `json:"districtName"` + CityName string `json:"cityName"` + PayPercentage int `json:"payPercentage"` + OldPayPercentage int `json:"oldPayPercentage"` SkuInfo string `json:"skuInfo,omitempty"` SkuInfo2 string `json:"skuInfo2,omitempty"` diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 6f090329b..eeceaa567 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -767,7 +767,7 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat CAST(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, %d) / 100) AS SIGNED) earning_price, t2.status waybill_status, t2.courier_name, t2.courier_mobile, t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at, - t5.pay_percentage, + t5.pay_percentage, t5.old_pay_percentage, city.name city_name, district.name district_name`, model.DefaultEarningPricePercentage) if isIncludeSku { sql += `, From 3b7c76a174c6eaef565355844d61de0d59067611 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Sat, 13 Jun 2020 12:18:10 +0800 Subject: [PATCH 090/152] =?UTF-8?q?=E5=85=88=E4=B8=8D=E5=8F=91=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E5=AE=A1=E6=A0=B8=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 497e114f9..ad451cb97 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4602,10 +4602,10 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku if len(storeAudits) > 1 { return retVal, fmt.Errorf("查询到该门店该商品的待审核信息大于1条!storeID: %v, nameID: %v", storeAudit.StoreID, storeAudit.NameID) } - flag := false + // flag := false //审核通过 if status == model.StoreAuditStatusCreated { - flag = true + // flag = true storeAudits[0].UserID = ctx.GetUserID() storeAudits[0].Status = model.StoreAuditStatusCreated storeAudits[0].Remark = storeAudit.Remark @@ -4648,19 +4648,20 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku } else { return retVal, fmt.Errorf("审核标志不正确!") } + //TODO 暂时先不推消息了 if err == nil { - if globals.IsProductEnv() { - skuAndNames, err := dao.GetSkus(db, nil, []int{storeAudit.NameID}, nil, nil, nil) - if len(skuAndNames) > 0 && err == nil { - price := 0 - if storeAudit.AuditPrice != 0 { - price = storeAudit.AuditPrice - } else { - price = storeAudits[0].UnitPrice - } - weixinmsg.NotifyStoreOpRequestStatus(flag, storeAudit.StoreID, storeAudit.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, price, storeAudit.Remark) - } - } + // if globals.IsProductEnv() { + // skuAndNames, err := dao.GetSkus(db, nil, []int{storeAudit.NameID}, nil, nil, nil) + // if len(skuAndNames) > 0 && err == nil { + // price := 0 + // if storeAudit.AuditPrice != 0 { + // price = storeAudit.AuditPrice + // } else { + // price = storeAudits[0].UnitPrice + // } + // weixinmsg.NotifyStoreOpRequestStatus(flag, storeAudit.StoreID, storeAudit.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, price, storeAudit.Remark) + // } + // } } return retVal, err }, storeSkuAudits) From f187dbc5cb76751718aefe974a6c5fee77e4d8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 15 Jun 2020 11:02:45 +0800 Subject: [PATCH 091/152] =?UTF-8?q?=E5=95=86=E5=93=81=E5=87=86=E5=A4=87?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- business/model/sku.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index d25feca42..681a0ffec 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1107,7 +1107,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.Status = tmpStatus } if globals.IsAddEvent { - err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", "") + err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice)) } setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask) dao.WrapAddIDCULDEntity(skuBind, userName) diff --git a/business/model/sku.go b/business/model/sku.go index 405c2836f..b736e0b9c 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -187,8 +187,9 @@ type SkuName struct { // JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"` // LinkID int `orm:"column(link_id);null;index" json:"linkID"` - YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 - JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` + YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 + JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` + PreparationTime int `orm:"default(1)" json:"preparationTime"` } func (*SkuName) TableUnique() [][]string { From eb53afe20bdf63b9399d8196081f4a24c64b0b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 15 Jun 2020 11:09:25 +0800 Subject: [PATCH 092/152] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=87=86=E5=A4=87=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 4 +++- business/model/dao/store_sku.go | 25 ++++++++++---------- business/model/sku.go | 6 ++--- business/partner/purchase/ebai/store_sku2.go | 5 ++-- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 00e809004..2a6a30979 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -599,7 +599,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.ex_prefix_begin, t1.ex_prefix_end, t1.yb_name_suffix, - t1.jds_stock_switch + t1.jds_stock_switch, + t1.preparation_time ` if isQueryMidPrice { sql += `, @@ -643,6 +644,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.ex_prefix_end, t1.yb_name_suffix, t1.jds_stock_switch, + t1.preparation_time, ` if isQueryMidPrice { sqlData += " t4.mid_unit_price," diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 5468ea5f1..7a5fcfd6b 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -76,17 +76,18 @@ type StoreSkuSyncInfo struct { ExPrefixBegin *time.Time ExPrefixEnd *time.Time // NameID int `orm:"column(name_id)"` - VendorNameID string `orm:"column(vendor_name_id)"` // 暂时无用 - Name string - Unit string - Upc string - IsGlobal int8 `orm:"default(1)" json:"isGlobal"` // 是否是全部(全国)可见,如果否的话,可见性由SkuPlace决定 - NameStatus int - SellCities []string - NameCategoryID int `orm:"column(name_category_id)"` - YbNameSuffix string //银豹的商品条码后缀 - YbBarCode string //银豹的商品条码 - JdsStockSwitch int + VendorNameID string `orm:"column(vendor_name_id)"` // 暂时无用 + Name string + Unit string + Upc string + IsGlobal int8 `orm:"default(1)" json:"isGlobal"` // 是否是全部(全国)可见,如果否的话,可见性由SkuPlace决定 + NameStatus int + SellCities []string + NameCategoryID int `orm:"column(name_category_id)"` + YbNameSuffix string //银豹的商品条码后缀 + YbBarCode string //银豹的商品条码 + JdsStockSwitch int + PreparationTime int // 平台相关的图片信息 Img string @@ -405,7 +406,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t2.*, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, t3.yb_name_suffix, - t3.jds_stock_switch, + t3.jds_stock_switch, t3.preparation_time, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, IF(t15.%s <> '', t15.%s, t3.img3) img3, diff --git a/business/model/sku.go b/business/model/sku.go index b736e0b9c..de217f04c 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -187,9 +187,9 @@ type SkuName struct { // JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"` // LinkID int `orm:"column(link_id);null;index" json:"linkID"` - YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 - JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` - PreparationTime int `orm:"default(1)" json:"preparationTime"` + YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 + JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` //京东商城总库存 + PreparationTime int `orm:"default(1)" json:"preparationTime"` //商品准备时长 } func (*SkuName) TableUnique() [][]string { diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index 399444257..f17ce5bf1 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -340,8 +340,9 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE // "category_id": utils.Str2Int64(storeSku.VendorCatID), "predict_cat": 0, // 不使用推荐类目 // "cat3_id": getEbaiCat(storeSku.VendorVendorCatID), - "weight": storeSku.Weight, - "photos": photos, + "weight": storeSku.Weight, + "photos": photos, + "preparation_time": storeSku.PreparationTime, } if !isExd { params["category_id"] = utils.Str2Int64(storeSku.VendorCatID) From c745df603d0fdbcfe9b482771ef470b43be2f17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 15 Jun 2020 11:50:48 +0800 Subject: [PATCH 093/152] =?UTF-8?q?E=E7=BA=A7=E9=97=A8=E5=BA=97=E4=B8=8D?= =?UTF-8?q?=E5=81=9A=E5=95=86=E5=93=81=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 749cb9845..3797731e9 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4507,7 +4507,7 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto stores, _ := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") //扣点的门店改价不进审核 if len(stores) > 0 { - if stores[0].PayPercentage <= 50 { + if stores[0].PayPercentage <= 50 || stores[0].StoreLevel == "E" { globals.SugarLogger.Debugf("doStoreSkuAudit return0 storeID : %v", storeID) return false, err } From 605dd7239655d3e06a9707c7d870b9dcf628f653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 15 Jun 2020 14:19:28 +0800 Subject: [PATCH 094/152] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E6=9E=9C=E5=9B=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/waybill.go | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 20c18c817..9dcc3dff1 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -3,6 +3,8 @@ package mtps import ( "errors" "fmt" + "net/http" + "strings" "time" "git.rosy.net.cn/baseapi/platformapi/mtpsapi" @@ -99,9 +101,36 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m globals.SugarLogger.Warnf("onWaybillMsg unknown msg:%v", msg) return mtpsapi.SuccessResponse } + c.pushToGy(order, msg) return mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } +func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.CallbackOrderMsg) { + order, _ := dao.GetSimpleOrder(dao.GetDB(), waybill.VendorOrderID) + //查不到订单可能就是果园的订单 + if order == nil { + cl := http.Client{} + params := make(map[string]interface{}) + params["mt_peisong_id"] = msg.MtPeisongID + params["courier_name"] = msg.CourierName + params["delivery_id"] = msg.DeliveryID + params["sign"] = msg.Sign + params["appkey"] = msg.AppKey + params["order_id"] = msg.OrderID + params["courier_phone"] = msg.CourierPhone + params["status"] = msg.Status + params["timestamp"] = msg.Timestamp + params["cancel_reason_id"] = msg.CancelReasonId + params["cancel_reason"] = msg.CancelReason + request, err := http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/mtps/status", strings.NewReader(utils.Map2URLValues(params).Encode())) + if err != nil { + return + } + request.Header.Set("content_type", "application/x-www-form-urlencoded; charset=UTF-8") + cl.Do(request) + } +} + func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (retVal *model.Waybill) { retVal = &model.Waybill{ VendorWaybillID: msg.MtPeisongID, From 309bd0da10318cd60c61563d9bd2ca8ddafc53c7 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, 16 Jun 2020 08:50:12 +0800 Subject: [PATCH 095/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index f11aa151d..19baca542 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1113,11 +1113,11 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch skuBindInfos1 []*StoreSkuBindInfo skuBindInfos2 []*StoreSkuBindInfo ) - storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 11433) + storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0) for _, v := range storeSkusMain { mainSkusMap[v.NameID] = append(mainSkusMap[v.NameID], v) } - storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 11433) + storeSkus, err := dao.GetStoreSkusByNameIDs(db, []int{storeMap.StoreID}, 0) for _, v := range storeSkus { skusMap[v.NameID] = append(skusMap[v.NameID], v) } From c7e764bd684ea8d3620f830710e9c294a788265e 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, 16 Jun 2020 09:22:16 +0800 Subject: [PATCH 096/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=BA=93=E5=AD=98=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 22 +++++++++++++++++++ business/partner/purchase/jdshop/store_sku.go | 9 +++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 19baca542..0a62a45f4 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -7,6 +7,7 @@ import ( "time" "git.rosy.net.cn/jx-callback/business/partner/putils" + "git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi/platformapi/dingdingapi" @@ -1089,6 +1090,7 @@ 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, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) @@ -1097,6 +1099,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, nil, storeMap, isAsync, isContinueWhenError) } + err = syncJdsStoreStock(ctx, db, storeSkus, storeMap) } } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) @@ -1104,6 +1107,25 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i return hint, err } +func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, storeSkus []*model.StoreSkuBind, storeMap *model.StoreMap) (err error) { + task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + storeSku := batchItemList[0].(*model.StoreSkuBind) + stock := 0 + if storeSku.Status == model.StoreSkuBindStatusNormal { + stock = 9999 + } + storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) + if storeSku.JdsID != 0 && len(storeSku2) > 0 { + err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) + } + return retVal, err + }, storeSkus) + tasksch.HandleTask(task, nil, true).Run() + _, err = task.GetResult(0) + return err +} + func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) { var ( mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo) diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index d860cb8e6..fbfa20e7c 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -237,10 +237,10 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr if globals.EnableJdShopWrite { var stock = 0 for _, v := range storeSkuList { - if status == model.SkuStatusNormal { - stock = 9999 - } if storeID == model.JdShopMainStoreID { + if status == model.SkuStatusNormal { + stock = 9999 + } if v.JdsStockSwitch == model.NO { stock = 0 } @@ -250,6 +250,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr err = err2 if len(storeSkus) > 0 { if storeSkus[0].JdsID != 0 && vendorStoreID != "" { + if storeSkus[0].Status == model.SkuStatusNormal { + stock = 9999 + } err = api.JdShopAPI.UpdateSkuSiteStock(storeSkus[0].JdsID, stock, utils.Str2Int(vendorStoreID)) } } From 4ea9b566174092771484d137e9435618ae3e63ec 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, 16 Jun 2020 10:31:32 +0800 Subject: [PATCH 097/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 18 ++++++++++++------ business/jxstore/cms/sync_store_sku.go | 1 + business/model/dao/store_sku.go | 1 + business/model/sku.go | 7 ++++--- controllers/cms_sku.go | 8 ++++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 2a6a30979..91e48920b 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -911,7 +911,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf } } globals.SugarLogger.Debugf("UpdateSkuName valid:%s", utils.Format4Output(valid, false)) - for _, imgName := range []string{"img", "img2", "img3", "img_watermark", "img_mix"} { + for _, imgName := range []string{"img", "img2", "img3"} { if valid[imgName] != nil { if imgStr := utils.Interface2String(valid[imgName]); imgStr != "" { _, err2 := datares.TryRegisterDataResource(ctx, skuName.Name, valid[imgName].(string), model.ImgTypeMain, true) @@ -1525,7 +1525,7 @@ func GetJdUpcCodeByName(ctx *jxcontext.Context, name, upcCode string) (productIn return productInfos, err } -func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) { +func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, imgWaterMark string, vendorID int, exPrefix, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) { var ( fromTimeP time.Time toTimeP time.Time @@ -1553,24 +1553,30 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro "exPrefix": exPrefix, "exPrefixBegin": fromTimeP, "exPrefixEnd": toTimeP, + "imgWaterMark": imgWaterMark, + "exVendorID": vendorID, } - if now.Sub(toTimeP) <= 0 && now.Sub(fromTimeP) >= 0 { + if now.Sub(toTimeP) <= 0 && now.Sub(fromTimeP) <= 0 { _, err = UpdateSkuName(ctx, nameID, payload, false) } else if now.Sub(fromTimeP) > 0 && now.Sub(toTimeP) > 0 { payload["exPrefixBegin"] = nil payload["exPrefixEnd"] = nil + payload["imgWaterMark"] = nil + payload["exVendorID"] = nil _, err = UpdateSkuName(ctx, nameID, payload, false) } else { skuList, err := dao.GetSkus(db, nil, []int{nameID}, nil, nil, nil) if err == nil && len(skuList) > 0 { if skuList[0].ExPrefixBegin != nil { _, err = UpdateSkuName(ctx, nameID, payload, false) - CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, []int{skuList[0].ID}, nil, model.SyncFlagModifiedMask, true, true) + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, []int{skuList[0].ID}, nil, model.SyncFlagModifiedMask, true, true) } else { skuName := &model.SkuName{ ExPrefix: exPrefix, ExPrefixBegin: &fromTimeP, ExPrefixEnd: &toTimeP, + ImgWatermark: imgWaterMark, + ExVendorID: vendorID, } skuName.ID = nameID skuName.LastOperator = ctx.GetLoginID() @@ -1582,7 +1588,7 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro panic(r) } }() - _, err = dao.UpdateEntity(db, skuName, "ExPrefix", "ExPrefixBegin", "ExPrefixEnd", "LastOperator", "UpdatedAt") + _, err = dao.UpdateEntity(db, skuName, "ImgWatermark", "ExVendorID", "ExPrefix", "ExPrefixBegin", "ExPrefixEnd", "LastOperator", "UpdatedAt") dao.Commit(db) } } @@ -1600,7 +1606,7 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro for _, v := range skuList { skuIDs = append(skuIDs, v.ID) } - CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) } } } diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index d5f5786a9..98147c69b 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -280,6 +280,7 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn } skuItem.MergedStatus = jxutils.MergeSkuStatus(jxutils.MergeSkuStatus(skuItem.NameStatus, skuItem.Status), skuItem.StoreSkuStatus) skuItem.SkuName = jxutils.ComposeSkuNameSync(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0, skuItem.ExPrefix, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) + skuItem.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0) } } return inSkuList diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 7a5fcfd6b..4de3ecf4a 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -110,6 +110,7 @@ type StoreSkuSyncInfo struct { MergedStatus int SkuName string + SkuNameOrigin string StatusSaleBegin int16 `json:"statusSaleBegin"` //商品可售时间范围 StatusSaleEnd int16 `json:"statusSaleEnd"` diff --git a/business/model/sku.go b/business/model/sku.go index de217f04c..3b8b375a4 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -151,12 +151,13 @@ func (*SkuCategory) TableUnique() [][]string { type SkuName struct { ModelIDCULD - Prefix string `orm:"size(255)" json:"prefix"` - Name string `orm:"size(255)" json:"name"` - ExPrefix string `orm:"size(255)" json:"exPrefix"` + Prefix string `orm:"size(255)" json:"prefix"` + Name string `orm:"size(255)" json:"name"` + ExPrefix string `orm:"size(255)" json:"exPrefix"` ExPrefixBegin *time.Time `orm:"null" json:"exPrefixBegin"` ExPrefixEnd *time.Time `orm:"null" json:"exPrefixEnd"` + ExVendorID int `json:"exVendorID"` BrandID int `orm:"column(brand_id);default(0)" json:"brandID"` // todo,此属性暂时没有使用,且有问题,应该是不同平台都有一个brandid CategoryID int `orm:"column(category_id);index" json:"categoryID"` // 标准类别 diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index 1f5c9fe13..77c5462af 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -199,6 +199,8 @@ func (c *SkuController) UpdateSkuName() { delete(payload, "exPrefix") delete(payload, "exPrefixBegin") delete(payload, "exPrefixEnd") + delete(payload, "imgWaterMark") + delete(payload, "exVendorID") retVal, err = cms.UpdateSkuName(params.Ctx, params.NameID, payload, params.IsExd) } return retVal, "", err @@ -403,9 +405,11 @@ func (c *SkuController) GetJdUpcCodeByName() { // @Description 批量设置商品额外前缀 // @Param token header string true "认证token" // @Param nameIDs formData string true "商品nameIDs" -// @Param exPrefix formData string true "商品额外前缀" +// @Param exPrefix formData string false "商品额外前缀" // @Param fromDate formData string true "生效开始时间,格式 2006-01-01 " // @Param toDate formData string true "生效结束时间,格式 2006-01-01 " +// @Param imgWaterMark formData string false "商品水印图" +// @Param vendorID formData int true "平台ID" // @Param isAsync formData bool false "是否异步" // @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false" // @Success 200 {object} controllers.CallResult @@ -415,7 +419,7 @@ func (c *SkuController) UpdateSkuNamesExPrefix() { c.callUpdateSkuNamesExPrefix(func(params *tSkuUpdateSkuNamesExPrefixParams) (retVal interface{}, errCode string, err error) { var skuIDList []int if err = jxutils.Strings2Objs(params.NameIDs, &skuIDList); err == nil { - retVal, err = cms.UpdateSkuNamesExPrefix(params.Ctx, skuIDList, params.ExPrefix, params.FromDate, params.ToDate, params.IsAsync, params.IsContinueWhenError) + retVal, err = cms.UpdateSkuNamesExPrefix(params.Ctx, skuIDList, params.ImgWaterMark, params.VendorID, params.ExPrefix, params.FromDate, params.ToDate, params.IsAsync, params.IsContinueWhenError) } return retVal, "", err }) From 3eef59ba79a2c5ab5e818ccb0bee7383b8fd0f46 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, 16 Jun 2020 10:34:24 +0800 Subject: [PATCH 098/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/sku.go b/business/model/sku.go index 3b8b375a4..f80864861 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -157,7 +157,7 @@ type SkuName struct { ExPrefix string `orm:"size(255)" json:"exPrefix"` ExPrefixBegin *time.Time `orm:"null" json:"exPrefixBegin"` ExPrefixEnd *time.Time `orm:"null" json:"exPrefixEnd"` - ExVendorID int `json:"exVendorID"` + ExVendorID int `orm:"column(ex_vendor_id)" json:"exVendorID"` BrandID int `orm:"column(brand_id);default(0)" json:"brandID"` // todo,此属性暂时没有使用,且有问题,应该是不同平台都有一个brandid CategoryID int `orm:"column(category_id);index" json:"categoryID"` // 标准类别 From f96b82165d60dd186cd24a3660d1d9409b611b6a 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, 16 Jun 2020 11:18:12 +0800 Subject: [PATCH 099/152] =?UTF-8?q?=E5=95=86=E5=93=81=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 13 ++++++++----- business/model/sku.go | 17 +++++++++++++++++ business/partner/purchase/mtwm/store_sku2.go | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 4de3ecf4a..822870cf7 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -75,6 +75,8 @@ type StoreSkuSyncInfo struct { ExPrefix string ExPrefixBegin *time.Time ExPrefixEnd *time.Time + ExVendorID int `orm:"column(ex_vendor_id)" json:"exVendorID"` + // NameID int `orm:"column(name_id)"` VendorNameID string `orm:"column(vendor_name_id)"` // 暂时无用 Name string @@ -90,10 +92,11 @@ type StoreSkuSyncInfo struct { PreparationTime int // 平台相关的图片信息 - Img string - Img2 string - Img3 string - DescImg string + Img string + Img2 string + Img3 string + DescImg string + ImgWatermark string `json:"imgWatermark"` //图片水印 VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"` // 平台商品分类(叶子结点) CategoryName string `json:"categoryName"` //分类名 @@ -407,7 +410,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t2.*, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, t3.yb_name_suffix, - t3.jds_stock_switch, t3.preparation_time, + t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, IF(t15.%s <> '', t15.%s, t3.img3) img3, diff --git a/business/model/sku.go b/business/model/sku.go index f80864861..84546c1e5 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -281,3 +281,20 @@ type SkuNameExt struct { PlacesStr string `json:"-"` MidUnitPrice int `json:"midUnitPrice"` } + +type SkuExinfoMap struct { + ModelIDCULD + + ExPrefix string `orm:"size(255)" json:"exPrefix"` + ImgWatermark string `orm:"size(512)" json:"imgWatermark"` //图片水印 + NameID int `orm:"column(name_id)" json:"nameID"` + VendorID int `orm:"column(vendor_id)" json:"vendorID"` + BeginAt time.Time `orm:"type(datetime);index" json:"beginAt"` + EndAt time.Time `orm:"type(datetime);index" json:"endAt"` +} + +func (*SkuExinfoMap) TableIndex() [][]string { + return [][]string{ + []string{"NameID", "VendorID", "BeginAt", "EndAt"}, + } +} diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index d33a2e9dc..e678e0514 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -248,7 +248,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI for i, storeSku := range storeSkuList { isNeedUpdatePrice := isCreate //storeSku.SkuSyncStatus&( model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0 foodData := make(map[string]interface{}) - foodDataList[i] = foodData + foodDataList[i] = foodData foodData[mtwmapi.KeyAppFoodCode] = utils.Int2Str(storeSku.SkuID) skus := []map[string]interface{}{ map[string]interface{}{ From cb81ac6921e71a5d9fa0df0f84e31fa46b8e409e 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, 16 Jun 2020 11:19:15 +0800 Subject: [PATCH 100/152] =?UTF-8?q?=E5=95=86=E5=93=81=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- globals/beegodb/beegodb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index fe01980d6..17217e5d3 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -35,6 +35,7 @@ func Init() { orm.RegisterModel(&model.StoreSkuAudit{}) orm.RegisterModel(&model.SkuCategory{}) orm.RegisterModel(&model.ThingMap{}) + orm.RegisterModel(&model.SkuExinfoMap{}) orm.RegisterModel(&model.AuthBind{}, &model.User{}) From 79df2818c24aa6aeedc433e5d0f8f9f2fe375f8a 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, 16 Jun 2020 13:57:23 +0800 Subject: [PATCH 101/152] =?UTF-8?q?=E5=95=86=E5=93=81=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 48 +++++++++++++++++++++++++++++++++++++ business/model/dao/sku.go | 33 +++++++++++++++++++++++++ business/model/sku.go | 8 +++---- controllers/cms_sku.go | 24 +++++++++++++++++++ 4 files changed, 109 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 91e48920b..7ec67735e 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2534,3 +2534,51 @@ func deleteJdsSku(db *dao.DaoDB, skuID int) (err error) { } return err } + +func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark string, vendorID int, exPrefix, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) { + var ( + fromTimeP time.Time + toTimeP time.Time + db = dao.GetDB() + ) + if fromTime != "" { + fromTimeP = utils.Time2Date(utils.Str2Time(fromTime)) + } + if toTime != "" { + toTimeP = utils.Time2Date(utils.Str2Time(toTime)) + } + if toTimeP.Before(fromTimeP) { + return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP) + } + task := tasksch.NewParallelTask("RefreshOrdersPriceInfo", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + nameID := batchItemList[0].(int) + skuEx := &model.SkuExinfoMap{ + NameID: nameID, + ImgWatermark: imgWaterMark, + ExPrefix: exPrefix, + VendorID: vendorID, + BeginAt: fromTimeP, + EndAt: toTimeP, + } + dao.WrapAddIDCULEntity(skuEx, ctx.GetUserName()) + skuExs, _ := dao.GetSkuExinfos(db, []int{nameID}, vendorID, "", utils.ZeroTimeValue, utils.ZeroTimeValue) + if len(skuExs) > 0 { + skuEx2 := skuExs[0] + dao.WrapAddIDCULDEntity(skuEx2, ctx.GetUserName()) + dao.UpdateEntity(db, skuEx2) + dao.CreateEntity(db, skuEx) + } else { + dao.CreateEntity(db, skuEx) + } + return retVal, err + }, nameIDs) + tasksch.HandleTask(task, nil, true).Run() + if isAsync { + hint = task.GetID() + } else { + _, err = task.GetResult(0) + hint = "1" + } + return hint, err +} diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index be89fa4a9..c04bc8c16 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -1,6 +1,8 @@ package dao import ( + "time" + "git.rosy.net.cn/baseapi/platformapi/aliupcapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" @@ -379,3 +381,34 @@ func InsertUpcDepot(db *DaoDB, result *aliupcapi.GetAliUpcInfoResult) (err error _, err = ExecuteSQL(db, sql, sqlParams) return err } + +func GetSkuExinfos(db *DaoDB, nameIDs []int, vendorID int, exPrefix string, fromTime, toTime time.Time) (skuExinfoMaps []*model.SkuExinfoMap, err error) { + sql := ` + SELECT * + FROM sku_exinfo_map + WHERE deleted_at = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, + } + if len(nameIDs) > 0 { + sql += " AND name_id IN (" + GenQuestionMarks(len(nameIDs)) + ")" + sqlParams = append(sqlParams, nameIDs) + } + if vendorID != -1 { + sql += " AND vendor_id = ?" + sqlParams = append(sqlParams, vendorID) + } + if exPrefix != "" { + sql += " AND ex_prefix LIKE ?" + sqlParams = append(sqlParams, "%"+exPrefix+"%") + } + if fromTime != utils.ZeroTimeValue && toTime != utils.ZeroTimeValue { + sql += " AND NOT (begin_at > ? OR end_at < ?)" + sqlParams = append(sqlParams, toTime, fromTime) + } + if err = GetRows(db, &skuExinfoMaps, sql, sqlParams...); err == nil { + return skuExinfoMaps, nil + } + return nil, err +} diff --git a/business/model/sku.go b/business/model/sku.go index 84546c1e5..c43017da4 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -285,12 +285,12 @@ type SkuNameExt struct { type SkuExinfoMap struct { ModelIDCULD - ExPrefix string `orm:"size(255)" json:"exPrefix"` - ImgWatermark string `orm:"size(512)" json:"imgWatermark"` //图片水印 NameID int `orm:"column(name_id)" json:"nameID"` VendorID int `orm:"column(vendor_id)" json:"vendorID"` - BeginAt time.Time `orm:"type(datetime);index" json:"beginAt"` - EndAt time.Time `orm:"type(datetime);index" json:"endAt"` + BeginAt time.Time `orm:"type(datetime);index" json:"beginAt"` //设置起始时间 + EndAt time.Time `orm:"type(datetime);index" json:"endAt"` //设置结束时间 + ExPrefix string `orm:"size(255)" json:"exPrefix"` //额外前缀 + ImgWatermark string `orm:"size(512)" json:"imgWatermark"` //图片水印 } func (*SkuExinfoMap) TableIndex() [][]string { diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index 77c5462af..bd04f8fb0 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -483,3 +483,27 @@ func (c *SkuController) RefreshJdDepot() { return retVal, "", err }) } + +// @Title 批量设置商品额外信息 +// @Description 批量设置商品额外信息 +// @Param token header string true "认证token" +// @Param nameIDs formData string true "商品nameIDs" +// @Param exPrefix formData string false "商品额外前缀" +// @Param fromDate formData string true "生效开始时间,格式 2006-01-01 " +// @Param toDate formData string true "生效结束时间,格式 2006-01-01 " +// @Param imgWaterMark formData string false "商品水印图" +// @Param vendorID formData int true "平台ID" +// @Param isAsync formData bool false "是否异步" +// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdateSkuExinfoMap [put] +func (c *SkuController) UpdateSkuExinfoMap() { + c.callUpdateSkuExinfoMap(func(params *tSkuUpdateSkuExinfoMapParams) (retVal interface{}, errCode string, err error) { + var skuIDList []int + if err = jxutils.Strings2Objs(params.NameIDs, &skuIDList); err == nil { + retVal, err = cms.UpdateSkuExinfoMap(params.Ctx, skuIDList, params.ImgWaterMark, params.VendorID, params.ExPrefix, params.FromDate, params.ToDate, params.IsAsync, params.IsContinueWhenError) + } + return retVal, "", err + }) +} From 058b1663ee74615ff14061a958a10a766c3c3ceb 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, 16 Jun 2020 14:14:45 +0800 Subject: [PATCH 102/152] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/order_afs.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/ebai/order_afs.go b/business/partner/purchase/ebai/order_afs.go index d06c917a0..f9f67f0c7 100644 --- a/business/partner/purchase/ebai/order_afs.go +++ b/business/partner/purchase/ebai/order_afs.go @@ -204,10 +204,24 @@ func (c *PurchaseHandler) ConfirmReceivedReturnGoods(ctx *jxcontext.Context, ord // 发起全款退款 func (c *PurchaseHandler) RefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error) { - return fmt.Errorf("%s不支持售后全额退款,请让买家发起退款", model.VendorChineseNames[model.VendorIDEBAI]) + return c.PartRefundOrder(ctx, order, order.Skus, reason) } // 发起部分退款 func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) { - return fmt.Errorf("%s不支持售后部分退款,请让买家发起退款", model.VendorChineseNames[model.VendorIDEBAI]) + if globals.EnableEbaiStoreWrite { + err = api.EbaiAPI.OrderPartRefund(order.VendorOrderID, orderSkus2AfsSkus(refundSkuList)) + } + return err +} + +func orderSkus2AfsSkus(refundSkuList []*model.OrderSku) (removeSkuList []*ebaiapi.RefundSku) { + for _, v := range refundSkuList { + refundSku := &ebaiapi.RefundSku{ + CustomeSkuID: utils.Int2Str(v.SkuID), + Number: utils.Int2Str(v.Count), + } + removeSkuList = append(removeSkuList, refundSku) + } + return removeSkuList } From 211c5b11e75bfdbd4542831b834cea95290c4767 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, 16 Jun 2020 14:32:23 +0800 Subject: [PATCH 103/152] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/commentsRouter_controllers.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index a94561d7f..ae65b47ac 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1539,6 +1539,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"], + beego.ControllerComments{ + Method: "UpdateSkuExinfoMap", + Router: `/UpdateSkuExinfoMap`, + AllowHTTPMethods: []string{"put"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"], beego.ControllerComments{ Method: "UpdateSkuName", From 986cca91fb1c5f327d70da2dfb657dea2ff50386 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, 16 Jun 2020 14:33:55 +0800 Subject: [PATCH 104/152] =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BA=AC=E8=A5=BF?= =?UTF-8?q?=E4=BB=B7=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 3797731e9..682541b9b 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2351,7 +2351,7 @@ func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) ( if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil { for _, skuBind := range storeSkuList { skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price) - dao.UpdateEntity(db, skuBind) + dao.UpdateEntity(db, skuBind, "JxPrice") } } else { return nil, err From 51bb8f1cc00f9f602512b5584baab20494b04af3 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, 16 Jun 2020 14:45:56 +0800 Subject: [PATCH 105/152] =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BA=AC=E8=A5=BF?= =?UTF-8?q?=E4=BB=B7=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 682541b9b..2f8ff170d 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2350,7 +2350,7 @@ func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) ( if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil { if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil { for _, skuBind := range storeSkuList { - skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price) + skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, 0, skuBind.Price) dao.UpdateEntity(db, skuBind, "JxPrice") } } else { From 7f883e7742330f10bf5dfa419f85bec7937e959b 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, 16 Jun 2020 14:47:07 +0800 Subject: [PATCH 106/152] =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BA=AC=E8=A5=BF?= =?UTF-8?q?=E4=BB=B7=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 2f8ff170d..682541b9b 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2350,7 +2350,7 @@ func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) ( if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil { if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil { for _, skuBind := range storeSkuList { - skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, 0, skuBind.Price) + skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price) dao.UpdateEntity(db, skuBind, "JxPrice") } } else { From 4645691c1bf41eb196211aa5af3e8effe81b29e9 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, 16 Jun 2020 17:32:36 +0800 Subject: [PATCH 107/152] =?UTF-8?q?=E6=9E=9C=E5=9B=AD=E5=8F=91=E7=BE=8E?= =?UTF-8?q?=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 22 ++++++++++++++++++---- business/partner/delivery/mtps/waybill.go | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 7ec67735e..19ab4539e 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2550,7 +2550,7 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri if toTimeP.Before(fromTimeP) { return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP) } - task := tasksch.NewParallelTask("RefreshOrdersPriceInfo", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, + task := tasksch.NewParallelTask("UpdateSkuExinfoMap", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { nameID := batchItemList[0].(int) skuEx := &model.SkuExinfoMap{ @@ -2561,16 +2561,30 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri BeginAt: fromTimeP, EndAt: toTimeP, } - dao.WrapAddIDCULEntity(skuEx, ctx.GetUserName()) + dao.WrapAddIDCULDEntity(skuEx, ctx.GetUserName()) skuExs, _ := dao.GetSkuExinfos(db, []int{nameID}, vendorID, "", utils.ZeroTimeValue, utils.ZeroTimeValue) if len(skuExs) > 0 { skuEx2 := skuExs[0] - dao.WrapAddIDCULDEntity(skuEx2, ctx.GetUserName()) - dao.UpdateEntity(db, skuEx2) + skuEx2.DeletedAt = time.Now() + skuEx2.LastOperator = ctx.GetUserName() + dao.UpdateEntity(db, skuEx2, "DeletedAt", "LastOperator") dao.CreateEntity(db, skuEx) } else { dao.CreateEntity(db, skuEx) } + now := utils.Time2Date(time.Now()) + if now.Sub(fromTimeP) >= 0 && now.Sub(toTimeP) <= 0 { + var skuIDs []int + skuList, err2 := dao.GetSkus(db, nil, []int{nameID}, nil, nil, nil) + if err = err2; err == nil { + if len(skuList) > 0 { + for _, v := range skuList { + skuIDs = append(skuIDs, v.ID) + } + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) + } + } + } return retVal, err }, nameIDs) tasksch.HandleTask(task, nil, true).Run() diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 9dcc3dff1..e27913b65 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -102,6 +102,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m return mtpsapi.SuccessResponse } c.pushToGy(order, msg) + globals.SugarLogger.Debugf("onWaybillMsg test, %v", msg) return mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } From 8c1e77ba1b6655751996e011e0dca83dba38ee0e 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, 16 Jun 2020 17:43:20 +0800 Subject: [PATCH 108/152] =?UTF-8?q?mtps=E6=A0=A1=E9=AA=8C=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/waybill.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index e27913b65..091b5f737 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -115,7 +115,7 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback params["mt_peisong_id"] = msg.MtPeisongID params["courier_name"] = msg.CourierName params["delivery_id"] = msg.DeliveryID - params["sign"] = msg.Sign + params["sign"] = "ec61c8d88a1f864cc2cb1b875177fe1fb1402f05" params["appkey"] = msg.AppKey params["order_id"] = msg.OrderID params["courier_phone"] = msg.CourierPhone From f01e9ca1fdc85f776d1689d434e30a5d15dd06a6 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, 16 Jun 2020 17:52:24 +0800 Subject: [PATCH 109/152] =?UTF-8?q?mtps=E6=A0=A1=E9=AA=8C=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/waybill.go | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 091b5f737..275810dfd 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -1,9 +1,12 @@ package mtps import ( + "crypto/sha1" "errors" "fmt" "net/http" + "net/url" + "sort" "strings" "time" @@ -115,7 +118,7 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback params["mt_peisong_id"] = msg.MtPeisongID params["courier_name"] = msg.CourierName params["delivery_id"] = msg.DeliveryID - params["sign"] = "ec61c8d88a1f864cc2cb1b875177fe1fb1402f05" + // params["sign"] = "ec61c8d88a1f864cc2cb1b875177fe1fb1402f05" params["appkey"] = msg.AppKey params["order_id"] = msg.OrderID params["courier_phone"] = msg.CourierPhone @@ -123,6 +126,9 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback params["timestamp"] = msg.Timestamp params["cancel_reason_id"] = msg.CancelReasonId params["cancel_reason"] = msg.CancelReason + urls := utils.Map2URLValues(params) + sign := signParams(urls) + params["sign"] = sign request, err := http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/mtps/status", strings.NewReader(utils.Map2URLValues(params).Encode())) if err != nil { return @@ -132,6 +138,27 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback } } +func signParams(params url.Values) string { + keys := make([]string, 0) + for k := range params { + if k != "sign" { + keys = append(keys, k) + } + } + + sort.Strings(keys) + finalStr := "b1M}9?:sTbsB[OF2gNORnN(|(iy9rB8(`7]|[wGLnbmt`evfM>E:A90DjHAW:UPE" + for _, key := range keys { + valStr := strings.Join(params[key], "") + if valStr != "" { + finalStr += key + valStr + } + } + + // baseapi.SugarLogger.Debug(finalStr) + return fmt.Sprintf("%x", sha1.Sum([]byte(finalStr))) +} + func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (retVal *model.Waybill) { retVal = &model.Waybill{ VendorWaybillID: msg.MtPeisongID, From 657122bd1b694717dfb051ec907941e49da1bf10 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, 16 Jun 2020 18:05:50 +0800 Subject: [PATCH 110/152] =?UTF-8?q?mtps=E6=A0=A1=E9=AA=8C=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=EF=BC=9F?= 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 275810dfd..7554a24de 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -133,6 +133,7 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback if err != nil { return } + fmt.Println("testgy request : %v", request.FormValue("sign")) request.Header.Set("content_type", "application/x-www-form-urlencoded; charset=UTF-8") cl.Do(request) } From 2324f0487b79c5bbac6506639c88282df565c5a0 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, 17 Jun 2020 08:30:52 +0800 Subject: [PATCH 111/152] =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 0a62a45f4..bb7815c84 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1117,7 +1117,9 @@ func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, storeSkus []*model } storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) if storeSku.JdsID != 0 && len(storeSku2) > 0 { - err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) + if storeSku.Status != storeSku2[0].Status { + err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) + } } return retVal, err }, storeSkus) From 89dd8bc20bddad58a96d0acd43e69951b4474fff 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, 17 Jun 2020 09:46:52 +0800 Subject: [PATCH 112/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 10 +++++++++- business/jxstore/cms/sync2.go | 1 + business/model/dao/sku.go | 6 ++---- business/model/dao/store_sku.go | 8 +++++--- business/partner/purchase/jd/sku2.go | 9 +++++++-- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 19ab4539e..1eae474ce 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2581,7 +2581,15 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri for _, v := range skuList { skuIDs = append(skuIDs, v.ID) } - CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) + if partner.IsMultiStore(vendorID) { + for _, v := range skuIDs { + OnUpdateThing(ctx, db, nil, int64(v), model.ThingTypeSku) + } + CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, isAsync, isContinueWhenError, ctx.GetUserName()) + } else { + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) + + } } } } diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 6316c4ce0..c882f1594 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -148,6 +148,7 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, return nil, err } skuVendorInfo.SkuName = jxutils.ComposeSkuName(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0, skuVendorInfo.ExPrefix, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) + skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) if multiStoresHandler, ok := partner.GetPurchasePlatformFromVendorID(skuVendorInfo.VendorID).(partner.IMultipleStoresHandler); ok { if model.IsSyncStatusDelete(skuVendorInfo.SkuSyncStatus) { //删除 diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index c04bc8c16..3315808c2 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -257,11 +257,8 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs IF(t11.resource_type IS NULL OR t11.resource_type <> ?, t2.img, '') img, IF(t12.resource_type IS NULL OR t12.resource_type <> ?, t2.img2, '') img2, t2.desc_img, - t2.ex_prefix, - t2.ex_prefix_begin, - t2.ex_prefix_end, t3.jd_category_id vendor_vendor_cat_id, - + tsu.ex_prefix, tsu.begin_at ex_prefix_begin, tsu.end_at ex_prefix_end, tsu.img_watermark, t3m.sync_status cat_sync_status, t3m.vendor_thing_id vendor_cat_id @@ -288,6 +285,7 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs AND t3m.vendor_id = t1m.vendor_id AND t3m.vendor_org_code = t1m.vendor_org_code LEFT JOIN data_resource t11 ON t11.main_url = t2.img LEFT JOIN data_resource t12 ON t12.main_url = t2.img2 + LEFT JOIN sku_exinfo_map tsu ON tsu.name_id = t2.id AND tsu.deleted_at = ? AND tsu.vendor_id = t1m.vendor_id WHERE 1 = 1 ` sqlParams = append(sqlParams, model.ThingTypeCategory, utils.DefaultTimeValue) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 822870cf7..e96566ff4 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -75,7 +75,6 @@ type StoreSkuSyncInfo struct { ExPrefix string ExPrefixBegin *time.Time ExPrefixEnd *time.Time - ExVendorID int `orm:"column(ex_vendor_id)" json:"exVendorID"` // NameID int `orm:"column(name_id)"` VendorNameID string `orm:"column(vendor_name_id)"` // 暂时无用 @@ -409,7 +408,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo %s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time, t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t2.*, - t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id, t3.yb_name_suffix, + t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix, t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, @@ -417,7 +416,8 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo IF(t13.%s <> '', t13.%s, t3.desc_img) desc_img, t4.%s_category_id vendor_vendor_cat_id, t4.name category_name, - ts.name store_name` + ts.name store_name, + tsu.ex_prefix, tsu.begin_at ex_prefix_begin, tsu.end_at ex_prefix_end, tsu.img_watermark` fmtParams := []interface{}{ skuVendorIDField, fieldPrefix, fieldPrefix, fieldPrefix, GetDataResFieldName(vendorID), GetDataResFieldName(vendorID), @@ -451,6 +451,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo LEFT JOIN data_resource t12 ON t12.main_url = t3.img2 LEFT JOIN data_resource t15 ON t15.main_url = t3.img3 LEFT JOIN data_resource t13 ON t13.main_url = t3.desc_img + LEFT JOIN sku_exinfo_map tsu ON tsu.name_id = t3.id AND tsu.deleted_at = ? AND tsu.vendor_id = t14.vendor_id ` sqlParams := []interface{}{ vendorID, utils.DefaultTimeValue, @@ -458,6 +459,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo utils.DefaultTimeValue, // model.SkuStatusNormal, utils.DefaultTimeValue, utils.DefaultTimeValue, + utils.DefaultTimeValue, } if globals.IsStoreSkuAct { sql += ` diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index 5d2717984..54390670d 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -164,8 +164,13 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd FixedStatus: jxStatus2jdStatus(sku.MergedStatus), IsSale: jdapi.IsSaleNo, // todo ? - Upc: sku.Upc, - Images: jxutils.BatchString2Slice(sku.Img, sku.Img2), + Upc: sku.Upc, + // Images: jxutils.BatchString2Slice(sku.Img, sku.Img2), + } + if sku.ImgWatermark != "" { + param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2) + } else { + param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2) } if param.CategoryID == 0 { param.CategoryID = int64(getDefJdCategoryID()) From 5e32e69b3ebfd067eb5e92d4cbff88d1e311a3c4 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, 17 Jun 2020 09:59:55 +0800 Subject: [PATCH 113/152] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E9=85=8D=E9=80=81?= =?UTF-8?q?=E5=8F=91=E6=9E=9C=E5=9B=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/mtps/waybill.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 7554a24de..09fc6e264 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -118,7 +118,6 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback params["mt_peisong_id"] = msg.MtPeisongID params["courier_name"] = msg.CourierName params["delivery_id"] = msg.DeliveryID - // params["sign"] = "ec61c8d88a1f864cc2cb1b875177fe1fb1402f05" params["appkey"] = msg.AppKey params["order_id"] = msg.OrderID params["courier_phone"] = msg.CourierPhone @@ -133,6 +132,17 @@ func (c *DeliveryHandler) pushToGy(waybill *model.Waybill, msg *mtpsapi.Callback if err != nil { return } + request.PostForm.Set("mt_peisong_id", msg.MtPeisongID) + request.PostForm.Set("courier_name", msg.CourierName) + request.PostForm.Set("delivery_id", utils.Int64ToStr(msg.DeliveryID)) + request.PostForm.Set("appkey", msg.AppKey) + request.PostForm.Set("order_id", msg.OrderID) + request.PostForm.Set("courier_phone", msg.CourierPhone) + request.PostForm.Set("status", utils.Int2Str(msg.Status)) + request.PostForm.Set("timestamp", utils.Int64ToStr(msg.Timestamp)) + request.PostForm.Set("cancel_reason_id", utils.Int2Str(msg.CancelReasonId)) + request.PostForm.Set("cancel_reason", msg.CancelReason) + request.PostForm.Set("sign", sign) fmt.Println("testgy request : %v", request.FormValue("sign")) request.Header.Set("content_type", "application/x-www-form-urlencoded; charset=UTF-8") cl.Do(request) From c42fff254ba3b999bdbd1b34d0773ff9f02446ff 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, 17 Jun 2020 10:54:53 +0800 Subject: [PATCH 114/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 6 +++++- business/jxutils/jxutils.go | 14 ++++++++++++++ business/model/dao/store_sku.go | 1 + business/partner/purchase/jd/sku2.go | 5 +++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index c882f1594..0cd2fc09b 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -147,8 +147,12 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, if skuVendorInfo.ExdSkuID != "" { return nil, err } - skuVendorInfo.SkuName = jxutils.ComposeSkuName(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0, skuVendorInfo.ExPrefix, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) + skuVendorInfo.SkuName = jxutils.ComposeSkuNameSync(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0, skuVendorInfo.ExPrefix, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) + if skuVendorInfo.ImgWatermark != "" { + downLoad, _ := uploadImgStandard(skuVendorInfo.ImgWatermark) + skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img) + } skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) if multiStoresHandler, ok := partner.GetPurchasePlatformFromVendorID(skuVendorInfo.VendorID).(partner.IMultipleStoresHandler); ok { if model.IsSyncStatusDelete(skuVendorInfo.SkuSyncStatus) { //删除 diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 945b0f832..11c7ed44d 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -916,3 +916,17 @@ func PKCS5UnPadding(origData []byte) []byte { unpadding := int(origData[length-1]) return origData[:(length - unpadding)] } + +//合成水印图 +func MixMatermarkImg(imgWatermark, img string) (imgMix string) { + baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) + imgUrl := "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" + if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { + if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+imgWatermark[strings.LastIndex(imgWatermark, "/")+1:len(imgWatermark)]); err == nil { + if err == nil { + return downloadURL + } + } + } + return imgMix +} diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index e96566ff4..8b2c5a671 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -96,6 +96,7 @@ type StoreSkuSyncInfo struct { Img3 string DescImg string ImgWatermark string `json:"imgWatermark"` //图片水印 + ImgMix string //合成水印后的图片 VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"` // 平台商品分类(叶子结点) CategoryName string `json:"categoryName"` //分类名 diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index 54390670d..f9da68b38 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -167,11 +167,12 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd Upc: sku.Upc, // Images: jxutils.BatchString2Slice(sku.Img, sku.Img2), } - if sku.ImgWatermark != "" { - param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2) + if sku.ImgMix != "" { + param.Images = jxutils.BatchString2Slice(sku.ImgMix, sku.Img2) } else { param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2) } + if param.CategoryID == 0 { param.CategoryID = int64(getDefJdCategoryID()) } From ccd9450cb20bf19567c1536b7d4030ceebd7de1a 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, 17 Jun 2020 11:14:41 +0800 Subject: [PATCH 115/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index 3315808c2..3cde6b769 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -288,7 +288,7 @@ func GetSkusWithVendor(db *DaoDB, vendorIDs []int, appOrgCodes []string, nameIDs LEFT JOIN sku_exinfo_map tsu ON tsu.name_id = t2.id AND tsu.deleted_at = ? AND tsu.vendor_id = t1m.vendor_id WHERE 1 = 1 ` - sqlParams = append(sqlParams, model.ThingTypeCategory, utils.DefaultTimeValue) + sqlParams = append(sqlParams, model.ThingTypeCategory, utils.DefaultTimeValue, utils.DefaultTimeValue) if mustDirty { sql += " AND t1m.sync_status IS NOT NULL AND t1m.sync_status <> 0" } else { From 9e45bde6138d78013347da174ac1425ce52dec5e 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, 17 Jun 2020 11:48:47 +0800 Subject: [PATCH 116/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 1 + business/jxutils/jxutils.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 0cd2fc09b..a33c9722e 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -151,6 +151,7 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) if skuVendorInfo.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuVendorInfo.ImgWatermark) + fmt.Println("test downLoad", downLoad) skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img) } skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 11c7ed44d..cd849206f 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -921,8 +921,9 @@ func PKCS5UnPadding(origData []byte) []byte { func MixMatermarkImg(imgWatermark, img string) (imgMix string) { baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) imgUrl := "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" + fmt.Println("test imgUrl", imgUrl) if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { - if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+imgWatermark[strings.LastIndex(imgWatermark, "/")+1:len(imgWatermark)]); err == nil { + if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { if err == nil { return downloadURL } From ee60ace056569ee2e46b1103158d55acdd1a25a4 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, 17 Jun 2020 11:53:34 +0800 Subject: [PATCH 117/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 1 - business/jxutils/jxutils.go | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index a33c9722e..0cd2fc09b 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -151,7 +151,6 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) if skuVendorInfo.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuVendorInfo.ImgWatermark) - fmt.Println("test downLoad", downLoad) skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img) } skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index cd849206f..83d1b327c 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -921,11 +921,12 @@ func PKCS5UnPadding(origData []byte) []byte { func MixMatermarkImg(imgWatermark, img string) (imgMix string) { baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) imgUrl := "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" - fmt.Println("test imgUrl", imgUrl) if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { if err == nil { return downloadURL + } else { + fmt.Println("err", err) } } } From 61948659d1a7f94237f5b6103e0b850337363b0c 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, 17 Jun 2020 11:57:12 +0800 Subject: [PATCH 118/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 83d1b327c..2ef8b8be9 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -928,6 +928,8 @@ func MixMatermarkImg(imgWatermark, img string) (imgMix string) { } else { fmt.Println("err", err) } + } else { + fmt.Println("err2", err) } } return imgMix From 2f8b1a9a31dbcdb8b79e0ffa127482dc38e96cf9 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, 17 Jun 2020 11:57:38 +0800 Subject: [PATCH 119/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 2ef8b8be9..b25a1a73c 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -920,16 +920,12 @@ func PKCS5UnPadding(origData []byte) []byte { //合成水印图 func MixMatermarkImg(imgWatermark, img string) (imgMix string) { baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) - imgUrl := "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" + imgUrl := img + "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { if err == nil { return downloadURL - } else { - fmt.Println("err", err) } - } else { - fmt.Println("err2", err) } } return imgMix From f2389477f9137d13b03a4e832698653d6bdb75c3 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, 17 Jun 2020 13:36:46 +0800 Subject: [PATCH 120/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index b25a1a73c..75292a136 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -918,15 +918,22 @@ func PKCS5UnPadding(origData []byte) []byte { } //合成水印图 -func MixMatermarkImg(imgWatermark, img string) (imgMix string) { - baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) - imgUrl := img + "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" - if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { - if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { - if err == nil { - return downloadURL +func MixMatermarkImg(imgWatermark, img string, exPrefixBegin, exPrefixEnd *time.Time) (imgMix string) { + if exPrefixBegin != nil && exPrefixEnd != nil { + if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 { + baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) + imgUrl := img + "?imageView2/0/q/75|watermark/1/image/" + baseURL + "/dissolve/100/gravity/Center/dx/0/dy/0" + if resBinary, _, err := DownloadFileByURL(imgUrl); err == nil { + if downloadURL, err := UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+img[strings.LastIndex(img, "/")+1:len(img)]); err == nil { + if err == nil { + return downloadURL + } + } } } + if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixEnd) > 0 { + return imgMix + } } return imgMix } From 9ef7c6fe2b7ab89437a0f7b61f9defb0f73de0eb 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, 17 Jun 2020 13:37:53 +0800 Subject: [PATCH 121/152] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 0cd2fc09b..c6f88ca54 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -151,7 +151,7 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) if skuVendorInfo.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuVendorInfo.ImgWatermark) - skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img) + skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) } skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) if multiStoresHandler, ok := partner.GetPurchasePlatformFromVendorID(skuVendorInfo.VendorID).(partner.IMultipleStoresHandler); ok { From c9524965726ed8dcae5b7cd4027c1fffcb2eb1bd 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, 17 Jun 2020 14:28:21 +0800 Subject: [PATCH 122/152] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync_store_sku.go | 4 ++++ business/partner/purchase/mtwm/store_sku2.go | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 98147c69b..20555a483 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -281,6 +281,10 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn skuItem.MergedStatus = jxutils.MergeSkuStatus(jxutils.MergeSkuStatus(skuItem.NameStatus, skuItem.Status), skuItem.StoreSkuStatus) skuItem.SkuName = jxutils.ComposeSkuNameSync(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0, skuItem.ExPrefix, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) skuItem.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0) + if skuItem.ImgWatermark != "" { + downLoad, _ := uploadImgStandard(skuItem.ImgWatermark) + skuItem.ImgMix = jxutils.MixMatermarkImg(downLoad, skuItem.Img, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) + } } } return inSkuList diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index e678e0514..3ae1790cf 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -246,9 +246,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI syncType = "更新商品" } for i, storeSku := range storeSkuList { - isNeedUpdatePrice := isCreate //storeSku.SkuSyncStatus&( model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0 + isNeedUpdatePrice := storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 foodData := make(map[string]interface{}) - foodDataList[i] = foodData + foodDataList[i] = foodData foodData[mtwmapi.KeyAppFoodCode] = utils.Int2Str(storeSku.SkuID) skus := []map[string]interface{}{ map[string]interface{}{ @@ -277,7 +277,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if img2 == "" { img2 = storeSku.Img } - foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, img2, storeSku.Img, storeSku.Img, storeSku.Img), ",") + if storeSku.ImgMix != "" { + foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.ImgMix, img2, storeSku.ImgMix, storeSku.ImgMix, storeSku.ImgMix), ",") + } else { + foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, img2, storeSku.Img, storeSku.Img, storeSku.Img), ",") + } } else { foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, storeSku.Img2), ",") } From 56719838f935268f0e74041542f53447aa984537 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, 17 Jun 2020 15:04:29 +0800 Subject: [PATCH 123/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 2845122c2..ed6930662 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1019,10 +1019,10 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti } orders, err := result2Orders(ctx, orderResult) for _, order := range orders { - // order.StoreID = 102919 - // order.JxStoreID = 102919 - // order.StoreName = "商城模板(成都发货)" - // order.VendorStoreID = model.JdShopMainVendorStoreID + order.StoreID = 102919 + order.JxStoreID = 102919 + order.StoreName = "商城模板(成都发货)" + order.VendorStoreID = model.JdShopMainVendorStoreID partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) globals.SugarLogger.Debugf("SaveJdsOrders, order: [%v]", utils.Format4Output(order, false)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) @@ -1084,13 +1084,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) } - // if order.StoreName != "" { - // storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", order.StoreName) - // if len(storeMaps) > 0 { - // order.StoreID = storeMaps[0].StoreID - // order.VendorStoreID = storeMaps[0].VendorStoreID - // } - // } else { + storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true) if err != nil { globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error()) @@ -1098,6 +1092,10 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o } order.StoreID = storeList[0].ID order.StoreName = storeList[0].Name + storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") + if len(storeMaps) > 0 { + order.VendorStoreID = storeMaps[0].VendorStoreID + } // } //如果是暂停,表示是预订单 if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusPause { @@ -1183,6 +1181,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if len(storeMaps) > 0 { order.StoreID = storeID order.StoreName = storeMaps[0].StoreName + order.VendorStoreID = storeMaps[0].VendorStoreID } else { return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID) } From 952e18fc52bb4fe652978478b1750e685f60ca8c 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, 17 Jun 2020 15:07:02 +0800 Subject: [PATCH 124/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 88538c5e4..73c2e6e49 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -164,7 +164,7 @@ func Init() { ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2) ScheduleTimerFuncByInterval(func() { - orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-15*time.Minute), time.Now()) + orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now()) }, 10*time.Second, 10*time.Minute) ScheduleTimerFuncByInterval(func() { From e1e471d33431a945c96ef7a858cebbe76dbe4083 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, 17 Jun 2020 16:10:47 +0800 Subject: [PATCH 125/152] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/event/event.go | 9 +++++++++ business/jxstore/misc/misc.go | 2 +- controllers/jx_order.go | 15 +++++++++++++++ routers/commentsRouter_controllers.go | 9 +++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/business/jxstore/event/event.go b/business/jxstore/event/event.go index 7dc392dde..8eb899bea 100644 --- a/business/jxstore/event/event.go +++ b/business/jxstore/event/event.go @@ -210,6 +210,15 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool) errMsg += fmt.Sprintf(" 京东page账号:的Cookie无效了!", vv) flag = true } + case model.VendorIDJDShop: + _, err := api.JdShopAPI.OrderDetail("124350112427") + if err != nil { + if strings.Contains(err.Error(), "登录") { + errMsg += fmt.Sprintf("京东商城:[%v]的Cookie无效了!", vv) + flag = true + } + globals.SugarLogger.Debugf("cookieCheck", err) + } } cc.VendorID = v cc.VendorOrgCode = vv diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 73c2e6e49..8e90fa105 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -205,7 +205,7 @@ func Init() { cms.AutoFocusStoreSkusForTopSkus(jxcontext.AdminCtx, true, true) }, createStorePriceTimeList) ScheduleTimerFunc("GetCheckVendorCookie", func() { - event.GetCheckVendorCookie(jxcontext.AdminCtx, []int{model.VendorIDEBAI, model.VendorIDJD, model.VendorIDMTWM, model.VendorIDMTPS}, true) + event.GetCheckVendorCookie(jxcontext.AdminCtx, []int{model.VendorIDEBAI, model.VendorIDJD, model.VendorIDMTWM, model.VendorIDMTPS, model.VendorIDJDShop}, true) }, checkCookieList) ScheduleTimerFunc("SendSeckillSkusCountMsg", func() { cms.SendSeckillSkusCountMsg(jxcontext.AdminCtx, []int{model.VendorIDEBAI, model.VendorIDJD, model.VendorIDMTWM}, false, true) diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 640f07f68..a4d044b51 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -1088,3 +1088,18 @@ func (c *OrderController) SendJdwlForJdsOrder() { return retVal, "", err }) } + +// @Title 手动拉取京东商城订单 +// @Description 手动拉取京东商城订单 +// @Param token header string true "认证token" +// @Param fromTime formData string true "订单起始时间" +// @Param toTime formData string true "订单结束时间" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /SaveJdsOrders [post] +func (c *OrderController) SaveJdsOrders() { + c.callSaveJdsOrders(func(params *tOrderSaveJdsOrdersParams) (retVal interface{}, errCode string, err error) { + err = orderman.SaveJdsOrders(params.Ctx, utils.Str2Time(params.FromTime), utils.Str2Time(params.ToTime)) + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index ae65b47ac..869d0f9b1 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -1224,6 +1224,15 @@ func init() { Filters: nil, Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], + beego.ControllerComments{ + Method: "SaveJdsOrders", + Router: `/SaveJdsOrders`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], beego.ControllerComments{ Method: "SelfDelivered", From 405fdbcc17f3bf38b7f00cc7fbc38aa44d460b36 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, 17 Jun 2020 16:20:14 +0800 Subject: [PATCH 126/152] =?UTF-8?q?cookie=E8=BF=87=E6=9C=9F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/event/event.go | 121 +++++++++++--------------------- 1 file changed, 42 insertions(+), 79 deletions(-) diff --git a/business/jxstore/event/event.go b/business/jxstore/event/event.go index 8eb899bea..fa2557df5 100644 --- a/business/jxstore/event/event.go +++ b/business/jxstore/event/event.go @@ -11,10 +11,8 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" - "git.rosy.net.cn/jx-callback/business/partner/purchase/jd" "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals/api" - "git.rosy.net.cn/jx-callback/globals/api/apimanager" ) var ( @@ -149,87 +147,52 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool) errMsg = "" ) for _, v := range vendorIDs { - appOrgCodeList := apimanager.CurAPIManager.GetAppOrgCodeList(v) - if len(appOrgCodeList) > 0 { - for _, vv := range appOrgCodeList { - cc := &CheckCookie{} - var flag = false - switch v { - case model.VendorIDEBAI: - resultMap, err := api.EbaiAPI.GetStoreOrderInfo(ebaiOrderID) - if len(resultMap) < 1 && err != nil { - if strings.Contains(err.Error(), ebaiErr) || strings.Contains(err.Error(), ebaiErr2) { - errMsg += fmt.Sprintf(" 饿百账号:[%v]的Cookie无效了!", vv) - flag = true - } - } - // result, err := api.Ebai2API.GetEbaiDepotSku(ebaiapi.EbaiWholeCountryStore, "190700570") - // if err != nil || len(result) < 1 { - // cc := &CheckCookie{} - // cc.VendorID = v - // cc.VendorOrgCode = "饿百后台饿鲜达全国账号" - // cc.Status = "无效" - // ccList = append(ccList, cc) - // errMsg += fmt.Sprintf(" 饿百账号:[饿百后台饿鲜达全国账号]的Cookie无效了!", vv) - // flag = true - // } - // result2, err2 := api.EbaiAPI.GetExianDaSkuDepot("190600741") - // if err2 != nil || result2 == nil { - // cc := &CheckCookie{} - // cc.VendorID = v - // cc.VendorOrgCode = "饿鲜达供应链系统" - // cc.Status = "无效" - // ccList = append(ccList, cc) - // errMsg += fmt.Sprintf(" 饿百账号:[饿鲜达供应链系统]的Cookie无效了!", vv) - // flag = true - // } - case model.VendorIDMTWM: - _, err := api.MtwmAPI.PackagePriceGet(mtStoreID) - if err != nil { - if strings.Contains(err.Error(), mtErr) { - errMsg += fmt.Sprintf(" 美团账号:[%v]的Cookie无效了!", vv) - flag = true - } - globals.SugarLogger.Debugf("cookieCheck", err) - } - case model.VendorIDJD: - result, err := jd.GetAPI(vv).GetJdUpcCodeByName("", jdUpcCode, 1, 5) - if len(result) < 1 && err != nil { - if strings.Contains(err.Error(), jdErr) { - errMsg += fmt.Sprintf(" 京东账号:[%v]的Cookie无效了!", vv) - flag = true - } - } - result2, err2 := api.JdPageAPI.GetCorporationInfo("11926674", "92510108MA68KK3M8P") - if err2 != nil || result2 == nil { - cc := &CheckCookie{} - cc.VendorID = v - cc.VendorOrgCode = "京东page账号" - cc.Status = "无效" - ccList = append(ccList, cc) - errMsg += fmt.Sprintf(" 京东page账号:的Cookie无效了!", vv) - flag = true - } - case model.VendorIDJDShop: - _, err := api.JdShopAPI.OrderDetail("124350112427") - if err != nil { - if strings.Contains(err.Error(), "登录") { - errMsg += fmt.Sprintf("京东商城:[%v]的Cookie无效了!", vv) - flag = true - } - globals.SugarLogger.Debugf("cookieCheck", err) - } + cc := &CheckCookie{} + var flag = false + switch v { + case model.VendorIDEBAI: + resultMap, err := api.EbaiAPI.GetStoreOrderInfo(ebaiOrderID) + if len(resultMap) < 1 && err != nil { + if strings.Contains(err.Error(), ebaiErr) || strings.Contains(err.Error(), ebaiErr2) { + errMsg += fmt.Sprintf(" 饿百账号:[%v]的Cookie无效了!") + flag = true } - cc.VendorID = v - cc.VendorOrgCode = vv - if flag { - cc.Status = "无效" - } else { - cc.Status = "有效" + } + case model.VendorIDMTWM: + _, err := api.MtwmAPI.PackagePriceGet(mtStoreID) + if err != nil { + if strings.Contains(err.Error(), mtErr) { + errMsg += fmt.Sprintf(" 美团账号:[%v]的Cookie无效了!") + flag = true } - ccList = append(ccList, cc) + globals.SugarLogger.Debugf("cookieCheck", err) + } + case model.VendorIDJD: + result, err := api.JdAPI.GetJdUpcCodeByName("", jdUpcCode, 1, 5) + if len(result) < 1 && err != nil { + if strings.Contains(err.Error(), jdErr) { + errMsg += fmt.Sprintf(" 京东账号:[%v]的Cookie无效了!") + flag = true + } + } + case model.VendorIDJDShop: + _, err := api.JdShopAPI.OrderDetail("124350112427") + if err != nil { + if strings.Contains(err.Error(), "登录") { + errMsg += fmt.Sprintf("京东商城:[%v]的Cookie无效了!") + flag = true + } + globals.SugarLogger.Debugf("cookieCheck", err) } } + cc.VendorID = v + cc.VendorOrgCode = "" + if flag { + cc.Status = "无效" + } else { + cc.Status = "有效" + } + ccList = append(ccList, cc) } if isAuto && errMsg != "" { globals.SugarLogger.Warnf("GetCheckVendorCookie:[%v]", errMsg) From 1dda9472515469defc5ae2bc9e7c99442f4dea5f 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, 17 Jun 2020 16:53:45 +0800 Subject: [PATCH 127/152] =?UTF-8?q?=E6=9E=9C=E5=9B=ADdiff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/store_sku2.go | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index e678e0514..711a1c88c 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -248,7 +248,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI for i, storeSku := range storeSkuList { isNeedUpdatePrice := isCreate //storeSku.SkuSyncStatus&( model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0 foodData := make(map[string]interface{}) - foodDataList[i] = foodData + foodDataList[i] = foodData foodData[mtwmapi.KeyAppFoodCode] = utils.Int2Str(storeSku.SkuID) skus := []map[string]interface{}{ map[string]interface{}{ @@ -360,6 +360,28 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v return failedList, err } +func switchAttr(vendorCatID int64) (attrs string) { + switch vendorCatID { + case 200002727: + return mtwmapi.MtwmSkuAttr200002727 + case 200001555: + return mtwmapi.MtwmSkuAttr200001555 + case 200002728: + return mtwmapi.MtwmSkuAttr200002728 + case 200001519, 200000592: + return mtwmapi.MtwmSkuAttr200000592 + case 200002704, 200002731: + return mtwmapi.MtwmSkuAttr200002731 + case 200002716: + return mtwmapi.MtwmSkuAttr200002716 + case 200002667, 200002713, 200002670: + return mtwmapi.MtwmSkuAttr200002670 + case 200002680: + return mtwmapi.MtwmSkuAttr200002680 + } + return attrs +} + func stockCount2Mtwm(stock int) (mtwmStock string) { return utils.Int2Str(stock) } From a1c53cebac4c2080afadf57c6f8964a8dd854bd2 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, 17 Jun 2020 16:57:19 +0800 Subject: [PATCH 128/152] =?UTF-8?q?=E6=9E=9C=E5=9B=ADdiff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 23 ++++++++++++++++++-- business/partner/purchase/mtwm/store_sku2.go | 5 +++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 682541b9b..0e7ae9133 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -13,6 +13,8 @@ import ( "time" "unicode" + "github.com/astaxie/beego" + "git.rosy.net.cn/baseapi/platformapi/jdshopapi" "git.rosy.net.cn/jx-callback/globals/api" @@ -843,8 +845,7 @@ func UpdateStoreSkus(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfo func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh, isAsync, isContinueWhenError bool) (hint string, err error) { globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true)) - flag, err := doStoreSkuAudit(ctx, storeIDs, skuBindInfos) - if !flag { + if beego.BConfig.RunMode == "jxgy" { var num int64 db := dao.GetDB() skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh) @@ -859,6 +860,24 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku if num == 0 || !isAsync || hint == "" { hint = utils.Int64ToStr(num) } + } else { + flag, _ := doStoreSkuAudit(ctx, storeIDs, skuBindInfos) + if !flag { + var num int64 + db := dao.GetDB() + skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh) + if err != nil { + return "", err + } + isAsync = asyncStoreSkuOpFilter(ctx, isAsync) + num = int64(len(skuIDs)) + if num > 0 { + hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError) + } + if num == 0 || !isAsync || hint == "" { + hint = utils.Int64ToStr(num) + } + } } return hint, err } diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 711a1c88c..051bcbef1 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -5,6 +5,8 @@ import ( "regexp" "strings" + "github.com/astaxie/beego" + "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" @@ -265,6 +267,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI foodData["unit"] = storeSku.Unit foodData["box_num"] = 1 foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee) + if beego.BConfig.RunMode == "jxgy" { + foodData["common_attr_value"] = switchAttr(storeSku.VendorVendorCatID) + } catCode := tryCatName2Code(storeSku.VendorCatID) if catCode != "" { foodData["category_code"] = catCode From 2761d834dd9e8cc57a48f313be489b4792d0117f 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, 17 Jun 2020 17:06:18 +0800 Subject: [PATCH 129/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=8F=96=E8=AE=A2=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index ed6930662..fb9d7f008 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1007,10 +1007,9 @@ func GetOrderSimpleInfo(ctx *jxcontext.Context, vendorOrderID string) (getOrderS func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) { var ( - pageNo = 1 pageSize = 20 ) - orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNo, pageSize) + orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), 1, pageSize) if err != nil { noticeMsg := fmt.Sprintf("京东商城保存订单出错!(多半是cookie过期了),err :[%v]", err) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "cookie", noticeMsg) @@ -1018,6 +1017,13 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti return err } orders, err := result2Orders(ctx, orderResult) + if orderResult.TotalCount > pageSize { + for pageNO := 2; pageNO < orderResult.TotalCount/pageSize+1; pageNO++ { + orderResult, _ := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNO, pageSize) + orders2, _ := result2Orders(ctx, orderResult) + orders = append(orders, orders2...) + } + } for _, order := range orders { order.StoreID = 102919 order.JxStoreID = 102919 From 692c11d5199d03637095dde9920ef69a5633f513 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, 17 Jun 2020 17:29:18 +0800 Subject: [PATCH 130/152] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=BE=8E=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync2.go | 2 +- business/jxstore/cms/sync_store_sku.go | 2 +- business/jxutils/jxutils.go | 2 +- business/partner/purchase/mtwm/store_sku2.go | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index c6f88ca54..54546dcf3 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -151,7 +151,7 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, skuVendorInfo.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuVendorInfo.Prefix, skuVendorInfo.Name, skuVendorInfo.Comment, skuVendorInfo.Unit, skuVendorInfo.SpecQuality, skuVendorInfo.SpecUnit, 0) if skuVendorInfo.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuVendorInfo.ImgWatermark) - skuVendorInfo.ImgMix = jxutils.MixMatermarkImg(downLoad, skuVendorInfo.Img, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) + skuVendorInfo.ImgMix = jxutils.MixWatermarkImg(downLoad, skuVendorInfo.Img, skuVendorInfo.ExPrefixBegin, skuVendorInfo.ExPrefixEnd) } skuVendorInfo.MergedStatus = jxutils.MergeSkuStatus(skuVendorInfo.Status, skuVendorInfo.NameStatus) if multiStoresHandler, ok := partner.GetPurchasePlatformFromVendorID(skuVendorInfo.VendorID).(partner.IMultipleStoresHandler); ok { diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 20555a483..f8085160e 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -283,7 +283,7 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn skuItem.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0) if skuItem.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuItem.ImgWatermark) - skuItem.ImgMix = jxutils.MixMatermarkImg(downLoad, skuItem.Img, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) + skuItem.ImgMix = jxutils.MixWatermarkImg(downLoad, skuItem.Img, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) } } } diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 75292a136..5842cad0f 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -918,7 +918,7 @@ func PKCS5UnPadding(origData []byte) []byte { } //合成水印图 -func MixMatermarkImg(imgWatermark, img string, exPrefixBegin, exPrefixEnd *time.Time) (imgMix string) { +func MixWatermarkImg(imgWatermark, img string, exPrefixBegin, exPrefixEnd *time.Time) (imgMix string) { if exPrefixBegin != nil && exPrefixEnd != nil { if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 { baseURL := base64.URLEncoding.EncodeToString([]byte(imgWatermark)) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 3ae1790cf..73e9484ba 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -2,6 +2,7 @@ package mtwm import ( "encoding/json" + "fmt" "regexp" "strings" @@ -277,6 +278,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if img2 == "" { img2 = storeSku.Img } + fmt.Println("testmix", storeSku.ImgMix) if storeSku.ImgMix != "" { foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.ImgMix, img2, storeSku.ImgMix, storeSku.ImgMix, storeSku.ImgMix), ",") } else { From 9cf268ae7872cdded566e37d52bdd774df735c44 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, 17 Jun 2020 17:35:11 +0800 Subject: [PATCH 131/152] imgorigin --- business/jxstore/cms/sync_store_sku.go | 3 ++- business/model/dao/store_sku.go | 3 ++- business/partner/purchase/mtwm/store_sku2.go | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index f8085160e..e54cb3d2c 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -283,7 +283,8 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn skuItem.SkuNameOrigin = jxutils.ComposeSkuNameOriginal(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 0) if skuItem.ImgWatermark != "" { downLoad, _ := uploadImgStandard(skuItem.ImgWatermark) - skuItem.ImgMix = jxutils.MixWatermarkImg(downLoad, skuItem.Img, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) + fmt.Println("testdo", downLoad) + skuItem.ImgMix = jxutils.MixWatermarkImg(downLoad, skuItem.ImgOrigin, skuItem.ExPrefixBegin, skuItem.ExPrefixEnd) } } } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 8b2c5a671..e1067875d 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -97,6 +97,7 @@ type StoreSkuSyncInfo struct { DescImg string ImgWatermark string `json:"imgWatermark"` //图片水印 ImgMix string //合成水印后的图片 + ImgOrigin string //skuname里的img VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"` // 平台商品分类(叶子结点) CategoryName string `json:"categoryName"` //分类名 @@ -410,7 +411,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t2.*, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix, - t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, + t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, t3.img img_origin, IF(t11.%s <> '', t11.%s, t3.img) img, IF(t12.%s <> '', t12.%s, t3.img2) img2, IF(t15.%s <> '', t15.%s, t3.img3) img3, diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 73e9484ba..3ae1790cf 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -2,7 +2,6 @@ package mtwm import ( "encoding/json" - "fmt" "regexp" "strings" @@ -278,7 +277,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if img2 == "" { img2 = storeSku.Img } - fmt.Println("testmix", storeSku.ImgMix) if storeSku.ImgMix != "" { foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.ImgMix, img2, storeSku.ImgMix, storeSku.ImgMix, storeSku.ImgMix), ",") } else { From 472c1f34e1385d2a04d3bed808243eb345f46cd8 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, 17 Jun 2020 18:31:25 +0800 Subject: [PATCH 132/152] =?UTF-8?q?=E4=B8=89=E5=B9=B3=E5=8F=B0=E5=95=86?= =?UTF-8?q?=E5=93=81=20=E6=B0=B4=E5=8D=B0=EF=BC=8C=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 4 +- business/jxstore/cms/sku.go | 2 +- business/jxstore/cms/sync.go | 51 ++++++++++++++------ business/jxstore/misc/misc.go | 2 + business/model/dao/sku.go | 8 +-- business/partner/purchase/ebai/store_sku2.go | 8 ++- 6 files changed, 52 insertions(+), 23 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 2845122c2..dd813dae7 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1183,16 +1183,18 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if len(storeMaps) > 0 { order.StoreID = storeID order.StoreName = storeMaps[0].StoreName + order.VendorStoreID = storeMaps[0].VendorStoreID } else { return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID) } if len(order.VendorOrderID) > 12 { suffix := utils.Str2Int(order.VendorOrderID[12:len(order.VendorOrderID)]) suffix++ - order.VendorOrderID = order.VendorOrderID2 + utils.Int2Str(suffix) + order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*10) + utils.Int2Str(suffix) } for _, sku := range skus { sku.VendorOrderID = order.VendorOrderID + sku.ID = 0 order.Skus = append(order.Skus, sku) } order.Status = model.OrderStatusNew diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 1eae474ce..be91a073a 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2562,7 +2562,7 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri EndAt: toTimeP, } dao.WrapAddIDCULDEntity(skuEx, ctx.GetUserName()) - skuExs, _ := dao.GetSkuExinfos(db, []int{nameID}, vendorID, "", utils.ZeroTimeValue, utils.ZeroTimeValue) + skuExs, _ := dao.GetSkuExinfos(db, []int{nameID}, []int{vendorID}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) if len(skuExs) > 0 { skuEx2 := skuExs[0] skuEx2.DeletedAt = time.Now() diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index bb7815c84..634d0d14d 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1108,23 +1108,26 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i } func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, storeSkus []*model.StoreSkuBind, storeMap *model.StoreMap) (err error) { - task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - storeSku := batchItemList[0].(*model.StoreSkuBind) - stock := 0 - if storeSku.Status == model.StoreSkuBindStatusNormal { - stock = 9999 + for _, storeSku := range storeSkus { + stock := 0 + if storeSku.Status == model.StoreSkuBindStatusNormal { + stock = 9999 + } + storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) + if storeSku.JdsID != 0 && len(storeSku2) > 0 { + if storeSku.Status != storeSku2[0].Status { + err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) } - storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) - if storeSku.JdsID != 0 && len(storeSku2) > 0 { - if storeSku.Status != storeSku2[0].Status { - err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) - } - } - return retVal, err - }, storeSkus) - tasksch.HandleTask(task, nil, true).Run() - _, err = task.GetResult(0) + } + } + // task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, + // func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + // storeSku := batchItemList[0].(*model.StoreSkuBind) + + // return retVal, err + // }, storeSkus) + // tasksch.HandleTask(task, nil, true).Run() + // _, err = task.GetResult(0) return err } @@ -1214,3 +1217,19 @@ func buildStoreSkuBindInfo(db *dao.DaoDB, storeID int, storeBind *dao.StoreSkuSy skuBindInfo.Skus = skus return skuBindInfo } + +func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) { + var ( + db = dao.GetDB() + ) + dao.GetSkuExinfos(db, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDJD}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) + // task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, + // func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + // storeSku := batchItemList[0].(*model.StoreSkuBind) + + // return retVal, err + // }, storeSkus) + // tasksch.HandleTask(task, nil, true).Run() + // _, err = task.GetResult(0) + return err +} diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 88538c5e4..1cd40c1ad 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -419,6 +419,8 @@ func doDailyWork() { orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102")) //同步上架京东商城待售商品 cms.RefreshJdsSkusStatus(jxcontext.AdminCtx) + //同步商品额外前缀和水印图 + cms.SyncSkuExperfixAndWatermark(jxcontext.AdminCtx) } func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) { diff --git a/business/model/dao/sku.go b/business/model/dao/sku.go index 3cde6b769..6bbab2c14 100644 --- a/business/model/dao/sku.go +++ b/business/model/dao/sku.go @@ -380,7 +380,7 @@ func InsertUpcDepot(db *DaoDB, result *aliupcapi.GetAliUpcInfoResult) (err error return err } -func GetSkuExinfos(db *DaoDB, nameIDs []int, vendorID int, exPrefix string, fromTime, toTime time.Time) (skuExinfoMaps []*model.SkuExinfoMap, err error) { +func GetSkuExinfos(db *DaoDB, nameIDs []int, vendorIDs []int, exPrefix string, fromTime, toTime time.Time) (skuExinfoMaps []*model.SkuExinfoMap, err error) { sql := ` SELECT * FROM sku_exinfo_map @@ -393,9 +393,9 @@ func GetSkuExinfos(db *DaoDB, nameIDs []int, vendorID int, exPrefix string, from sql += " AND name_id IN (" + GenQuestionMarks(len(nameIDs)) + ")" sqlParams = append(sqlParams, nameIDs) } - if vendorID != -1 { - sql += " AND vendor_id = ?" - sqlParams = append(sqlParams, vendorID) + if len(vendorIDs) > 0 { + sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" + sqlParams = append(sqlParams, vendorIDs) } if exPrefix != "" { sql += " AND ex_prefix LIKE ?" diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index f17ce5bf1..ed7b1287d 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -316,10 +316,16 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg } func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isExd bool) (params map[string]interface{}) { + var img string + if storeSku.ImgMix != "" { + img = storeSku.ImgMix + } else { + img = storeSku.Img + } photos := []map[string]interface{}{ map[string]interface{}{ "is_master": true, - "url": storeSku.Img, + "url": img, }, } if storeSku.Img2 != "" { From 5c88bf12985bb47794ab3e6334c3a8292a9635f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 09:34:30 +0800 Subject: [PATCH 133/152] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= =?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/orderman/order.go | 66 +++++++++++++++++++++++++-- business/jxstore/cms/sku.go | 3 +- business/model/api_config.go | 5 +- 3 files changed, 65 insertions(+), 9 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 86d3e3e9f..8fb60d9e5 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "git.rosy.net.cn/baseapi/platformapi/jdeclpapi" + "git.rosy.net.cn/jx-callback/business/jxstore/common" "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" @@ -1184,9 +1186,10 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } //重新构建order的数据 storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") - if len(storeMaps) > 0 { + stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") + if len(storeMaps) > 0 && len(stores) > 0 { order.StoreID = storeID - order.StoreName = storeMaps[0].StoreName + order.StoreName = stores[0].Name order.VendorStoreID = storeMaps[0].VendorStoreID } else { return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID) @@ -1233,8 +1236,61 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro return err } } - handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL] - waybill2, err := handler.Handler.CreateWaybill(order, 0) - jdshop.CurPurchaseHandler.OrderExport(ctx, vendorOrderID, waybill2.VendorWaybillID, false) + var vendorWaybillID string + if order.StoreID == model.JdShopMainStoreID { + var ( + goodsNos []string + prices []string + quantities []string + ) + for _, v := range order.Skus { + skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil) + if err != nil || len(skus) == 0 { + continue + } + goodsNos = append(goodsNos, skus[0].EclpID) + prices = append(prices, "0") + quantities = append(quantities, utils.Int2Str(v.Count)) + } + eclpSoNo, err := api.JdEclpAPI.AddOrder(&jdeclpapi.AddOrderParam{ + IsvUUID: order.VendorOrderID, + IsvSource: jdeclpapi.IsvSource, + ShopNo: jdeclpapi.ShopNo, + DepartmentNo: jdeclpapi.DepartmentNo, + WarehouseNo: jdeclpapi.WarehouseNo, + SalesPlatformOrderNo: order.VendorOrderID, + SalePlatformSource: jdeclpapi.SalePlatformSource, + ConsigneeName: order.ConsigneeName, + ConsigneeMobile: order.ConsigneeMobile, + ConsigneeAddress: order.ConsigneeAddress, + OrderMark: jdeclpapi.OrderMark, + GoodsNo: strings.Join(goodsNos, ","), + Price: strings.Join(prices, ","), + Quantity: strings.Join(quantities, ","), + }) + waybill := &model.Waybill{ + VendorOrderID: order.VendorOrderID, + OrderVendorID: model.VendorIDJX, + VendorWaybillID: eclpSoNo, + WaybillVendorID: model.VendorIDJDWL, + Status: model.WaybillStatusDelivering, + WaybillCreatedAt: time.Now(), + StatusTime: time.Now(), + WaybillFinishedAt: utils.DefaultTimeValue, + DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled, + } + dao.CreateEntity(db, waybill) + if err != nil { + return err + } + } else { + handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL] + waybill2, err := handler.Handler.CreateWaybill(order, 0) + if err != nil { + return err + } + vendorWaybillID = waybill2.VendorWaybillID + } + jdshop.CurPurchaseHandler.OrderExport(ctx, vendorOrderID, vendorWaybillID, false) return err } diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index be91a073a..9d9d6d5f2 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2587,8 +2587,7 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri } CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, isAsync, isContinueWhenError, ctx.GetUserName()) } else { - CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) - + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, isAsync, isContinueWhenError) } } } diff --git a/business/model/api_config.go b/business/model/api_config.go index fb5b25ad0..ab6d1ffb4 100644 --- a/business/model/api_config.go +++ b/business/model/api_config.go @@ -26,7 +26,8 @@ const ( VendorIDDada = 101 VendorIDMTPS = 102 VendorIDFengNiao = 103 - VendorIDDeliveryEnd = 200 + VendorIDJDWL = 401 //京东物流 + VendorIDDeliveryEnd = 500 VendorIDPrinterBegin = 201 VendorIDFeiE = 201 // 飞鹅打印机 @@ -48,7 +49,6 @@ const ( VendorIDQiNiuCloud = 323 // 七牛云 VendorIDShowAPI = 325 // 万维易源 - VendorIDJDWL = 401 //京东物流 ) type VendorInfo struct { @@ -82,6 +82,7 @@ var ( VendorIDZhongWu: "ZhongWu", VendorIDQiNiuCloud: "Qiniu", + VendorIDJDWL: "Jdwl", } VendorTypeName = map[int]string{ From 6c77f3de1587b0cf6e79e5b990be1318a57a31c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 11:22:55 +0800 Subject: [PATCH 134/152] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E4=B8=8D?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/printer/feie/feie.go | 10 ++++++---- business/partner/printer/xiaowm/xiaowm.go | 10 ++++++---- business/partner/printer/yilianyun/yilianyun.go | 11 +++++++---- business/partner/printer/zhongwu/zhongwu.go | 10 ++++++---- business/partner/purchase/jdshop/order.go | 4 ++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/business/partner/printer/feie/feie.go b/business/partner/printer/feie/feie.go index 95df6cd28..0ec31b271 100644 --- a/business/partner/printer/feie/feie.go +++ b/business/partner/printer/feie/feie.go @@ -59,7 +59,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
商品明细:
-品名 数量 单价 小计
+品名 数量
--------------------------------
` // 实际支付:%s
orderParams := []interface{}{ @@ -80,7 +80,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s
` orderFmt += `%8s%10s%10s
` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += `
共%d种%d件商品 @@ -133,7 +134,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
商品明细:
-品名数量单价小计
+品名 数量
--------------------------------
` // 实际支付:%s
orderParams := []interface{}{ @@ -154,7 +155,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s
` orderFmt += `%s %s %s

` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += `
共%d种%d件商品 diff --git a/business/partner/printer/xiaowm/xiaowm.go b/business/partner/printer/xiaowm/xiaowm.go index 036ae90ed..5b9be1c2b 100644 --- a/business/partner/printer/xiaowm/xiaowm.go +++ b/business/partner/printer/xiaowm/xiaowm.go @@ -60,7 +60,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin 客户备注: * %s* 商品明细: * -品名 数量 单价 小计 +品名 数量 --------------------------------* ` // 实际支付: %s* @@ -81,7 +81,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s*` orderFmt += `%8s%10s%10s*` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + // jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += ` * @@ -135,7 +136,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st 客户备注: * %s* 商品明细: * -品名数量单价小计* +品名 数量* --------------------------------* ` // 实际支付: %s* @@ -156,7 +157,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s*` orderFmt += `%s %s %s*` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + // jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += ` 共%d种%d件商品* diff --git a/business/partner/printer/yilianyun/yilianyun.go b/business/partner/printer/yilianyun/yilianyun.go index f9036496f..a58b93767 100644 --- a/business/partner/printer/yilianyun/yilianyun.go +++ b/business/partner/printer/yilianyun/yilianyun.go @@ -36,6 +36,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin if order.VendorID == model.VendorIDEBAI { getCode = fmt.Sprintf("饿百取货码:%s\\n\n", jxutils.GetEbaiOrderGetCode(order)) } + //TODO 去掉单价和小计,2020-06-18 orderFmt := `
%s
\n\n
手机买菜上京西
@@ -57,7 +58,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin \n \n 商品明细: \n -品名 数量 单价 小计\n +品名 数量 \n --------------------------------\n` // 实际支付:%s\n orderParams := []interface{}{ @@ -78,7 +79,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s\n` orderFmt += `%8s%10s%10s\n` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += `\n 共%d种%d件商品 @@ -125,7 +127,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st \n \n 商品明细: \n -品名数量单价小计\n +品名 数量\n --------------------------------\n` // 实际支付:%s\n orderParams := []interface{}{ @@ -146,7 +148,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s\n` orderFmt += `%s %s %s\n\n` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += `\n 共%d种%d件商品 diff --git a/business/partner/printer/zhongwu/zhongwu.go b/business/partner/printer/zhongwu/zhongwu.go index 312c8979f..a8ef7a8e4 100644 --- a/business/partner/printer/zhongwu/zhongwu.go +++ b/business/partner/printer/zhongwu/zhongwu.go @@ -58,7 +58,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin 商品明细: -品名 数量 单价 小计 +品名 数量 ********************************` // 实际支付:%s orderParams := []interface{}{ @@ -79,7 +79,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s` orderFmt += `%8s%10s%10s` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += ` 共%d种%d件商品 @@ -126,7 +127,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st 商品明细: -品名数量单价小计 +品名 数量 ********************************` // 实际支付:%s orderParams := []interface{}{ @@ -147,7 +148,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s` orderFmt += `%s %s %s` - orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) + orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) + //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } orderFmt += ` 共%d种%d件商品 diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index 7b37f7363..4b704a438 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -62,9 +62,9 @@ func (p *PurchaseHandler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bo status, err := p.GetOrderStatus("", order.VendorOrderID2) //说明此时该订单在平台上已经取消了 if status == model.OrderStatusApplyCancel { - err = ChangeOrderStatus(order.VendorOrderID, model.OrderStatusFinishedPickup, "自动拣货完成") - } else { err = ChangeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, "订单状态发生了改变") + } else { + err = ChangeOrderStatus(order.VendorOrderID, model.OrderStatusFinishedPickup, "自动拣货完成") } return err } From bea7236c218b8eb4ca9372d12e094b6506b672f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 11:29:35 +0800 Subject: [PATCH 135/152] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E4=B8=8D?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/printer/feie/feie.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/partner/printer/feie/feie.go b/business/partner/printer/feie/feie.go index 0ec31b271..d9819d284 100644 --- a/business/partner/printer/feie/feie.go +++ b/business/partner/printer/feie/feie.go @@ -79,7 +79,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s
` - orderFmt += `%8s%10s%10s
` + orderFmt += `%8s
` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } @@ -154,7 +154,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s
` - orderFmt += `%s %s %s

` + orderFmt += `%s

` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } From 34777018ecc4ffb815b1723abd1dadfa1b306089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 11:32:51 +0800 Subject: [PATCH 136/152] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E4=B8=8D?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/printer/xiaowm/xiaowm.go | 4 ++-- business/partner/printer/yilianyun/yilianyun.go | 4 ++-- business/partner/printer/zhongwu/zhongwu.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/business/partner/printer/xiaowm/xiaowm.go b/business/partner/printer/xiaowm/xiaowm.go index 5b9be1c2b..9ea887829 100644 --- a/business/partner/printer/xiaowm/xiaowm.go +++ b/business/partner/printer/xiaowm/xiaowm.go @@ -156,7 +156,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st } for _, sku := range order.Skus { orderFmt += `%s*` - orderFmt += `%s %s %s*` + orderFmt += `%s*` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) // jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } @@ -233,7 +233,7 @@ func (c *PrinterHandler) getOrderContent2(order *model.GoodsOrder, storeTel stri } for _, sku := range order.Skus { orderFmt += `|5%s` - orderFmt += `|5%8s%10s%10s` + orderFmt += `|5%8s` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))) } orderFmt += ` diff --git a/business/partner/printer/yilianyun/yilianyun.go b/business/partner/printer/yilianyun/yilianyun.go index a58b93767..45fd1e948 100644 --- a/business/partner/printer/yilianyun/yilianyun.go +++ b/business/partner/printer/yilianyun/yilianyun.go @@ -78,7 +78,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s\n` - orderFmt += `%8s%10s%10s\n` + orderFmt += `%8s\n` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } @@ -147,7 +147,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s\n` - orderFmt += `%s %s %s\n\n` + orderFmt += `%s\n\n` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } diff --git a/business/partner/printer/zhongwu/zhongwu.go b/business/partner/printer/zhongwu/zhongwu.go index a8ef7a8e4..9eff3d4e1 100644 --- a/business/partner/printer/zhongwu/zhongwu.go +++ b/business/partner/printer/zhongwu/zhongwu.go @@ -78,7 +78,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin for _, sku := range order.Skus { orderFmt += `%s` - orderFmt += `%8s%10s%10s` + orderFmt += `%8s` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } @@ -147,7 +147,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st for _, sku := range order.Skus { orderFmt += `%s` - orderFmt += `%s %s %s` + orderFmt += `%s` orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count)) //jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)) } From b4db86868aad0ab71398dbb5cc61b548bc7c4405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 11:37:11 +0800 Subject: [PATCH 137/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 8fb60d9e5..b935fe752 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1283,6 +1283,7 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro if err != nil { return err } + vendorWaybillID = eclpSoNo } else { handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL] waybill2, err := handler.Handler.CreateWaybill(order, 0) From 79f9442c813fa2624c50ced92e610e23f83b7226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 14:11:59 +0800 Subject: [PATCH 138/152] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index e1067875d..8782f2e93 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -619,7 +619,8 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve } else { sqlParams = append(sqlParams, vendorSkuIDs) } - // globals.SugarLogger.Debugf(sql) + fmt.Println("testvendorsku", sql) + fmt.Println(sqlParams) err = GetRows(db, &l, sql, sqlParams...) return l, err } From a6bf8b105d04e1302ba8779d93b8021b087707b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 14:13:01 +0800 Subject: [PATCH 139/152] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b935fe752..62639ec3c 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -349,6 +349,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. return err } skumapper := storeSkuPriceAndWeight2Map(l) + fmt.Println("testl", utils.Format4Output(l, false)) for _, v := range orderSkus { v.VendorOrderID = order.VendorOrderID v.VendorID = order.VendorID From 217d32d8cb4ef295e12cc1b587245990b90e6bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 14:53:12 +0800 Subject: [PATCH 140/152] =?UTF-8?q?=E9=A5=BF=E9=B2=9C=E8=BE=BE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=95=86=E5=93=81ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 62639ec3c..200056427 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -373,6 +373,12 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. v.JxSkuID = skuBindInfo.SkuID v.ShopPrice = int64(skuBindInfo.Price) v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准 + //饿鲜达的订单做一下处理 + if strings.Contains(order.StoreName, model.ExdStoreName) { + if v.SkuID == 0 && !strings.Contains(v.SkuName, "免费") { + v.SkuID = v.JxSkuID + } + } if skuBindInfo.Price == 0 { globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku门店价格为零(一般原因为没有门店价格信息),orderID:%s, StoreID:%d, SkuID:%d, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.JxSkuID, v) } From e32429ac985ac16a5559ac81813d1039f42fbec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 15:33:30 +0800 Subject: [PATCH 141/152] =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 200056427..772fcc015 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1160,7 +1160,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if err != nil || order == nil { return "", fmt.Errorf("未查询到该订单!订单号:[%v]", vendorOrderID) } - if order.Status >= model.OrderStatusDelivering { + if order.Status >= model.OrderStatusDelivering && order.Status != model.OrderStatusCanceled { return "", fmt.Errorf("暂不支持此状态的订单进行转移!") } if order.VendorID != model.VendorIDJDShop { @@ -1290,6 +1290,8 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro if err != nil { return err } + order.EclpOutID = eclpSoNo + dao.UpdateEntity(db, order, "EclpOutID") vendorWaybillID = eclpSoNo } else { handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL] From b169d66a488f6f8d0cfb159a119769e261881cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 15:47:34 +0800 Subject: [PATCH 142/152] =?UTF-8?q?=E5=95=86=E5=93=81=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=AF=8F=E6=99=9A=E8=87=AA=E5=8A=A8=E8=B7=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- business/jxstore/cms/sync.go | 30 +++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 772fcc015..5f3952da3 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1192,7 +1192,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) return "", err } //重新构建order的数据 - storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") + storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "") if len(storeMaps) > 0 && len(stores) > 0 { order.StoreID = storeID diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 634d0d14d..54fa95b53 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1222,14 +1222,26 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) { var ( db = dao.GetDB() ) - dao.GetSkuExinfos(db, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDJD}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) - // task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, - // func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - // storeSku := batchItemList[0].(*model.StoreSkuBind) - - // return retVal, err - // }, storeSkus) - // tasksch.HandleTask(task, nil, true).Run() - // _, err = task.GetResult(0) + skuExinfos, err := dao.GetSkuExinfos(db, nil, []int{model.VendorIDMTWM, model.VendorIDEBAI, model.VendorIDJD}, "", utils.ZeroTimeValue, utils.ZeroTimeValue) + task := tasksch.NewParallelTask("SyncSkuExperfixAndWatermark", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + skuExinfo := batchItemList[0].(*model.SkuExinfoMap) + skus, err := dao.GetSkus(db, nil, []int{skuExinfo.NameID}, nil, nil, nil) + var skuIDs []int + for _, v := range skus { + skuIDs = append(skuIDs, v.ID) + } + if partner.IsMultiStore(skuExinfo.VendorID) { + for _, v := range skuIDs { + OnUpdateThing(ctx, db, nil, int64(v), model.ThingTypeSku) + } + CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, true, true, ctx.GetUserName()) + } else { + CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{skuExinfo.VendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) + } + return retVal, err + }, skuExinfos) + tasksch.HandleTask(task, nil, true).Run() + _, err = task.GetResult(0) return err } From 1ce453dee5f451e4d578df2a4f205b2d12671335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 16:40:14 +0800 Subject: [PATCH 143/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 29 ++++++++++++++++++--------- business/partner/purchase/jd/store.go | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 5f3952da3..8e836191b 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -343,7 +343,13 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. } } if len(vendorSkuIDs) > 0 { - l, err := dao.GetStoreSkuPriceAndWeight(db, order.VendorStoreID, order.VendorID, vendorSkuIDs) + var vendorStoreID string + if order.VendorID == model.VendorIDJDShop { + vendorStoreID = model.JdShopMainVendorStoreID + } else { + vendorStoreID = order.VendorStoreID + } + l, err := dao.GetStoreSkuPriceAndWeight(db, vendorStoreID, order.VendorID, vendorSkuIDs) if err != nil { globals.SugarLogger.Warnf("updateOrderSkuOtherInfo orderID:%s failed with err:%v", order.VendorOrderID, err) return err @@ -358,20 +364,25 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. if intVendorSkuID != 0 && v.VendorSkuID != "-70000" { // todo hard code skuBindInfo := skumapper[v.VendorSkuID] if skuBindInfo == nil { - //京东商城的话,门店里可能取不到对应商品 - if order.VendorID == model.VendorIDJDShop { - v.JxSkuID = v.SkuID - v.ShopPrice = v.SalePrice * 70 / 100 - } else { - globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) - } + globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku找不到门店价格(或商品映射),orderID:%s, StoreID:%d, VendorSkuID:%s, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.VendorSkuID, v) } else { // TODO 客户端当前逻辑认为SkuID为0为赠品 if v.SkuID == 0 { v.SkuID = v.JxSkuID } v.JxSkuID = skuBindInfo.SkuID - v.ShopPrice = int64(skuBindInfo.Price) + //京东商城的话,门店里可能取不到对应商品 + if order.VendorID == model.VendorIDJDShop { + v.JxSkuID = v.SkuID + storeSkus, _ := dao.GetStoresSkusInfo(db, []int{order.StoreID}, []int{v.SkuID}) + if len(storeSkus) > 0 { + v.ShopPrice = int64(storeSkus[0].Price) + } else { + v.ShopPrice = v.SalePrice * 70 / 100 + } + } else { + v.ShopPrice = int64(skuBindInfo.Price) + } v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准 //饿鲜达的订单做一下处理 if strings.Contains(order.StoreName, model.ExdStoreName) { diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index aca822b80..14e966040 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -148,7 +148,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin StationNo: store.VendorStoreID, Operator: userName, Phone: phone, - Mobile: store.Tel2, + Mobile: store.Tel1, } if store.SyncStatus&model.SyncFlagDeletedMask == 0 { storeParams.OutSystemID = utils.Int2Str(int(store.ID)) From 0f5ae6675065a62772b80a9f1a78bd7132087158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 17:02:21 +0800 Subject: [PATCH 144/152] =?UTF-8?q?=E6=9E=9C=E5=9B=AD=E7=9A=84=E6=9E=9C?= =?UTF-8?q?=E5=88=87=E5=88=86=E7=B1=BB=E6=B7=BB=E5=8A=A0=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/store_sku2.go | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index ed7b1287d..22b40fc7a 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -28,6 +28,14 @@ var ( 175: "赠品专区", 18: "烧烤吧台", } + + //果园果切的饿百分类ID + gygqVendorCatID = map[int]int{ + 201227732: 1, + 201220933: 1, + 201223525: 1, + 201220334: 1, + } ) func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) { @@ -360,6 +368,21 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE params["cat3_id"] = storeSku.ExdCategoryThirdID params["category_id"] = utils.Str2Int64WithDefault(storeSku.VendorCatID, 0) } + //证明是果园的几个果切分类,需要填加工服务 + if gygqVendorCatID[int(storeSku.VendorVendorCatID)] == 1 { + params["process_type"] = model.YES + processDetail := []map[string]interface{}{ + map[string]interface{}{ + "type": "去皮", + "time": 2, + }, + map[string]interface{}{ + "type": "不加工", + "time": 0, + }, + } + params["process_detail"] = processDetail + } if storeSku.DescImg != "" { params["rtf"] = storeSku.DescImg } From 3b5320a4d7114b98707deb70d76f50ec869ebc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 17:44:50 +0800 Subject: [PATCH 145/152] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=89=A9=E6=96=99?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 - business/model/dao/store_sku.go | 2 -- business/partner/purchase/jx/localjx/order.go | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 8e836191b..2a2451ef3 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -355,7 +355,6 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. return err } skumapper := storeSkuPriceAndWeight2Map(l) - fmt.Println("testl", utils.Format4Output(l, false)) for _, v := range orderSkus { v.VendorOrderID = order.VendorOrderID v.VendorID = order.VendorID diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 8782f2e93..f9250a351 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -619,8 +619,6 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve } else { sqlParams = append(sqlParams, vendorSkuIDs) } - fmt.Println("testvendorsku", sql) - fmt.Println(sqlParams) err = GetRows(db, &l, sql, sqlParams...) return l, err } diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 7614f9449..ee675ec6c 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1423,7 +1423,7 @@ func GetMatterOrderStatus(ctx *jxcontext.Context, vendorOrderID string) (result var ( db = dao.GetDB() ) - order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJX) + order, err := dao.GetSimpleOrder(db, vendorOrderID) if err != nil { return nil, err } From 67295204a795b0ef6059e69392b9917f7dbe5017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 18:02:15 +0800 Subject: [PATCH 146/152] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 2a2451ef3..5876bf13f 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1191,6 +1191,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) waybill = v } } + fmt.Println("testway", utils.Format4Output(waybill, false)) handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") if err != nil { From c68e371d2d6cd01df0ed7c8e593921a632d55dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Jun 2020 18:07:31 +0800 Subject: [PATCH 147/152] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 5876bf13f..f2722d9b1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1191,7 +1191,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) waybill = v } } - fmt.Println("testway", utils.Format4Output(waybill, false)) + fmt.Println("test1111", utils.Format4Output(partner.DeliveryPlatformHandlers, false)) handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") if err != nil { From 4295e4f1235e82c1fbd7f74091ad1d776e879739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 19 Jun 2020 08:27:40 +0800 Subject: [PATCH 148/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 15 +++++++-------- business/partner/delivery/jdeclp/waybill.go | 4 ++++ business/partner/delivery/jdeclp/waybill_test.go | 6 ++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index f2722d9b1..c1f5b9ba5 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1109,7 +1109,6 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) } - storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true) if err != nil { globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error()) @@ -1121,13 +1120,12 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o if len(storeMaps) > 0 { order.VendorStoreID = storeMaps[0].VendorStoreID } - // } //如果是暂停,表示是预订单 if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusPause { order.BusinessType = model.BusinessTypeDingshida order.ExpectedDeliveredTime = utils.Str2Time(orderDetail.ExpectedDeliveredTime) } else if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusWaittingExport { - order.ExpectedDeliveredTime = order.CreatedAt.Add(time.Hour) + order.ExpectedDeliveredTime = order.OrderCreatedAt.Add(time.Hour) order.BusinessType = model.BusinessTypeImmediate } else { globals.SugarLogger.Errorf("未知的京东商城订单状态!status : %v", jdsOrder.OrderStatus) @@ -1191,11 +1189,12 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) waybill = v } } - fmt.Println("test1111", utils.Format4Output(partner.DeliveryPlatformHandlers, false)) - handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] - err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") - if err != nil { - return "", err + if waybill.WaybillVendorID != model.VendorIDJDWL { + handler := partner.DeliveryPlatformHandlers[waybill.WaybillVendorID] + err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") + if err != nil { + return "", err + } } } err = jdshop.ChangeOrderStatus(vendorOrderID, model.OrderStatusCanceled, "订单转移被取消") diff --git a/business/partner/delivery/jdeclp/waybill.go b/business/partner/delivery/jdeclp/waybill.go index 0a86dae61..c781d6104 100644 --- a/business/partner/delivery/jdeclp/waybill.go +++ b/business/partner/delivery/jdeclp/waybill.go @@ -94,3 +94,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { return err } + +func (c *DeliveryHandler) OnWaybillMsg() { + +} diff --git a/business/partner/delivery/jdeclp/waybill_test.go b/business/partner/delivery/jdeclp/waybill_test.go index a8b1b4a51..b954e8be9 100644 --- a/business/partner/delivery/jdeclp/waybill_test.go +++ b/business/partner/delivery/jdeclp/waybill_test.go @@ -1 +1,7 @@ package jdeclp + +import "git.rosy.net.cn/jx-callback/globals/testinit" + +func init() { + testinit.Init() +} From f23cb892c03d96c56b202796bb82d646ace6fd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 19 Jun 2020 09:00:56 +0800 Subject: [PATCH 149/152] =?UTF-8?q?=E6=9E=9C=E5=9B=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=A9=E6=B6=A6=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.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index ab88ab3eb..643de03df 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -6,6 +6,8 @@ import ( "sync" "time" + "github.com/astaxie/beego" + "git.rosy.net.cn/jx-callback/business/jxstore/cms" "git.rosy.net.cn/jx-callback/business/authz" @@ -1446,10 +1448,18 @@ func OrderProfitWarning(order *model.GoodsOrder) { storeDetail, err := dao.GetStoreDetail(db, storeID, order.VendorID) if storeDetail != nil && err == nil { payPercentage := storeDetail.PayPercentage - if payPercentage >= 50 { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.ShopPrice)) / 100 + if beego.BConfig.RunMode == "jxgy" { + if payPercentage >= 50 { + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 + } else { + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 + } } else { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 + if payPercentage >= 50 { + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.ShopPrice)) / 100 + } else { + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 + } } if profit < 0 { operatorPhone, operatorName := getOrderOperatorInfo(order, storeDetail) From c671db77f188fc20d7204fde96bad1d8ee97560a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 19 Jun 2020 09:25:02 +0800 Subject: [PATCH 150/152] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=81=9C=E6=AD=A2=E8=B7=B3=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index c1f5b9ba5..7c72bdde8 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1092,6 +1092,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o TotalShopMoney: utils.Float64TwoInt64(math.Round(utils.Int64ToFloat64(orderDetail.ActualPayPrice) * jdshopapi.JdsPayPercentage)), DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled, StatusTime: utils.Str2Time(jdsOrder.OrderCreateTime + ":00"), + OrderSeq: 0, } //获取真实手机号 fakeMobile, err := api.JdShopAPI.PhoneSensltiveInfo(order.VendorOrderID2, orderDetail.MobileKey) @@ -1130,6 +1131,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o } else { globals.SugarLogger.Errorf("未知的京东商城订单状态!status : %v", jdsOrder.OrderStatus) } + setJdsOrderSeq(order) for _, v := range jdsOrder.OrderItems { sku := &model.OrderSku{ VendorID: model.VendorIDJDShop, @@ -1158,6 +1160,12 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o return orders, err } +func setJdsOrderSeq(orders *model.GoodsOrder) { + // sql := ` + // SELECT * FROM + // ` +} + func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) (vendorOrderIDJds string, err error) { globals.SugarLogger.Debugf("jds TransferJdsOrder vendorOrderID: %v, storeID : %v", vendorOrderID, storeID) var ( @@ -1221,6 +1229,9 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) sku.ID = 0 order.Skus = append(order.Skus, sku) } + if storeID != model.JdShopMainStoreID { + order.DeliveryFlag = model.NO + } order.Status = model.OrderStatusNew err = partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) vendorOrderIDJds = order.VendorOrderID From fd910b2da00cd9d66c4c3537ff7df500d31dc309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 19 Jun 2020 11:18:38 +0800 Subject: [PATCH 151/152] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 21 +++++++++++++++------ business/jxutils/jxutils.go | 2 ++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 7c72bdde8..b99e0d1c4 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1075,7 +1075,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o } order := &model.GoodsOrder{ VendorOrderID2: utils.Int64ToStr(jdsOrder.OrderID), - VendorOrderID: utils.Int64ToStr(jdsOrder.OrderID) + "01", + VendorOrderID: utils.Int64ToStr(jdsOrder.OrderID) + "001", VendorID: model.VendorIDJDShop, BaseFreightMoney: jxutils.StandardPrice2Int(jdsOrder.Freight), VendorStatus: utils.Int2Str(jdsOrder.OrderStatus), @@ -1091,6 +1091,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o Status: model.OrderStatusNew, TotalShopMoney: utils.Float64TwoInt64(math.Round(utils.Int64ToFloat64(orderDetail.ActualPayPrice) * jdshopapi.JdsPayPercentage)), DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled, + DeliveryType: model.OrderDeliveryTypeStoreSelf, StatusTime: utils.Str2Time(jdsOrder.OrderCreateTime + ":00"), OrderSeq: 0, } @@ -1160,10 +1161,17 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o return orders, err } -func setJdsOrderSeq(orders *model.GoodsOrder) { - // sql := ` - // SELECT * FROM - // ` +func setJdsOrderSeq(order *model.GoodsOrder) (err error) { + var count int + sql := ` + SELECT count(*) FROM goods_order WHERE store_id = ? AND order_create_at >= ? AND order_create_at <= ? AND vendor_id = ? + ` + sqlParams := []interface{}{ + order.StoreID, utils.Time2Date(time.Now()), utils.Time2Date(time.Now().AddDate(0, 0, 1)), order.VendorID, + } + err = dao.GetRow(dao.GetDB(), &count, sql, sqlParams) + order.OrderSeq = count + 1 + return err } func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) (vendorOrderIDJds string, err error) { @@ -1222,7 +1230,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) if len(order.VendorOrderID) > 12 { suffix := utils.Str2Int(order.VendorOrderID[12:len(order.VendorOrderID)]) suffix++ - order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*10) + utils.Int2Str(suffix) + order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*100) + utils.Int2Str(suffix) } for _, sku := range skus { sku.VendorOrderID = order.VendorOrderID @@ -1233,6 +1241,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) order.DeliveryFlag = model.NO } order.Status = model.OrderStatusNew + setJdsOrderSeq(order) err = partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) vendorOrderIDJds = order.VendorOrderID return vendorOrderIDJds, err diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 5842cad0f..6a878ed2c 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -161,6 +161,8 @@ func GetPossibleVendorIDFromVendorOrderID(vendorOrderID string) (vendorID int) { vendorID = model.VendorIDWSC } else if orderIDLen == len("1000004390") { vendorID = model.VendorIDJX + } else if orderIDLen == len("124557362562002") { + vendorID = model.VendorIDJDShop } } return vendorID From e93f69ca65e0144c5ab91a0c50e393ae80547173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 19 Jun 2020 11:36:36 +0800 Subject: [PATCH 152/152] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index 4b704a438..219514524 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -100,6 +100,7 @@ func (p *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod return err } func (p *PurchaseHandler) CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error) { + ChangeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, reason) return err } func (p *PurchaseHandler) AdjustOrder(ctx *jxcontext.Context, order *model.GoodsOrder, removedSkuList []*model.OrderSku, reason string) (err error) {