From 7df7d6c4de8bb702cd32d27942e7de62bdef87a3 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Wed, 9 Sep 2020 14:49:55 +0800 Subject: [PATCH] 'commit' --- .../AccessSystem/AccessSystemDao/AccessSystemDao.go | 7 +++++++ .../ElasticsearchToGreenPlum.go | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dsSupport/MyModel/AccessSystem/AccessSystemDao/AccessSystemDao.go b/dsSupport/MyModel/AccessSystem/AccessSystemDao/AccessSystemDao.go index 27f5f5c3..15ba021b 100644 --- a/dsSupport/MyModel/AccessSystem/AccessSystemDao/AccessSystemDao.go +++ b/dsSupport/MyModel/AccessSystem/AccessSystemDao/AccessSystemDao.go @@ -99,6 +99,9 @@ func UpdateSso(appId string, redirectUri string, logoutUri string) error { model := new(models.TAppBase) //修改REDIS缓存 _, err := db.Where("app_id = ?", appId).Get(&model) + //1、清除Redis缓存 + var selector = SqlKit.GetBean("t_base_class") + SqlKit.DeleteCacheByIds([]string{appId}, selector) //删除REDIS缓存 _ = deleteRedisCache(model.AccessKey) model.RedirectUri = redirectUri @@ -116,6 +119,10 @@ func ClearSso(appId string) error { model := new(models.TAppBase) //修改REDIS缓存 _, err := db.Where("app_id = ?", appId).Get(&model) + //1、清除Redis缓存 + var selector = SqlKit.GetBean("t_base_class") + SqlKit.DeleteCacheByIds([]string{appId}, selector) + //删除REDIS缓存 _ = deleteRedisCache(model.AccessKey) model.RedirectUri = "" diff --git a/dsSupport/Test/ElasticsearchToGreenPlum/ElasticsearchToGreenPlum.go b/dsSupport/Test/ElasticsearchToGreenPlum/ElasticsearchToGreenPlum.go index 6372c0e0..e147fa6b 100644 --- a/dsSupport/Test/ElasticsearchToGreenPlum/ElasticsearchToGreenPlum.go +++ b/dsSupport/Test/ElasticsearchToGreenPlum/ElasticsearchToGreenPlum.go @@ -77,14 +77,15 @@ func main() { value := gjson.Get(resStr, "data_content") addRecord(pk, value.String()) } - //批量执行 - batchSave(indexName, pk) + //继续用的 scoll_id scrollId := result.ScrollId //第一次命中的个数 var nowCount = int64(len(result.Hits.Hits)) //总的命中个数 allCount := result.TotalHits() + //批量执行 + batchSave(indexName, pk,nowCount,allCount) //开始循环 for { @@ -111,7 +112,7 @@ func main() { if len(pkStrArray) == 0 { //应该是有错误的数据,导致拿不到结果 continue } - batchSave(indexName, pk) + batchSave(indexName, pk,nowCount,allCount) } fmt.Println("索引" + indexName + "同步完成!") } @@ -177,7 +178,7 @@ func addRecord(pk string, jsonStr string) { } //提交 -func batchSave(tableName string, pkName string) { +func batchSave(tableName string, pkName string,nowCount int64,allCount int64) { var pkStr = "" //数组去重 pkStrArray = CommonUtil.RemoveRepeatedElement(pkStrArray) @@ -207,5 +208,5 @@ func batchSave(tableName string, pkName string) { fmt.Println(sql) panic(err) } - fmt.Println(tableName + "批量执行" + CommonUtil.ConvertIntToString(len(insertStrArray)) + "条.") + fmt.Println(tableName + "批量执行" + CommonUtil.ConvertIntToString(len(insertStrArray)) + "条,目前:"+CommonUtil.ConvertInt64ToString(nowCount)+"/"+CommonUtil.ConvertInt64ToString(allCount)) }