From 70cb3e301e6db444529c88307a154de76a7b7913 Mon Sep 17 00:00:00 2001 From: Odboy Date: Fri, 11 Sep 2026 21:05:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api):=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E7=94=9F=E6=95=88=E7=9A=84=20fetchAll=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 FetchChangedRequest 中未使用的 FetchAll 字段 - addChangedConfigs 去掉 fetchAll 参数及两处调用 --- server/internal/handler/config_api.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/internal/handler/config_api.go b/server/internal/handler/config_api.go index 74ad5c0..8ff71db 100644 --- a/server/internal/handler/config_api.go +++ b/server/internal/handler/config_api.go @@ -155,7 +155,6 @@ type FetchChangedRequest struct { Version string `json:"version"` LastTime int64 `json:"lastTime" binding:"required"` IgnoreGlobal bool `json:"ignoreGlobal"` - FetchAll bool `json:"fetchAll"` Token string `json:"token"` } @@ -238,7 +237,7 @@ func (h *ConfigApiHandler) FetchChangedConfigs(c *gin.Context) { dao.Engine.Where("env = ? AND version = ? AND enabled = 1 AND group_id = ? AND (app_id is null OR app_id = 0) AND updated_at > ? AND updated_at <= ?", req.Env, version, *app.GroupId, lastUpdateTime, upperBound).Find(&globalConfigs) for _, cfg := range globalConfigs { - if h.addChangedConfigs(result, &cfg, req.FetchAll) { + if h.addChangedConfigs(result, &cfg) { configIds = append(configIds, cfg.Id) } } @@ -249,7 +248,7 @@ func (h *ConfigApiHandler) FetchChangedConfigs(c *gin.Context) { dao.Engine.Where("env = ? AND version = ? AND enabled = 1 AND app_id = ? AND updated_at > ? AND updated_at <= ?", req.Env, version, app.Id, lastUpdateTime, upperBound).Find(&appConfigs1) for _, cfg := range appConfigs1 { - if h.addChangedConfigs(result, &cfg, req.FetchAll) { + if h.addChangedConfigs(result, &cfg) { configIds = append(configIds, cfg.Id) } } @@ -284,7 +283,7 @@ func (h *ConfigApiHandler) FetchChangedConfigs(c *gin.Context) { c.JSON(http.StatusOK, model.WrapperResponse{Code: 0, Data: result}) } -func (h *ConfigApiHandler) addChangedConfigs(result map[string]string, config *model.AppConfig, fetchAll bool) bool { +func (h *ConfigApiHandler) addChangedConfigs(result map[string]string, config *model.AppConfig) bool { kvMap, err := h.parseService.ParseConfigToKVMap(config) if err != nil { logger.SugaredLogger.Errorf("[FetchChangedConfigs] parse config %d (%s) error: %v", config.Id, config.Name, err)