银豹同步修改

This commit is contained in:
苏尹岚
2020-05-09 09:59:35 +08:00
parent ef1999eb2c
commit 2e2524a483
4 changed files with 19 additions and 96 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}