This commit is contained in:
toom1996
2026-08-26 19:40:16 +08:00
parent 30c9f21da4
commit a6724265ad
14 changed files with 400 additions and 101 deletions

View File

@ -36,7 +36,7 @@ func New(opt Options) *gin.Engine {
// 前端用 toAbs() 拼上 base 后直接访问,因此这里必须对外提供静态文件。
r.Static(opt.Config.Upload.URLPrefix, opt.Config.Upload.Dir)
api := r.Group("/api")
api := r.Group("/api/v1")
{
// 健康检查,供容器 / 反向代理探活
api.GET("/health", opt.Health.Check)
@ -52,10 +52,9 @@ func New(opt Options) *gin.Engine {
// 账号体系:注册 / 登录 / 登出 / 当前用户(JWT 无状态)
auth := api.Group("/auth")
{
auth.POST("/register", opt.Auth.Register)
auth.POST("/login", opt.Auth.Login)
auth.POST("/logout", opt.Auth.Logout)
auth.GET("/me", middleware.Auth(opt.JWT), opt.Auth.Me)
auth.POST("/register", opt.Auth.Register)
auth.POST("/login", opt.Auth.Login)
auth.GET("/me", middleware.Auth(opt.JWT), opt.Auth.Me)
}
}

View File

@ -27,11 +27,10 @@ func NewSSG(opt Options) *gin.Engine {
r.Use(ssgLogger())
r.Use(middleware.SSGToken(opt.Config.Server.SSGToken))
ssg := r.Group("/api/ssg")
ssg := r.Group("/api/v1/ssg")
{
ssg.GET("/brands", opt.SSG.Brands) // 品牌索引页全量数据(A-Z)
ssg.GET("/brands/popular", opt.SSG.Popular) // 首页热门品牌区块
ssg.GET("/articles/ids", opt.SSG.ArticleIDs) // 文章详情页路径枚举(getStaticPaths)
ssg.GET("/brands/hot", opt.SSG.HotBrands) // 走秀页热门品牌(前 30,热度顺序)
ssg.GET("/index/runway", opt.SSG.IndexRunway) // 首页(/index/)runway 区块:多模块,当前含 hotBrand
}
return r