统一应用路由前缀规则

This commit is contained in:
孟帅
2023-06-12 17:49:29 +08:00
parent d9d257a067
commit e6abfbcacf
7 changed files with 21 additions and 16 deletions

View File

@@ -7,10 +7,11 @@ package router
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
api "hotgo/api/home/base"
"hotgo/internal/consts"
"hotgo/internal/controller/home/base"
"hotgo/utility/simple"
)
// Home 前台页面路由
@@ -20,8 +21,7 @@ func Home(ctx context.Context, group *ghttp.RouterGroup) {
_, _ = base.Site.Index(r.Context(), &api.SiteIndexReq{})
})
prefix := g.Cfg().MustGet(ctx, "router.home.prefix", "/home")
group.Group(prefix.String(), func(group *ghttp.RouterGroup) {
group.Group(simple.RouterPrefix(ctx, consts.AppHome), func(group *ghttp.RouterGroup) {
group.Bind(
base.Site, // 基础
)