aa
This commit is contained in:
@@ -1860,19 +1860,38 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
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)
|
||||
FreeBatchInfo("uuuuu", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||
resultList, _ := FreeBatchInfo("uuuuu", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
||||
for _, vv := range priceInfo {
|
||||
if vv.VipPrice != 0 {
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
||||
&jdapi.SkuIdEntity{
|
||||
OutSkuId: thingIDmap[vv.SkuID],
|
||||
},
|
||||
})
|
||||
// err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{
|
||||
// &jdapi.SkuIdEntity{
|
||||
// OutSkuId: thingIDmap[vv.SkuID],
|
||||
// },
|
||||
// })
|
||||
result = []int64{vv.SkuID}
|
||||
}
|
||||
}
|
||||
return nil, 0, err
|
||||
return result, 0, err
|
||||
}, ctx, task, vendorThingIDs, 50, true)
|
||||
var lists []*jdapi.SkuIdEntity
|
||||
for _, v := range resultList {
|
||||
var thingmaps []*model.ThingMap
|
||||
sql := `
|
||||
SELECT * FROM thing_map WHERE vendor_thing_id = ? AND vendor_org_code = ? AND deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{v, 320406, utils.DefaultTimeValue}
|
||||
err = dao.GetRows(db, &thingmaps, sql, sqlParams)
|
||||
for _, vv := range thingmaps {
|
||||
lists = append(lists, &jdapi.SkuIdEntity{
|
||||
OutSkuId: utils.Int64ToStr(vv.ThingID),
|
||||
})
|
||||
}
|
||||
}
|
||||
FreeBatchInfo2("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []*jdapi.SkuIdEntity) (result interface{}, successCount int, err error) {
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), batchedStoreSkuList)
|
||||
return result, 0, err
|
||||
}, ctx, task, lists, 50, true)
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
@@ -1880,6 +1899,24 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func FreeBatchInfo2(name string, handler func(tasksch.ITask, []*jdapi.SkuIdEntity) (interface{}, int, error), ctx *jxcontext.Context, parentTask tasksch.ITask, storeSkuList []*jdapi.SkuIdEntity, 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([]*jdapi.SkuIdEntity, len(batchItemList))
|
||||
for k, v := range batchItemList {
|
||||
batchStoreSkuList[k] = v.(*jdapi.SkuIdEntity)
|
||||
}
|
||||
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 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) {
|
||||
|
||||
Reference in New Issue
Block a user