package handler import ( "net/http" "nex/backend/pkg/buildinfo" "github.com/gin-gonic/gin" ) // VersionHandler 提供后端构建版本信息。 type VersionHandler struct{} // NewVersionHandler 创建版本信息处理器。 func NewVersionHandler() *VersionHandler { return &VersionHandler{} } // GetVersion 返回构建注入的版本元数据。 func (h *VersionHandler) GetVersion(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "version": buildinfo.Version(), "commit": buildinfo.Commit(), "build_time": buildinfo.BuildTime(), }) }