hotgo/server/internal/router/api.go

32 lines
831 B
Go
Raw Normal View History

2022-11-24 23:37:34 +08:00
// Package router
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
2022-11-24 23:37:34 +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"
"hotgo/internal/controller/api/member"
"hotgo/internal/controller/api/pay"
2022-11-24 23:37:34 +08:00
"hotgo/internal/controller/api/user"
"hotgo/internal/service"
)
// Api 前台路由
func Api(ctx context.Context, group *ghttp.RouterGroup) {
prefix := g.Cfg().MustGet(ctx, "router.api.prefix", "/api")
group.Group(prefix.String(), func(group *ghttp.RouterGroup) {
2022-11-24 23:37:34 +08:00
group.Bind(
user.Hello,
pay.Notify, // 支付异步通知
)
group.Middleware(service.Middleware().ApiAuth)
group.Bind(
2022-11-24 23:37:34 +08:00
member.Member, // 管理员
)
})
}