Merge remote-tracking branch 'origin/mark' into jdshop

This commit is contained in:
苏尹岚
2020-05-09 10:26:40 +08:00
2 changed files with 18 additions and 27 deletions

View File

@@ -4089,14 +4089,17 @@ func buildStoreSkuBindInfosAndFocus(ctx *jxcontext.Context, db *dao.DaoDB, store
jxPrice = jxutils.CaculatePriceByPricePack(pricePercentagePack2, 0, price) jxPrice = jxutils.CaculatePriceByPricePack(pricePercentagePack2, 0, price)
} }
skuBind := &model.StoreSkuBind{ skuBind := &model.StoreSkuBind{
StoreID: store.ID, StoreID: store.ID,
UnitPrice: price, UnitPrice: price,
Price: price, Price: price,
Status: model.StoreSkuBindStatusNormal, Status: model.StoreSkuBindStatusNormal,
YbID: utils.Str2Int64(v.SkuList[0].VendorSkuID), YbID: utils.Str2Int64(v.SkuList[0].VendorSkuID),
YbPrice: int(v.SkuList[0].VendorPrice), YbPrice: int(v.SkuList[0].VendorPrice),
JxPrice: jxPrice, JxPrice: jxPrice,
YbSyncStatus: 0, YbSyncStatus: 0,
MtwmSyncStatus: model.SyncFlagNewMask,
JdSyncStatus: model.SyncFlagNewMask,
EbaiSyncStatus: model.SyncFlagNewMask,
} }
if len(skus) > 0 { if len(skus) > 0 {
skuBind.SkuID = skus[0].ID skuBind.SkuID = skus[0].ID

View File

@@ -890,25 +890,11 @@ func (v *VendorSync) SyncStoreSkusFromYb(ctx *jxcontext.Context, storeIDs []int,
vendorID = model.VendorIDYB vendorID = model.VendorIDYB
db = dao.GetDB() db = dao.GetDB()
) )
hint, err = v.LoopStoresMap(ctx, db, fmt.Sprintf("从银豹平台同步商品到京西:%v", storeIDs), isAsync, true, []int{vendorID}, storeIDs, storeMapList, err := dao.GetStoresMapList2(db, []int{vendorID}, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", false)
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { for _, v := range storeMapList {
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) hint, err = syncStoreSkusFromYb(ctx, v.StoreID, vendorID, v.VendorStoreID, isAsync, isContinueWhenError)
if len(loopMapInfo.StoreMapList) > 1 { }
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), return hint, err
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)
}
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
}, isContinueWhenError)
return hint, makeSyncError(err)
} }
func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) { func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
@@ -1037,6 +1023,8 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt
} }
_, err = updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosUpt, false) _, 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 return result, err
} }