diff --git a/common/util/billing.go b/common/util/billing.go index baf6975..485f5ce 100644 --- a/common/util/billing.go +++ b/common/util/billing.go @@ -148,7 +148,7 @@ func ExtractRequestBilling(ctx context.Context, config map[string]any, requestPa if len(urls) > 0 { resp, err := gateway.GetVideoDuration(ctx, urls) if err == nil { - data[targetField] = resp.Data.TotalDuration + data[targetField] = resp.TotalDuration } } } diff --git a/service/gateway/gateway_http_service.go b/service/gateway/gateway_http_service.go index 3831b2c..0600dd3 100644 --- a/service/gateway/gateway_http_service.go +++ b/service/gateway/gateway_http_service.go @@ -182,14 +182,10 @@ func IsSuperAdmin(ctx context.Context) (res bool, err error) { // VideoDurationResp 视频时长接口返回 type VideoDurationResp struct { - Code int `json:"code"` - Message string `json:"message"` - Data struct { - Videos []VideoInfo `json:"videos"` - Count int `json:"count"` - TotalDuration float64 `json:"totalDuration"` // 秒 - TotalDurationStr string `json:"totalDurationStr"` - } `json:"data"` + Videos []VideoInfo `json:"videos"` + Count int `json:"count"` + TotalDuration float64 `json:"totalDuration"` + TotalDurationStr string `json:"totalDurationStr"` } type VideoInfo struct { @@ -201,7 +197,7 @@ type VideoInfo struct { // GetVideoDuration 获取视频时长 func GetVideoDuration(ctx context.Context, urls []string) (VideoDurationResp, error) { - apiURL := "medi/video/duration" + apiURL := "media/video/duration" headers := make(map[string]string) if r := g.RequestFromCtx(ctx); r != nil { for k, v := range r.Request.Header { @@ -221,7 +217,7 @@ func GetVideoDuration(ctx context.Context, urls []string) (VideoDurationResp, er return resp, err } - g.Log().Infof(ctx, "[视频时长] 获取成功 count=%d totalDuration=%.2f", resp.Data.Count, resp.Data.TotalDuration) + g.Log().Infof(ctx, "[视频时长] 获取成功 count=%d totalDuration=%.2f", resp.Count, resp.TotalDuration) return resp, nil }