114 lines
3.6 KiB
Dart
114 lines
3.6 KiB
Dart
|
|
|
|
import 'package:novyronst/common/model/ny_drama_model.dart';
|
|
import 'package:novyronst/common/model/ny_episode_model.dart';
|
|
import 'package:novyronst/common/model/parse_model.dart';
|
|
|
|
class NyDetailModel {
|
|
final NyDramaModel? videoInfo;
|
|
final NyDramaModel? shortPlayInfo;
|
|
final List<NyEpisodeModel> episodeList;
|
|
final String? businessModel;
|
|
bool? isCollect;
|
|
final bool? showShareCoin;
|
|
final int? shareCoin;
|
|
final int? revolution;
|
|
final String? userLevel;
|
|
final int? jumpType;
|
|
final int? jumpShortPlayId;
|
|
final List<int>? checkPoint;
|
|
|
|
NyDetailModel({
|
|
required this.videoInfo,
|
|
this.shortPlayInfo,
|
|
required this.episodeList,
|
|
this.businessModel,
|
|
this.isCollect,
|
|
this.showShareCoin,
|
|
this.shareCoin,
|
|
this.revolution,
|
|
this.userLevel,
|
|
this.jumpType,
|
|
this.jumpShortPlayId,
|
|
this.checkPoint,
|
|
});
|
|
|
|
factory NyDetailModel.fromJson(Map<String, dynamic> json) {
|
|
return NyDetailModel(
|
|
videoInfo: parseMap(json['video_info']) == null
|
|
? null
|
|
: NyDramaModel.fromJson(parseMap(json['video_info'])!),
|
|
shortPlayInfo: parseMap(json['shortPlayInfo']) == null
|
|
? null
|
|
: NyDramaModel.fromJson(parseMap(json['shortPlayInfo'])!),
|
|
episodeList: parseModelList(json['episodeList'], NyEpisodeModel.fromJson),
|
|
businessModel: json['business_model'] as String?,
|
|
isCollect: json['is_collect'] == null
|
|
? null
|
|
: parseBool(json['is_collect']),
|
|
showShareCoin: json['show_share_coin'] == null
|
|
? null
|
|
: parseBool(json['show_share_coin']),
|
|
shareCoin: json['share_coin'] == null
|
|
? null
|
|
: parseInt(json['share_coin']),
|
|
revolution: json['revolution'] == null
|
|
? null
|
|
: parseInt(json['revolution']),
|
|
userLevel: json['user_level'] as String?,
|
|
jumpType: json['jump_type'] == null ? null : parseInt(json['jump_type']),
|
|
jumpShortPlayId: json['jump_short_play_id'] == null
|
|
? null
|
|
: parseInt(json['jump_short_play_id']),
|
|
checkPoint: parseIntList(json['check_point']),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'video_info': videoInfo?.toJson(),
|
|
'shortPlayInfo': shortPlayInfo?.toJson(),
|
|
'episodeList': episodeList.map((item) => item.toJson()).toList(),
|
|
'business_model': businessModel,
|
|
'is_collect': isCollect,
|
|
'show_share_coin': showShareCoin,
|
|
'share_coin': shareCoin,
|
|
'revolution': revolution,
|
|
'user_level': userLevel,
|
|
'jump_type': jumpType,
|
|
'jump_short_play_id': jumpShortPlayId,
|
|
'check_point': checkPoint,
|
|
};
|
|
}
|
|
|
|
NyDetailModel copyWith({
|
|
NyDramaModel? videoInfo,
|
|
NyDramaModel? shortPlayInfo,
|
|
List<NyEpisodeModel>? episodeList,
|
|
String? businessModel,
|
|
bool? isCollect,
|
|
bool? showShareCoin,
|
|
int? shareCoin,
|
|
int? revolution,
|
|
String? userLevel,
|
|
int? jumpType,
|
|
int? jumpShortPlayId,
|
|
List<int>? checkPoint,
|
|
}) {
|
|
return NyDetailModel(
|
|
videoInfo: videoInfo ?? this.videoInfo,
|
|
shortPlayInfo: shortPlayInfo ?? this.shortPlayInfo,
|
|
episodeList: episodeList ?? this.episodeList,
|
|
businessModel: businessModel ?? this.businessModel,
|
|
isCollect: isCollect ?? this.isCollect,
|
|
showShareCoin: showShareCoin ?? this.showShareCoin,
|
|
shareCoin: shareCoin ?? this.shareCoin,
|
|
revolution: revolution ?? this.revolution,
|
|
userLevel: userLevel ?? this.userLevel,
|
|
jumpType: jumpType ?? this.jumpType,
|
|
jumpShortPlayId: jumpShortPlayId ?? this.jumpShortPlayId,
|
|
checkPoint: checkPoint ?? this.checkPoint,
|
|
);
|
|
}
|
|
}
|