aa
This commit is contained in:
@@ -1827,47 +1827,34 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// })
|
||||
// }
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
idLists [][]*jdapi.SkuIdEntity
|
||||
k = 1
|
||||
db = dao.GetDB()
|
||||
)
|
||||
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"})
|
||||
for i := 0; i < len(things); i += 50 {
|
||||
var idList []*jdapi.SkuIdEntity
|
||||
for j := i; j < 50*k; j++ {
|
||||
if j == len(things)-1 {
|
||||
break
|
||||
}
|
||||
if things[j].VendorThingID != "" {
|
||||
idList = append(idList, &jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int64ToStr(things[j].ThingID),
|
||||
})
|
||||
}
|
||||
}
|
||||
idLists = append(idLists, idList)
|
||||
k++
|
||||
if i >= len(things) {
|
||||
break
|
||||
}
|
||||
}
|
||||
// fmt.Println(utils.Format4Output(idLists, false))
|
||||
for _, v := range idLists {
|
||||
if v != nil {
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMaps[0].StoreID), v)
|
||||
if strings.Contains(err.Error(), "没有会员价") {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
// task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// storeMap := batchItemList[0].(*model.StoreMap)
|
||||
|
||||
// return retVal, err
|
||||
// }, storeMaps)
|
||||
// tasksch.HandleTask(task, nil, true).Run()
|
||||
// _, err = task.GetResult(0)
|
||||
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
task2 := tasksch.NewParallelTask("uuuuu2", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
thing := batchItemList[0].(*model.ThingMap)
|
||||
if thing.VendorThingID != "" {
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
||||
&jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int64ToStr(thing.ThingID),
|
||||
},
|
||||
})
|
||||
if strings.Contains(err.Error(), "没有会员价") {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, things)
|
||||
tasksch.HandleTask(task2, nil, true).Run()
|
||||
_, err = task2.GetResult(0)
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
_, err = task.GetResult(0)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user