feat: add charge

This commit is contained in:
Rogee
2024-12-12 17:59:30 +08:00
parent 1bc12248aa
commit 259b334711
11 changed files with 143 additions and 14 deletions

View File

@@ -33,3 +33,19 @@ func (c *Controller) Charge(ctx fiber.Ctx) error {
return ctx.JSON(nil)
}
// Info
func (c *Controller) Info(ctx fiber.Ctx) error {
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
log.Debug(claim)
info := &UserInfo{}
balance, err := c.svc.GetTenantUserBalance(ctx.Context(), claim.TenantID, claim.UserID)
if err != nil {
return err
}
info.Balance = balance
return ctx.JSON(info)
}