This commit is contained in:
hero920103 committed 2026-10-19 01:13:17 +08:00
1 parent 5718a00e31
commit 1850ac640e
226 files changed
+37772 -12071

No files matched your search

+3 -8
View File
@@ -2,7 +2,6 @@ package controllers
import (
"encoding/json"
"errors"
"fmt"
"io"
"path"
@@ -12,6 +11,7 @@ import (
"time"
"server/models"
"server/pkg/identity"
"server/pkg/jwtutil"
"server/services"
approvalEngine "server/services/approval"
@@ -47,13 +47,8 @@ type reimbursementPayload struct {
}
func (c *BackendReimburseController) claims() (*jwtutil.Claims, bool) {
auth := strings.TrimSpace(c.Ctx.Request.Header.Get("Authorization"))
parts := strings.SplitN(auth, " ", 2)
if len(parts) != 2 || parts[0] != "Bearer" {
return nil, false
}
claims, err := jwtutil.ParseToken(parts[1])
if err != nil || claims.UserType != "backend" || claims.TenantId <= 0 || claims.UserID <= 0 {
claims, err := identity.Claims(c.Ctx.Request.Header.Get("Authorization"), identity.EndBackend)
if err != nil || claims.TenantId <= 0 || claims.UserID <= 0 {
return nil, false
}
return claims, true