feat(legacy): implement health check function

This commit is contained in:
Eli Yip 2025-06-03 09:31:31 +08:00
parent e04e311ff4
commit cc1de7c776
No known key found for this signature in database
GPG Key ID: C98B69D4CF7D7EC5

25
api/legacy/handlers.go Normal file
View File

@ -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",
},
})
}