2022-12-15 16:12:08 +08:00
|
|
|
// Package router
|
|
|
|
// @Link https://github.com/bufanyun/hotgo
|
2023-02-23 17:53:04 +08:00
|
|
|
// @Copyright Copyright (c) 2023 HotGo CLI
|
2022-12-15 16:12:08 +08:00
|
|
|
// @Author Ms <133814250@qq.com>
|
|
|
|
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
|
|
|
//
|
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
2023-01-18 16:23:39 +08:00
|
|
|
api "hotgo/api/home/base"
|
2022-12-15 16:12:08 +08:00
|
|
|
"hotgo/internal/controller/home/base"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Home 前台页面路由
|
|
|
|
func Home(ctx context.Context, group *ghttp.RouterGroup) {
|
2023-01-18 16:23:39 +08:00
|
|
|
// 注册首页路由
|
|
|
|
group.ALL("/", func(r *ghttp.Request) {
|
|
|
|
_, _ = base.Site.Index(r.Context(), &api.SiteIndexReq{})
|
|
|
|
return
|
|
|
|
})
|
2022-12-15 16:12:08 +08:00
|
|
|
|
2023-01-18 16:23:39 +08:00
|
|
|
prefix := g.Cfg().MustGet(ctx, "router.home.prefix", "/home")
|
|
|
|
group.Group(prefix.String(), func(group *ghttp.RouterGroup) {
|
2022-12-15 16:12:08 +08:00
|
|
|
group.Bind(
|
|
|
|
base.Site, // 基础
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|