Merge remote-tracking branch 'origin/mark' into jdshop
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -890,25 +890,11 @@ func (v *VendorSync) SyncStoreSkusFromYb(ctx *jxcontext.Context, storeIDs []int,
|
||||
vendorID = model.VendorIDYB
|
||||
db = dao.GetDB()
|
||||
)
|
||||
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)
|
||||
}
|
||||
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
|
||||
}, isContinueWhenError)
|
||||
return hint, makeSyncError(err)
|
||||
storeMapList, err := dao.GetStoresMapList2(db, []int{vendorID}, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", false)
|
||||
for _, v := range storeMapList {
|
||||
hint, err = syncStoreSkusFromYb(ctx, v.StoreID, vendorID, v.VendorStoreID, isAsync, isContinueWhenError)
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
case 3:
|
||||
_, err = CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{0, 1, 3}, nil, false, nil, nil, 0, true, true)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user