From 202e2b7cc81c683fa9740bd5187a115f51c3653f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 15 Dec 2022 18:07:47 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/sync_store_sku.go | 3 +- business/jxstore/misc/misc.go | 30 +++++++++++++++++++ .../purchase/tiktok_store/store_sku2_utils.go | 6 ++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 95ebe8813..bea2b7dcf 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -489,8 +489,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag now := jxutils.OperationTime2HourMinuteFormat(time.Now()) var failedList []*partner.StoreSkuInfoWithErr for _, sku := range skus { - if !useVendorPriceDirectly && - !isSkuLockTimeValid(sku) { + if !useVendorPriceDirectly && !isSkuLockTimeValid(sku) { sku.VendorPrice = 0 } sku.MergedStatus = MergeSkuSaleStatusWithStoreOpTime(sku, storeDetail, now) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index e20ec70b3..a29c7ea81 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -249,6 +249,11 @@ func Init() { cms.RefreshTiktokShopToken(jxcontext.AdminCtx) }, 60*time.Second, 30*time.Minute) + // 更新门店商品 + ScheduleTimerFuncByInterval(func() { + syncStoreSkuTiktok() + }, 60*time.Second, 1*time.Minute) + // 定时任务刷新当前订单的物流信息 ScheduleTimerFunc("RefreshMaterialLogistics", func() { bidding.LoadingLogistics(nil) @@ -568,6 +573,31 @@ func syncStoreSku() { tasksch.HandleTask(task, nil, true).Run() } +func syncStoreSkuTiktok() { + syncFlag := 0 | model.SyncFlagSaleMask + task := tasksch.NewParallelTask("同步京西商品到抖音平台,方案二使用", nil, jxcontext.AdminCtx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + step := batchItemList[0].(int) + errList := errlist.New() + db := dao.GetDB() + switch step { + case 0: + if beego.BConfig.RunMode != "jxgy" { + errList.AddErr(cms.DeleteSkuNameExPrefixOverdue(db)) + errList.AddErr(cms.SetMultiStoreSkuSyncModifyStatus(db, partner.GetMultiStoreVendorIDs())) + _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, nil, false, nil, nil, syncFlag, true, true) + errList.AddErr(err) + } + case 1: + errList.AddErr(err) + SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID) + } + err = errList.GetErrListAsOne() + return retVal, err + }, []int{0, 1}) + tasksch.HandleTask(task, nil, true).Run() +} + func doDailyWork2() { if beego.BConfig.RunMode == "jxgy" { syncStoreSku() diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index f190897a2..767c8cfc0 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -759,7 +759,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk } stock := localSku.Stock if localSku.Stock == 0 { - stock = 9999 + stock = 99999 } sku.StockNum = stock sku.SkuType = 1 @@ -785,7 +785,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk } stock := localSku.Stock if localSku.Stock == 0 { - stock = 9999 + stock = 99999 } sku.StockNum = stock sku.SkuType = 1 @@ -815,7 +815,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk } stock := localSku.Stock if localSku.Stock == 0 { - stock = 9999 + stock = 99999 } sku.StockNum = stock sku.SkuType = 1