diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index c86896a1a..a5f0908f3 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1841,54 +1841,54 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // tasksch.HandleTask(task, nil, true).Run() // task.GetID() //删京东会员价 - //var ( - // db = dao.GetDB() - // vendorThingIDs []int64 - // // result3 []int - //) - //storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, []int{103197, 666774}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406") - //things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"}) - //thingIDmap := make(map[int64]string) - // - //for _, v := range things { - // if v.VendorThingID != "" { - // vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID)) - // thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID) - // } - //} - // - //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) - // // result1, _ := - // FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) { - // api := jd.GetAPI("320406") - // priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList) - // var list []*jdapi.SkuIdEntity - // for _, vv := range priceInfo { - // if vv.VipPrice != 0 { - // list = append(list, &jdapi.SkuIdEntity{ - // OutSkuId: thingIDmap[vv.SkuID], - // }) - // // result = []bool{true} - // // return result, 0, err - // } - // } - // if len(list) > 0 { - // err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list) - // } - // return result, 0, err - // }, ctx, task, vendorThingIDs, 50, true) - // // for _, v := range result1 { - // // if v.(bool) { - // // retVal = []int{storeMap.StoreID} - // // return retVal, err - // // } - // // } - // return retVal, err - // }, storeMaps) - //tasksch.HandleTask(task, nil, true).Run() - //_, err = task.GetResult(0) + var ( + db = dao.GetDB() + vendorThingIDs []int64 + // result3 []int + ) + storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406") + things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, []int{34322, 24206, 24207}, []string{"320406"}) + thingIDmap := make(map[int64]string) + + for _, v := range things { + if v.VendorThingID != "" { + vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID)) + thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID) + } + } + + 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) + // result1, _ := + FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) { + api := jd.GetAPI("320406") + priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList) + var list []*jdapi.SkuIdEntity + for _, vv := range priceInfo { + if vv.VipPrice != 0 { + list = append(list, &jdapi.SkuIdEntity{ + OutSkuId: thingIDmap[vv.SkuID], + }) + // result = []bool{true} + // return result, 0, err + } + } + if len(list) > 0 { + err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list) + } + return result, 0, err + }, ctx, task, vendorThingIDs, 50, true) + // for _, v := range result1 { + // if v.(bool) { + // retVal = []int{storeMap.StoreID} + // return retVal, err + // } + // } + return retVal, err + }, storeMaps) + tasksch.HandleTask(task, nil, true).Run() + _, err = task.GetResult(0) // for _, v := range result2 { // result3 = append(result3, v.(int)) // }