feat: done

This commit is contained in:
2025-12-18 00:21:49 +08:00
parent 7261c0fcc3
commit bfce71b56d
15 changed files with 331 additions and 17 deletions

View File

@@ -50,3 +50,22 @@ func (ctl *auth) login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse,
return &dto.LoginResponse{Token: token}, nil
}
// Token
//
// @Tags Super
// @Accept json
// @Produce json
// @Success 200 {object} dto.LoginResponse "成功"
//
// @Router /super/v1/auth/token [get]
func (ctl *auth) token(ctx fiber.Ctx) (*dto.LoginResponse, error) {
token, err := ctl.jwt.CreateToken(ctl.jwt.CreateClaims(jwt.BaseClaims{
UserID: 2,
}))
if err != nil {
return nil, errorx.Wrap(err).WithMsg("登录凭证生成失败")
}
return &dto.LoginResponse{Token: token}, nil
}