feat: implement dynamic changelog loading from API
- 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
This commit is contained in:
26
server/handler/changelog.go
Normal file
26
server/handler/changelog.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user