This commit is contained in:
李志强 2026-04-09 18:21:51 +08:00
parent 3d1a1c9711
commit 5596f9da22

View File

@ -3,8 +3,9 @@ package controllers
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"strconv"
"io"
"strings"
"time"
@ -40,8 +41,8 @@ func (c *QiniuUploadController) platformClaims() (*jwtutil.Claims, error) {
// effectiveTid 获取有效的租户 ID
func (c *QiniuUploadController) effectiveTid(claims *jwtutil.Claims) uint64 {
if claims.TenantID != nil && *claims.TenantID > 0 {
return *claims.TenantID
if claims.TenantId != nil && *claims.TenantId > 0 {
return *claims.TenantId
}
return 0
}
@ -61,7 +62,11 @@ func (c *QiniuUploadController) jsonOK(data interface{}) {
// ParseJSON 解析 JSON 请求体
func (c *QiniuUploadController) ParseJSON(v interface{}) error {
return c.Ctx.Input.Bind(v)
body := c.Ctx.Input.RequestBody
if len(body) == 0 {
return fmt.Errorf("请求体为空")
}
return json.Unmarshal(body, v)
}
// GetUploadToken 获取上传凭证