Merge remote-tracking branch 'origin/dev未优化' into dev未优化
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user