优化home模块页面错误处理

This commit is contained in:
孟帅
2023-06-15 20:40:19 +08:00
parent 5abfeb5485
commit 2d0d7e5604
14 changed files with 509 additions and 397 deletions

View File

@@ -8,19 +8,25 @@ package router
import (
"context"
"github.com/gogf/gf/v2/net/ghttp"
api "hotgo/api/home/base"
"hotgo/internal/consts"
"hotgo/internal/controller/home/base"
"hotgo/internal/service"
"hotgo/utility/simple"
)
// Home 前台页面路由
func Home(ctx context.Context, group *ghttp.RouterGroup) {
// 注册首页路由
group.ALL("/", func(r *ghttp.Request) {
_, _ = base.Site.Index(r.Context(), &api.SiteIndexReq{})
group.Middleware(service.Middleware().HomeAuth)
// 允许通过根地址访问的路由可以同时加到这里
// 访问地址http://127.0.0.1:8000
group.Group("/", func(group *ghttp.RouterGroup) {
group.Bind(
base.Site, // 基础
)
})
// 默认访问地址http://127.0.0.1:8000/home
group.Group(simple.RouterPrefix(ctx, consts.AppHome), func(group *ghttp.RouterGroup) {
group.Bind(
base.Site, // 基础