Files
video/app/lib/models/watch_result.dart
2026-10-15 20:36:59 +08:00

31 lines
1002 B
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// 观看上报(计费)响应模型(《03-接口文档》5.3)
class WatchResult {
WatchResult({
required this.costType,
required this.costPoints,
required this.remainingPoints,
required this.freeRemainingToday,
});
/// 计费类型:0 占用免费额度 / 1 积分扣减 / 2 会员免费 / 3 重复观看或本人作品
final int costType;
/// 本次扣除积分(cost_type=1 时为 1,其余为 0)
final int costPoints;
/// 当前剩余积分
final int remainingPoints;
/// 今日免费观看剩余次数
final int freeRemainingToday;
bool get isPointsCost => costType == 1;
factory WatchResult.fromJson(Map<String, dynamic> json) => WatchResult(
costType: (json['cost_type'] as num?)?.toInt() ?? 0,
costPoints: (json['cost_points'] as num?)?.toInt() ?? 0,
remainingPoints: (json['remaining_points'] as num?)?.toInt() ?? 0,
freeRemainingToday: (json['free_remaining_today'] as num?)?.toInt() ?? 0,
);
}