同步京东库存修改
This commit is contained in:
@@ -1116,45 +1116,45 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeSkus []*model.StoreSkuBind, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) {
|
func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeSkus []*model.StoreSkuBind, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) {
|
||||||
// for _, storeSku := range storeSkus {
|
for _, storeSku := range storeSkus {
|
||||||
// stock := 0
|
stock := 0
|
||||||
// storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID})
|
storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID})
|
||||||
// if storeSku.JdsID != 0 {
|
if storeSku.JdsID != 0 {
|
||||||
// if len(storeSku2) > 0 {
|
if len(storeSku2) > 0 {
|
||||||
// if storeSku2[0].Status == model.StoreSkuBindStatusNormal {
|
if storeSku2[0].Status == model.StoreSkuBindStatusNormal {
|
||||||
// stock = 9999
|
stock = 9999
|
||||||
// }
|
|
||||||
// if storeMap.VendorStoreID != "" {
|
|
||||||
// err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID))
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError).SetParallelCount(1).SetBatchSize(20), ctx,
|
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
|
||||||
storeSku := batchItemList[0].(*model.StoreSkuBind)
|
|
||||||
stock := 0
|
|
||||||
storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID})
|
|
||||||
if storeSku.JdsID != 0 {
|
|
||||||
if len(storeSku2) > 0 {
|
|
||||||
if storeSku2[0].Status == model.StoreSkuBindStatusNormal {
|
|
||||||
stock = 9999
|
|
||||||
}
|
|
||||||
if storeMap.VendorStoreID != "" {
|
|
||||||
err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID))
|
|
||||||
}
|
}
|
||||||
|
if storeMap.VendorStoreID != "" {
|
||||||
|
err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID))
|
||||||
}
|
}
|
||||||
return retVal, err
|
}
|
||||||
}, storeSkus)
|
|
||||||
tasksch.HandleTask(task, parentTask, true).Run()
|
|
||||||
if !isAsync {
|
|
||||||
_, err = task.GetResult(0)
|
|
||||||
}
|
}
|
||||||
|
// task := tasksch.NewParallelTask("syncJdsStoreStock", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError).SetParallelCount(1).SetBatchSize(20), ctx,
|
||||||
|
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
// storeSku := batchItemList[0].(*model.StoreSkuBind)
|
||||||
|
// stock := 0
|
||||||
|
// storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID})
|
||||||
|
// if storeSku.JdsID != 0 {
|
||||||
|
// if len(storeSku2) > 0 {
|
||||||
|
// if storeSku2[0].Status == model.StoreSkuBindStatusNormal {
|
||||||
|
// stock = 9999
|
||||||
|
// }
|
||||||
|
// if storeMap.VendorStoreID != "" {
|
||||||
|
// err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID))
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, 0, utils.Str2Int(storeMap.VendorStoreID))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return retVal, err
|
||||||
|
// }, storeSkus)
|
||||||
|
// tasksch.HandleTask(task, parentTask, true).Run()
|
||||||
|
// if !isAsync {
|
||||||
|
// _, err = task.GetResult(0)
|
||||||
|
// }
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ var (
|
|||||||
"20:30:00",
|
"20:30:00",
|
||||||
}
|
}
|
||||||
dailyWorkTimeList2 = []string{
|
dailyWorkTimeList2 = []string{
|
||||||
"02:00:00",
|
"18:30:00",
|
||||||
}
|
}
|
||||||
priceReferTimeList = []string{
|
priceReferTimeList = []string{
|
||||||
"03:00:00",
|
"03:00:00",
|
||||||
|
|||||||
Reference in New Issue
Block a user