From cc1de7c77693b5c4238f80d3b8513442f8f2ec9f Mon Sep 17 00:00:00 2001 From: Eli Yip Date: Tue, 3 Jun 2025 09:31:31 +0800 Subject: [PATCH] feat(legacy): implement health check function --- api/legacy/handlers.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 api/legacy/handlers.go diff --git a/api/legacy/handlers.go b/api/legacy/handlers.go new file mode 100644 index 0000000..bbde2af --- /dev/null +++ b/api/legacy/handlers.go @@ -0,0 +1,25 @@ +package legacy + +import ( + "net/http" + "time" + + "hands/config" + "hands/define" + + "github.com/gin-gonic/gin" +) + +// handleHealth 健康检查处理函数 +func (s *LegacyServer) handleHealth(c *gin.Context) { + c.JSON(http.StatusOK, define.ApiResponse{ + Status: "success", + Message: "CAN Control Service is running", + Data: map[string]any{ + "timestamp": time.Now(), + "availableInterfaces": config.Config.AvailableInterfaces, + "defaultInterface": config.Config.DefaultInterface, + "serviceVersion": "1.0.0-hand-type-support", + }, + }) +}