feat: complete login

This commit is contained in:
yanghao05
2025-04-15 21:20:04 +08:00
parent 45a0b6848a
commit ca08568e1a
23 changed files with 842 additions and 28 deletions

View File

@@ -9,11 +9,13 @@ import (
_ "go.ipao.vip/atom/contracts"
. "go.ipao.vip/atom/fen"
"quyun/app/requests"
"quyun/database/schemas/public/model"
)
// @provider contracts.HttpRoute atom.GroupRoutes
type Routes struct {
log *log.Entry `inject:"false"`
auth *auth
pays *pays
posts *posts
}
@@ -28,6 +30,19 @@ func (r *Routes) Name() string {
}
func (r *Routes) Register(router fiber.Router) {
// 注册路由组: auth
router.Get("/auth/login", Func3(
r.auth.Login,
QueryParam[string]("code"),
QueryParam[string]("state"),
QueryParam[string]("redirect"),
))
router.Get("/auth/wechat", Func1(
r.auth.Wechat,
QueryParam[string]("redirect"),
))
// 注册路由组: pays
router.Get("/pay/callback/:channel", Func1(
r.pays.Callback,
@@ -35,10 +50,11 @@ func (r *Routes) Register(router fiber.Router) {
))
// 注册路由组: posts
router.Get("/posts", DataFunc2(
router.Get("/posts", DataFunc3(
r.posts.List,
Query[requests.Pagination]("pagination"),
Query[ListQuery]("query"),
Local[*model.Users]("user"),
))
router.Get("/show/:id", DataFunc1(