aa
This commit is contained in:
@@ -1827,10 +1827,17 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
|
vendorThingIDs []int64
|
||||||
)
|
)
|
||||||
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, []int{667281}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, []int{667281}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||||
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||||
|
thingIDmap := make(map[int64]string)
|
||||||
|
|
||||||
|
for _, v := range things {
|
||||||
|
vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID))
|
||||||
|
thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID)
|
||||||
|
}
|
||||||
// for i := 0; i < len(things); i += 50 {
|
// for i := 0; i < len(things); i += 50 {
|
||||||
// // var idList []*jdapi.SkuIdEntity
|
// // var idList []*jdapi.SkuIdEntity
|
||||||
// var idList2 []int64
|
// var idList2 []int64
|
||||||
@@ -1853,23 +1860,19 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
storeMap := batchItemList[0].(*model.StoreMap)
|
storeMap := batchItemList[0].(*model.StoreMap)
|
||||||
task2 := tasksch.NewParallelTask("uuuuu2", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
FreeBatchInfo("uuuuu", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
||||||
thing := batchItemList[0].(*model.ThingMap)
|
for _, vv := range priceInfo {
|
||||||
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, []int64{utils.Str2Int64(thing.VendorThingID)})
|
if vv.VipPrice != 0 {
|
||||||
for _, vv := range priceInfo {
|
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
||||||
if vv.VipPrice != 0 {
|
&jdapi.SkuIdEntity{
|
||||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
OutSkuId: thingIDmap[vv.SkuID],
|
||||||
&jdapi.SkuIdEntity{
|
},
|
||||||
OutSkuId: utils.Int64ToStr(thing.ThingID),
|
})
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return retVal, err
|
}
|
||||||
}, things)
|
return nil, 0, err
|
||||||
tasksch.HandleTask(task2, nil, true).Run()
|
}, ctx, task, vendorThingIDs, 50, true)
|
||||||
_, err = task2.GetResult(0)
|
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, storeMaps)
|
}, storeMaps)
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
@@ -1877,6 +1880,24 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FreeBatchInfo(name string, handler func(tasksch.ITask, []int64) (interface{}, int, error), ctx *jxcontext.Context, parentTask tasksch.ITask, storeSkuList []int64, batchSize int, isContinueWhenError bool) (resultList []interface{}, err error) {
|
||||||
|
task := tasksch.NewParallelTask2(fmt.Sprintf("FreeBatchInfo:%s", name), tasksch.NewParallelConfig().SetParallelCount(1).SetBatchSize(batchSize).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, successCount int, err error) {
|
||||||
|
batchStoreSkuList := make([]int64, len(batchItemList))
|
||||||
|
for k, v := range batchItemList {
|
||||||
|
batchStoreSkuList[k] = v.(int64)
|
||||||
|
}
|
||||||
|
retVal, successCount, err = handler(task, batchStoreSkuList)
|
||||||
|
if err != nil {
|
||||||
|
retVal = nil
|
||||||
|
}
|
||||||
|
return retVal, successCount, err
|
||||||
|
}, storeSkuList)
|
||||||
|
tasksch.HandleTask(task, parentTask, false).Run()
|
||||||
|
resultList, err = task.GetResult(0)
|
||||||
|
return resultList, err
|
||||||
|
}
|
||||||
|
|
||||||
func int2TimeStr(time int) (str string) {
|
func int2TimeStr(time int) (str string) {
|
||||||
str += utils.Int2Str(time / 1000)
|
str += utils.Int2Str(time / 1000)
|
||||||
str += utils.Int2Str(time % 1000 / 100)
|
str += utils.Int2Str(time % 1000 / 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user