
- 将mycourse从管理员认证组移至前台用户组 - 为mycourse接口添加前台用户JWT认证中间件 - 确保接口需要用户登录才能访问 - 路径保持 /api/mycourse/list 不变
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
// Package router
|
|
// @Link https://github.com/bufanyun/hotgo
|
|
// @Copyright Copyright (c) 2023 HotGo CLI
|
|
// @Author Ms <133814250@qq.com>
|
|
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
|
package router
|
|
|
|
import (
|
|
"context"
|
|
"hotgo/internal/consts"
|
|
"hotgo/internal/controller/api/activity"
|
|
"hotgo/internal/controller/api/lesson"
|
|
"hotgo/internal/controller/api/member"
|
|
"hotgo/internal/controller/api/mycourse"
|
|
"hotgo/internal/controller/api/pay"
|
|
"hotgo/internal/controller/api/users"
|
|
"hotgo/internal/service"
|
|
"hotgo/utility/simple"
|
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
)
|
|
|
|
// Api 前台路由
|
|
func Api(ctx context.Context, group *ghttp.RouterGroup) {
|
|
group.Group(simple.RouterPrefix(ctx, consts.AppApi), func(group *ghttp.RouterGroup) {
|
|
group.Bind(
|
|
pay.NewV1(), // 支付异步通知
|
|
)
|
|
group.Middleware(service.Middleware().ApiAuth)
|
|
group.Bind(
|
|
member.NewV1(), // 管理员
|
|
)
|
|
})
|
|
|
|
group.Group(simple.RouterPrefix(ctx, consts.AppApi), func(group *ghttp.RouterGroup) {
|
|
group.Bind(
|
|
users.NewV1(), // 前台用户
|
|
lesson.NewV1(), // 课程
|
|
activity.NewV1(), // 活动
|
|
)
|
|
group.Middleware(service.Middleware().ApiAuth)
|
|
group.Bind(
|
|
mycourse.NewV1(), // 我的课程(需要用户认证)
|
|
)
|
|
})
|
|
}
|