feat(auth): 重构认证模块,添加登录和检查Token功能,更新路由和数据结构

This commit is contained in:
2025-12-30 18:12:22 +08:00
parent 6d7f4ad1c6
commit 179b6aa0e2
8 changed files with 136 additions and 22 deletions

View File

@@ -0,0 +1,39 @@
package auth
import (
dto "quyun/v2/app/http/super/v1/dto"
"quyun/v2/app/services"
"github.com/gofiber/fiber/v3"
)
// @provider
type auth struct{}
// Login
//
// @Router /super/v1/auth/login [post]
// @Summary Login
// @Description Login
// @Tags Auth
// @Accept json
// @Produce json
// @Param form body dto.LoginForm true "Login form"
// @Success 200 {object} dto.LoginResponse
// @Bind form body
func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
return services.Super.Login(ctx.Context(), form)
}
// Check Token
//
// @Router /super/v1/auth/token [get]
// @Summary Check token
// @Description Check token
// @Tags Auth
// @Accept json
// @Produce json
// @Success 200 {object} dto.LoginResponse
func (c *auth) CheckToken(ctx fiber.Ctx) (*dto.LoginResponse, error) {
return services.Super.CheckToken(ctx.Context())
}