From 95c60f62affa8df0bb22c774546b1f470cf802ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 7 Apr 2021 15:03:24 +0800 Subject: [PATCH] aa --- business/jxstore/tempop/tempop.go | 98 +++++++++++++++--------------- business/partner/purchase/jd/jd.go | 14 ++--- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 386c43c41..5556ceccd 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1840,59 +1840,59 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // tasksch.HandleTask(task, nil, true).Run() // task.GetID() //删京东会员价 - var ( - db = dao.GetDB() - vendorThingIDs []int64 - ) - storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, 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) - 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], - }) - } - } - if len(list) > 0 { - err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list) - } - return result, 0, err - }, ctx, task, vendorThingIDs, 50, true) - return retVal, err - }, storeMaps) - tasksch.HandleTask(task, nil, true).Run() - _, err = task.GetResult(0) - //京东账号更新 // var ( - // db = dao.GetDB() + // db = dao.GetDB() + // vendorThingIDs []int64 // ) - // if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil { - // api.JdAPI.SetCookieWithStr(configs[0].Value) - // result, _ := api.JdAPI.GetJdAppInfo() - // if result != nil { - // if vocs, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, result.OrgCode, model.VendorOrgTypePlatform); len(vocs) > 0 { - // vocs[0].AppKey = result.AppKey - // vocs[0].AppSecret = result.AppSecret - // dao.UpdateEntity(db, vocs[0], "AppKey", "AppSecret") - // } + // storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, 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) + // 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], + // }) + // } + // } + // if len(list) > 0 { + // err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list) + // } + // return result, 0, err + // }, ctx, task, vendorThingIDs, 50, true) + // return retVal, err + // }, storeMaps) + // tasksch.HandleTask(task, nil, true).Run() + // _, err = task.GetResult(0) + //京东账号更新 + var ( + db = dao.GetDB() + ) + if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil { + api.JdAPI.SetCookieWithStr(configs[0].Value) + result, _ := api.JdAPI.GetJdAppInfo() + if result != nil { + if vocs, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, result.OrgCode, model.VendorOrgTypePlatform); len(vocs) > 0 { + vocs[0].AppKey = result.AppKey + vocs[0].AppSecret = result.AppSecret + dao.UpdateEntity(db, vocs[0], "AppKey", "AppSecret") + } + } + } // var ( // db = dao.GetDB() // users []*model.User diff --git a/business/partner/purchase/jd/jd.go b/business/partner/purchase/jd/jd.go index 6b4841b3f..8257c9db3 100644 --- a/business/partner/purchase/jd/jd.go +++ b/business/partner/purchase/jd/jd.go @@ -164,13 +164,13 @@ func OnTokenChange(values url.Values) { result[0].Token = tokenInfo.Token if _, err = dao.UpdateEntity(db, result[0], "Token"); err == nil { //添加成功后去开发者后台填验证码 - if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil { - api.JdAPI.SetCookieWithStr(configs[0].Value) - result2, _ := api.JdAPI.GetJdAppInfo() - result[0].AppKey = result2.AppKey - result[0].AppSecret = result2.AppSecret - dao.UpdateEntity(db, result[0], "AppKey", "AppSecret") - } + // if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil { + // api.JdAPI.SetCookieWithStr(configs[0].Value) + // result2, _ := api.JdAPI.GetJdAppInfo() + // result[0].AppKey = result2.AppKey + // result[0].AppSecret = result2.AppSecret + // dao.UpdateEntity(db, result[0], "AppKey", "AppSecret") + // } } } else { globals.SugarLogger.Debugf("OnTokenChange, 发token,但是库里没这个账号")