From a5488d035aff293d09e1344f608e4fa3324fe6b0 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Tue, 21 Jul 2026 18:47:02 +0800 Subject: [PATCH] Go: refactor to avoid conflicts (#17191) ### Summary 1. merge registery test into ingestion 2. move license code to EE version Signed-off-by: Jin Hai --- internal/admin/handler.go | 32 ------------------ internal/admin/handler_ee.go | 33 ++++++++++++++++++- internal/admin/service.go | 4 +-- internal/admin/service_ee.go | 6 +++- .../registry/cross_domain_test.go | 0 5 files changed, 38 insertions(+), 37 deletions(-) rename internal/{ => ingestion}/registry/cross_domain_test.go (100%) diff --git a/internal/admin/handler.go b/internal/admin/handler.go index 59e416c527..058ba2ce94 100644 --- a/internal/admin/handler.go +++ b/internal/admin/handler.go @@ -712,38 +712,6 @@ func (h *Handler) GetVersion(c *gin.Context) { common.SuccessWithData(c, gin.H{"version": version, "version_type": versionType}, "") } -// GetFingerprint handle get system fingerprint -func (h *Handler) GetFingerprint(c *gin.Context) { - common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") - return -} - -type SetLicenseHTTPRequest struct { - License string `json:"license" binding:"required"` -} - -// SetLicense to set system license -func (h *Handler) SetLicense(c *gin.Context) { - common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") - return -} - -type SetLicenseConfigHTTPRequest struct { - TimeRecordSaveInterval int64 `json:"value1" binding:"required"` - TimeRecordTaskDuration int64 `json:"value2" binding:"required"` -} - -func (h *Handler) UpdateLicenseConfig(c *gin.Context) { - common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") - return -} - -// ShowLicense to get system license -func (h *Handler) ShowLicense(c *gin.Context) { - common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") - return -} - // ListSandboxProviders handle list sandbox providers func (h *Handler) ListSandboxProviders(c *gin.Context) { providers, err := h.service.ListSandboxProviders() diff --git a/internal/admin/handler_ee.go b/internal/admin/handler_ee.go index d86216b516..3b880c3ed3 100644 --- a/internal/admin/handler_ee.go +++ b/internal/admin/handler_ee.go @@ -1992,5 +1992,36 @@ func (h *Handler) ListLogs(c *gin.Context) { } common.SuccessWithData(c, stats, "success") - +} + +// GetFingerprint handle get system fingerprint +func (h *Handler) GetFingerprint(c *gin.Context) { + common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") + return +} + +type SetLicenseHTTPRequest struct { + License string `json:"license" binding:"required"` +} + +// SetLicense to set system license +func (h *Handler) SetLicense(c *gin.Context) { + common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") + return +} + +type SetLicenseConfigHTTPRequest struct { + TimeRecordSaveInterval int64 `json:"value1" binding:"required"` + TimeRecordTaskDuration int64 `json:"value2" binding:"required"` +} + +func (h *Handler) UpdateLicenseConfig(c *gin.Context) { + common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") + return +} + +// ShowLicense to get system license +func (h *Handler) ShowLicense(c *gin.Context) { + common.ResponseWithHttpCodeData(c, http.StatusNotImplemented, common.CodeBadRequest, nil, "method not implemented") + return } diff --git a/internal/admin/service.go b/internal/admin/service.go index d4cbd283d2..c3ded9888c 100644 --- a/internal/admin/service.go +++ b/internal/admin/service.go @@ -1649,9 +1649,7 @@ func (s *Service) HandleHeartbeat(message *common.BaseMessage) (common.ErrorCode Timestamp: message.Timestamp, Ext: message.Ext, } - - GlobalServerStore.UpdateServerInfo(message.ServerName, status) - return CheckLicense() + return UpdateServer(message.ServerName, status) } // InitDefaultAdmin initialize default admin user diff --git a/internal/admin/service_ee.go b/internal/admin/service_ee.go index 75535d771c..9dff7ade52 100644 --- a/internal/admin/service_ee.go +++ b/internal/admin/service_ee.go @@ -25,8 +25,12 @@ import ( "ragflow/internal/entity" ) -// Role management methods +func UpdateServer(serverName string, status *common.BaseMessage) (common.ErrorCode, string) { + GlobalServerStore.UpdateServerInfo(serverName, status) + return CheckLicense() +} +// Role management methods // ListRoles list all roles func (s *Service) ListRoles() ([]map[string]interface{}, error) { result := []map[string]interface{}{ diff --git a/internal/registry/cross_domain_test.go b/internal/ingestion/registry/cross_domain_test.go similarity index 100% rename from internal/registry/cross_domain_test.go rename to internal/ingestion/registry/cross_domain_test.go