package video import ( "context" dto "media/model/dto/video" service "media/service/video" "github.com/gogf/gf/v2/frame/g" ) // GetDuration 获取视频时长 POST /video/duration // 方法挂载在 video struct 上,利用 Concat 已注册的 `/video` 组前缀 func (c *video) GetDuration(ctx context.Context, req *dto.VideoDurationReq) (res *dto.VideoDurationRes, err error) { ctx = withUser(ctx) g.Log().Infof(ctx, "[视频时长] 收到请求: video_urls=%v", req.VideoURLs) res, err = service.VideoDuration.GetVideoDurations(ctx, req.VideoURLs) if err != nil { g.Log().Errorf(ctx, "[视频时长] 获取失败: %v", err) return nil, err } g.Log().Infof(ctx, "[视频时长] 响应: count=%d, total=%s", res.Count, res.TotalDurationStr) return res, nil }