From 2e2524a4833b07417b69898c8e0aa31824cfd43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Sat, 9 May 2020 09:59:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=B6=E8=B1=B9=E5=90=8C=E6=AD=A5=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/cms/store_sku.go | 19 +++++--- business/jxstore/cms/sync.go | 16 ++---- business/partner/purchase/yb/sku.go | 76 ----------------------------- business/partner/purchase/yb/yb.go | 4 ++ 4 files changed, 19 insertions(+), 96 deletions(-) delete mode 100644 business/partner/purchase/yb/sku.go diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 2a2462f77..073f93ddf 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4089,14 +4089,17 @@ func buildStoreSkuBindInfosAndFocus(ctx *jxcontext.Context, db *dao.DaoDB, store jxPrice = jxutils.CaculatePriceByPricePack(pricePercentagePack2, 0, price) } skuBind := &model.StoreSkuBind{ - StoreID: store.ID, - UnitPrice: price, - Price: price, - Status: model.StoreSkuBindStatusNormal, - YbID: utils.Str2Int64(v.SkuList[0].VendorSkuID), - YbPrice: int(v.SkuList[0].VendorPrice), - JxPrice: jxPrice, - YbSyncStatus: 0, + StoreID: store.ID, + UnitPrice: price, + Price: price, + Status: model.StoreSkuBindStatusNormal, + YbID: utils.Str2Int64(v.SkuList[0].VendorSkuID), + YbPrice: int(v.SkuList[0].VendorPrice), + JxPrice: jxPrice, + YbSyncStatus: 0, + MtwmSyncStatus: model.SyncFlagNewMask, + JdSyncStatus: model.SyncFlagNewMask, + EbaiSyncStatus: model.SyncFlagNewMask, } if len(skus) > 0 { skuBind.SkuID = skus[0].ID diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 2dec86e8e..614003c07 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -893,18 +893,8 @@ func (v *VendorSync) SyncStoreSkusFromYb(ctx *jxcontext.Context, storeIDs []int, hint, err = v.LoopStoresMap(ctx, db, fmt.Sprintf("从银豹平台同步商品到京西:%v", storeIDs), isAsync, true, []int{vendorID}, storeIDs, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) - if len(loopMapInfo.StoreMapList) > 1 { - loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), - tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError).SetParallelCount(5), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - storeMap := batchItemList[0].(*model.StoreMap) - _, err = syncStoreSkusFromYb(ctx, storeMap.StoreID, vendorID, storeMap.VendorStoreID, isAsync, isContinueWhenError) - return nil, err - }, loopMapInfo.StoreMapList) - t.AddChild(loopStoreTask).Run() - _, err = loopStoreTask.GetResult(0) - } else { - _, err = syncStoreSkusFromYb(ctx, loopMapInfo.StoreMapList[0].StoreID, vendorID, loopMapInfo.StoreMapList[0].VendorStoreID, isAsync, isContinueWhenError) + for _, v := range loopMapInfo.StoreMapList { + syncStoreSkusFromYb(ctx, v.StoreID, vendorID, v.VendorStoreID, isAsync, isContinueWhenError) } return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) }, isContinueWhenError) @@ -1037,6 +1027,8 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt } _, err = updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosUpt, false) } + case 3: + _, err = CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{0, 1, 3}, nil, false, nil, nil, 0, true, true) } return result, err } diff --git a/business/partner/purchase/yb/sku.go b/business/partner/purchase/yb/sku.go deleted file mode 100644 index 92e8d5f0f..000000000 --- a/business/partner/purchase/yb/sku.go +++ /dev/null @@ -1,76 +0,0 @@ -package yb - -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" -) - -func (p *PurchaseHandler) GetAllCategories(ctx *jxcontext.Context, vendorOrgCode string) (cats []*partner.BareCategoryInfo, err error) { - return cats, err -} - -// func (p *PurchaseHandler) UpdateCategory(db *dao.DaoDB, cat *model.SkuCategory, userName string) error { -// return nil -// } - -// func (p *PurchaseHandler) DeleteCategory(db *dao.DaoDB, cat *model.SkuCategory, userName string) error { -// return nil -// } - -// func (p *PurchaseHandler) ReorderCategories(db *dao.DaoDB, parentCatID int, userName string) (err error) { -// return err -// } - -func (p *PurchaseHandler) CreateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) { - return err -} - -func (p *PurchaseHandler) UpdateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) { - return err -} - -func (p *PurchaseHandler) DeleteCategory2(ctx *jxcontext.Context, vendorOrgCode, vendorCatID string) (err error) { - return err -} - -func (p *PurchaseHandler) ReorderCategories2(ctx *jxcontext.Context, vendorOrgCode, vendorParentCatID string, vendorCatIDList []string) (err error) { - return err -} - -// func (p *PurchaseHandler) CreateSku(db *dao.DaoDB, sku *model.Sku, userName string) (err error) { -// return err -// } - -// func (p *PurchaseHandler) ReadSku(ctx *jxcontext.Context, vendorOrgCode, vendorSkuID string) (skuNameExt *model.SkuNameExt, err error) { -// return skuNameExt, err -// } - -// func (p *PurchaseHandler) UpdateSku(db *dao.DaoDB, sku *model.Sku, userName string) (err error) { -// return err -// } - -// func (p *PurchaseHandler) DeleteSku(db *dao.DaoDB, sku *model.Sku, userName string) (err error) { -// return err -// } - -func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) { - return err -} - -func (p *PurchaseHandler) UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) { - return err -} - -func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, vendorOrgCode string, sku *partner.StoreSkuInfo) (err error) { - return err -} - -func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) { - return vendorCats, err -} - -func (p *PurchaseHandler) GetSkus(ctx *jxcontext.Context, vendorOrgCode string, skuID int, vendorSkuID string) (skuNameList []*partner.SkuNameInfo, err error) { - return skuNameList, err -} diff --git a/business/partner/purchase/yb/yb.go b/business/partner/purchase/yb/yb.go index 7f6518213..9c52f8b18 100644 --- a/business/partner/purchase/yb/yb.go +++ b/business/partner/purchase/yb/yb.go @@ -37,3 +37,7 @@ func (p *PurchaseHandler) GetVendorID() int { func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error) { return imgHint, err } + +func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) { + return vendorCats, err +}