feat: done
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user