- 在扫描页面添加目录输入框和选择按钮 - 实现文件系统浏览器,支持Windows盘符和目录浏览 - 添加扫描目录参数传递到后端服务 - 显示当前扫描目录路径信息 - 修复前端空数组访问错误 - 更新文档说明扫描功能变化
37 lines
772 B
Go
37 lines
772 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"kenaito-media-picker/internal/service"
|
|
"kenaito-media-picker/internal/store"
|
|
)
|
|
|
|
// NewRouter 组装 Gin 路由:健康检查 + API 路由组
|
|
func NewRouter(st *store.Store) *gin.Engine {
|
|
r := gin.New()
|
|
r.Use(gin.Recovery())
|
|
|
|
// 健康检查
|
|
r.GET("/health/check", func(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
|
})
|
|
|
|
apiGroup := r.Group("/api")
|
|
{
|
|
mc := NewMediaController(st)
|
|
apiGroup.POST("/media/list", mc.List)
|
|
apiGroup.POST("/media/stats", mc.Stats)
|
|
|
|
sc := NewScanController(service.NewScanService(st))
|
|
apiGroup.POST("/scan/start", sc.Start)
|
|
apiGroup.GET("/scan/status", sc.Status)
|
|
|
|
fc := NewFsController()
|
|
apiGroup.GET("/fs/list", fc.List)
|
|
}
|
|
return r
|
|
}
|