注册/登录签发 JWT(bcrypt 校验),孩子档案增改查带归属校验, 列表汇总完美关卡数并派生成长等级。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
31 lines
722 B
Go
31 lines
722 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
|
|
"36wisdom/common/auth"
|
|
)
|
|
|
|
// Register 注册全部路由分组;各业务控制器在对应任务中挂载。
|
|
func Register(s *ghttp.Server) {
|
|
s.Use(ghttp.MiddlewareHandlerResponse)
|
|
|
|
s.BindHandler("GET:/ping", func(r *ghttp.Request) {
|
|
r.Response.Write("pong")
|
|
})
|
|
|
|
secret := g.Cfg().MustGet(gctx.New(), "auth.secret").String()
|
|
|
|
// 前台:公开接口(注册/登录),鉴权接口按模块挂载
|
|
s.Group("/api", func(g *ghttp.RouterGroup) {
|
|
g.Bind(Parent)
|
|
|
|
g.Group("/", func(g *ghttp.RouterGroup) {
|
|
g.Middleware(auth.Middleware(secret, ""))
|
|
g.Bind(Child)
|
|
})
|
|
})
|
|
}
|