fix(points): 视频生成积分计算使用 actualDuration
预估积分计算优先使用 actualDuration(配音合成后的实际时长), 不再依赖脚本的 duration 预估字段,确保显示值与实际扣费一致。
This commit is contained in:
@@ -58,9 +58,14 @@ export default function VideoGeneration() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 视频生成预计积分(秒数向上取整 × multiplier 积分/秒,空镜+分镜都计)
|
||||
// 视频生成积分(秒数向上取整 × multiplier 积分/秒,优先用 actualDuration)
|
||||
const estimatedVideoPoints = useMemo(() => {
|
||||
const totalDur = shots.reduce((sum, shot) => {
|
||||
// 优先使用实际时长(配音合成后已更新)
|
||||
if (shot.actualDuration && shot.actualDuration > 0) {
|
||||
return sum + shot.actualDuration;
|
||||
}
|
||||
// 回退到脚本的预估时长
|
||||
const durStr = typeof shot.duration === 'string' ? shot.duration : '5s';
|
||||
return sum + parseFloat(durStr.replace(/[^0-9.]/g, '') || '0');
|
||||
}, 0);
|
||||
|
||||
Reference in New Issue
Block a user