初始化
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
import '../actress_info.dart';
|
||||
import '../cartoon_media_info.dart';
|
||||
import '../splash/ads_model.dart';
|
||||
import '../video_model.dart';
|
||||
|
||||
/// 模块详情:一个首页 tab 拉回来的全部内容
|
||||
class ModuleDetailModel {
|
||||
List<AllSection>? allSection; //所有专题
|
||||
List<VideoModel>? allVideoInfo; //所有视频
|
||||
List<ActressInfo>? allActress;
|
||||
List<CartoonMediaInfo>? allMediaInfo;
|
||||
List<VideoModel>? chosenVideoInfo; // 精选视频
|
||||
bool? hasNext;
|
||||
|
||||
//只有热门随机刷新那条路径会手工造一个,只带 allVideoInfo
|
||||
ModuleDetailModel({this.allVideoInfo});
|
||||
|
||||
ModuleDetailModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
chosenVideoInfo = _list(json['chosenVideoInfo'], (e) => VideoModel.fromJson(e));
|
||||
allSection = _list(json['allSection'], (e) => AllSection.fromJson(e));
|
||||
allVideoInfo = _list(json['allVideoInfo'], (e) => VideoModel.fromJson(e));
|
||||
allActress = _list(json['allActress'], (e) => ActressInfo.fromJson(e));
|
||||
allMediaInfo = _list(json['allMediaInfo'], (e) => CartoonMediaInfo.fromJson(e));
|
||||
hasNext = json['hasNext'];
|
||||
}
|
||||
|
||||
//某个字段下发成非数组时只丢这一项,别让整个模块的解析失败
|
||||
static List<T>? _list<T>(dynamic v, T Function(dynamic) fromJson) => v is List ? v.map(fromJson).toList() : null;
|
||||
}
|
||||
|
||||
/// 专题:既是首页楼层,也被 AdManager 拿来当广告占位插进列表
|
||||
class AllSection {
|
||||
String? sectionID;
|
||||
String? sectionName;
|
||||
String? sectionTitle;
|
||||
String? sectionDesc;
|
||||
String? sectionCover;
|
||||
String? desc;
|
||||
|
||||
List<TagsBean>? allTags;
|
||||
List<VideoModel>? allVideoInfo;
|
||||
List<CartoonMediaInfo>? allMediaInfo;
|
||||
List<ActressInfo>? allActress;
|
||||
|
||||
int? linkType;
|
||||
String? linkUrl;
|
||||
|
||||
/// 横版(长视频):101 一大四小 / 102 四宫格 / 103 六宫格 / 104 1.5滑动 / 105 2.5滑动 / 106 横屏列表 / 107 横屏大图
|
||||
/// 竖版(短视频、ACG):201 四宫格 / 202 六宫格 / 203 九宫格 / 204 1.5滑动 / 205 2.5滑动
|
||||
/// 301 猜你喜欢
|
||||
int? showType;
|
||||
int? type;
|
||||
int? voteCount; //大胸投票
|
||||
int? disVoteCount; //贫胸投票
|
||||
int? collCount;
|
||||
int? viewCounts;
|
||||
bool? collected;
|
||||
bool? hasNext;
|
||||
bool? hot;
|
||||
|
||||
///videoModel是否随机广告
|
||||
AdsInfoModel? randomAdsInfo;
|
||||
List<AdsInfoModel>? adsInfoArr;
|
||||
|
||||
bool get isGuessLike => showType == 301; // 猜你喜欢
|
||||
|
||||
bool isRandomAd() {
|
||||
return randomAdsInfo != null;
|
||||
}
|
||||
|
||||
bool isAdsArr() {
|
||||
return adsInfoArr != null;
|
||||
}
|
||||
|
||||
AllSection();
|
||||
|
||||
AllSection.fromJson(dynamic json) {
|
||||
allActress = (json['allActress'] as List?)?.map((e) => ActressInfo.fromJson(e)).toList();
|
||||
allVideoInfo = (json['allVideoInfo'] as List?)?.map((e) => VideoModel.fromJson(e)).toList();
|
||||
allMediaInfo = (json['allMediaInfo'] as List?)?.map((e) => CartoonMediaInfo.fromJson(e)).toList();
|
||||
allTags = (json['allTags'] as List?)?.map((e) => TagsBean.fromMap(e)).toList();
|
||||
hot = json['hot'];
|
||||
desc = json['desc'];
|
||||
sectionDesc = json['sectionDesc'];
|
||||
collCount = json['collCount'];
|
||||
viewCounts = json['viewCounts'];
|
||||
linkType = json['linkType'];
|
||||
linkUrl = json['linkUrl'];
|
||||
sectionID = json['sectionID'] ?? json['id'];
|
||||
sectionName = json['sectionName'];
|
||||
showType = json['showType'];
|
||||
type = json['type'];
|
||||
voteCount = json['voteCount'];
|
||||
disVoteCount = json['disVoteCount'];
|
||||
collected = json['collected'];
|
||||
sectionCover = json['sectionCover'];
|
||||
sectionTitle = json['sectionTitle'];
|
||||
hasNext = json['hasNext'];
|
||||
}
|
||||
}
|
||||
|
||||
/// 片库筛选用的标签,会随 Keyword 一起回传给接口
|
||||
class Tags {
|
||||
String? coverImg;
|
||||
String? description;
|
||||
bool? hasCollected;
|
||||
String? id;
|
||||
String? name;
|
||||
int? playCount;
|
||||
|
||||
Tags.fromJson(Map<String, dynamic> json) {
|
||||
coverImg = json['coverImg'];
|
||||
description = json['description'];
|
||||
hasCollected = json['hasCollected'];
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
playCount = json['playCount'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'coverImg': coverImg,
|
||||
'description': description,
|
||||
'hasCollected': hasCollected,
|
||||
'id': id,
|
||||
'name': name,
|
||||
'playCount': playCount,
|
||||
}..removeWhere((key, value) => value == null);
|
||||
}
|
||||
|
||||
/// 福利页的限免专区,只用 id 去拉列表、title 做标题
|
||||
class WareDiscountAreaData {
|
||||
String? id;
|
||||
String? title;
|
||||
|
||||
WareDiscountAreaData.fromJson(Map<String, dynamic> json) {
|
||||
id = json["id"];
|
||||
title = json["title"];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user