From 5abefc21a9a338e0082c42ba080e25fa2d95b37b Mon Sep 17 00:00:00 2001 From: ShenQiLun <97694732@qq.com> Date: Wed, 1 Jul 2026 17:41:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86redis=E7=9A=84db=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA11=EF=BC=8Capi/es/updateBookFieldsByISBN=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20page=5Fcount=E4=B8=8Eword=5Fcount=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E5=8F=AF=E6=9B=B4=E6=96=B0=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.bat | 7 +++++++ es/es_config.go | 4 ++-- es/es_search.go | 4 ++-- service/book.go | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 build.bat diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..8698536 --- /dev/null +++ b/build.bat @@ -0,0 +1,7 @@ +@cd /d %~dp0 +SET CGO_ENABLED=0 +SET GOOS=linux +SET GOARCH=amd64 +SET GIN_MODE=release +go build -ldflags="-s -w" +pause \ No newline at end of file diff --git a/es/es_config.go b/es/es_config.go index ee4765f..61a4e1a 100644 --- a/es/es_config.go +++ b/es/es_config.go @@ -47,8 +47,8 @@ func GetESFieldConfig() *ESFieldConfig { "is_return": true, "is_filter": true, "update_time": true, - //"page_count": true, - //"word_count": true, + "page_count": true, + "word_count": true, //"book_format": true, "cat_id": true, "other": true, // 允许更新 other 字段 diff --git a/es/es_search.go b/es/es_search.go index df3e785..092fdbf 100644 --- a/es/es_search.go +++ b/es/es_search.go @@ -2301,7 +2301,7 @@ func (svc *ESSearchService) SearchBooksHandler(c *gin.Context) { endpoint := c.FullPath() // 获取监控的 Redis 客户端 - db1Client, err := redisClient.GetClientByName("db1") + db1Client, err := redisClient.GetClientByName("db11") if err == nil { monitoredRedis := monitor.NewMonitoredRedisClient(db1Client, endpoint) val, _, err := monitoredRedis.Get(ctx, isbn) @@ -2353,7 +2353,7 @@ func (svc *ESSearchService) SearchBookByISBNHandler(c *gin.Context) { endpoint := c.FullPath() // Redis 查询(使用监控) - db1Client, err := redisClient.GetClientByName("db1") + db1Client, err := redisClient.GetClientByName("db11") if err == nil { monitoredRedis := monitor.NewMonitoredRedisClient(db1Client, endpoint) val, _, err := monitoredRedis.Get(ctx, isbn) diff --git a/service/book.go b/service/book.go index e501ae5..df3554e 100644 --- a/service/book.go +++ b/service/book.go @@ -850,7 +850,7 @@ func (svc *BookService) addBookToES(ctx context.Context, req *es.ESBook) (*es.ES // SyncRedisByISBN 同步到Redis func (svc *BookService) SyncRedisByISBN(isbn string, act string) error { - client, err := redisClient.GetClientByName("db1") + client, err := redisClient.GetClientByName("db11") if err != nil { log.Printf("[SyncRedisByISBN] 获取 Redis 客户端失败:%v", err) return err