- Add GET /api/changelog endpoint to fetch changelog from CHANGELOG.md - Create service/changelog.go to parse CHANGELOG.md markdown file - Add handler/changelog.go to handle changelog requests - Update ChangelogDrawer component to fetch from API instead of hardcoded data - Export apiFetch from lib/api.ts for public use - Add changelog parser tests with 14 version entries verified
27 lines
475 B
Go
27 lines
475 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"billai-server/service"
|
|
)
|
|
|
|
// GetChangelog GET /api/changelog 获取版本变更日志
|
|
func GetChangelog(c *gin.Context) {
|
|
changelog, err := service.ParseChangelog()
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{
|
|
"result": false,
|
|
"message": "获取变更日志失败: " + err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"result": true,
|
|
"data": changelog,
|
|
})
|
|
}
|