fix: issues
This commit is contained in:
@@ -26,6 +26,9 @@ func (c *Controller) List(ctx fiber.Ctx) error {
|
||||
func (c *Controller) Charge(ctx fiber.Ctx) error {
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
// [tenantId, chargeAmount, timestamp]
|
||||
code := ctx.Params("code")
|
||||
@@ -41,6 +44,10 @@ func (c *Controller) Info(ctx fiber.Ctx) error {
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
info := &UserInfo{}
|
||||
|
||||
balance, err := c.svc.GetTenantUserBalance(ctx.Context(), claim.TenantID, claim.UserID)
|
||||
@@ -62,6 +69,9 @@ func (c *Controller) Info(ctx fiber.Ctx) error {
|
||||
func (c *Controller) GetChargeCodes(ctx fiber.Ctx) error {
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
tenant, err := c.svc.GetTenantByID(ctx.Context(), claim.TenantID)
|
||||
if err != nil {
|
||||
@@ -98,6 +108,9 @@ func (c *Controller) GetChargeCodes(ctx fiber.Ctx) error {
|
||||
func (c *Controller) BalanceHistory(ctx fiber.Ctx) error {
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
histories, err := c.svc.GetBalanceHistory(ctx.Context(), claim.TenantID, claim.UserID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user