31 lines
1002 B
Dart
31 lines
1002 B
Dart
/// 观看上报(计费)响应模型(《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,
|
||
);
|
||
}
|