From b7852f2f65480c1a5836fbc8d6030dc4f3a47bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 8 Feb 2021 17:21:08 +0800 Subject: [PATCH] aa --- business/jxstore/tempop/tempop.go | 72 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 72c83c416..ff471867d 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1827,10 +1827,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // }) // } var ( - db = dao.GetDB() - // vendorThingIDs []int64 + db = dao.GetDB() + vendorThingIDs []int64 ) - var lists []*jdapi.SkuIdEntity storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, []int{667281}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406") // for _, v := range storeMaps { // storesSkus, _ := dao.GetStoresSkusInfo(db, []int{v.StoreID}, nil) @@ -1841,52 +1840,53 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"}) - // thingIDmap := make(map[int64]string) + thingIDmap := make(map[int64]string) for _, v := range things { if v.VendorThingID != "" { - lists = append(lists, &jdapi.SkuIdEntity{ - OutSkuId: utils.Int64ToStr(v.ThingID), - }) - // vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID)) - // thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID) + // lists = append(lists, &jdapi.SkuIdEntity{ + // OutSkuId: utils.Int64ToStr(v.ThingID), + // }) + 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) - // 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], - // // }, - // // }) - // result = []int64{vv.SkuID} - // // } - // } - // return result, 0, err - // }, ctx, task, vendorThingIDs, 40, true) + FreeBatchInfo("uuuuu2", 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 { + fmt.Println("vipPrice", vv.SkuID) + err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), []*jdapi.SkuIdEntity{ + &jdapi.SkuIdEntity{ + OutSkuId: thingIDmap[vv.SkuID], + }, + }) + // result = []int64{vv.SkuID} + } + } + return result, 0, err + }, ctx, task, vendorThingIDs, 50, true) // for _, v := range resultList { - // var thingmaps []*model.ThingMap - // sql := ` + // 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: thingIDmap[v.(int64)], - // }) + // sqlParams := []interface{}{v, 320406, utils.DefaultTimeValue} + // err = dao.GetRows(db, &thingmaps, sql, sqlParams) + // for _, vv := range thingmaps { + // lists = append(lists, &jdapi.SkuIdEntity{ + // OutSkuId: thingIDmap[v.(int64)], + // }) + // } // } - // } - 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) + // 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()