opt models

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-04 15:20:35 +08:00
parent f50b1d2beb
commit b960359a39
858 changed files with 11000 additions and 12588 deletions

View File

@@ -0,0 +1,33 @@
import 'package:PiliPlus/models_new/live/live_feed_index/card_data_item.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart';
class CardData {
CardDataItem? bannerV2;
CardDataItem? myIdolV1;
CardDataItem? areaEntranceV3;
CardLiveItem? smallCardV1;
CardData({
this.bannerV2,
this.myIdolV1,
this.areaEntranceV3,
this.smallCardV1,
});
factory CardData.fromJson(Map<String, dynamic> json) => CardData(
bannerV2: json['banner_v2'] == null
? null
: CardDataItem.fromJson(json['banner_v2'] as Map<String, dynamic>),
myIdolV1: json['my_idol_v1'] == null
? null
: CardDataItem.fromJson(json['my_idol_v1'] as Map<String, dynamic>),
areaEntranceV3: json['area_entrance_v3'] == null
? null
: CardDataItem.fromJson(
json['area_entrance_v3'] as Map<String, dynamic>),
smallCardV1: json['small_card_v1'] == null
? null
: CardLiveItem.fromJson(
json['small_card_v1'] as Map<String, dynamic>),
);
}

View File

@@ -0,0 +1,37 @@
import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/module_info.dart';
class CardDataItem {
ModuleInfo? moduleInfo;
List<CardLiveItem>? list;
dynamic topView;
ExtraInfo? extraInfo;
CardDataItem({
this.moduleInfo,
this.list,
this.topView,
this.extraInfo,
});
factory CardDataItem.fromJson(Map<String, dynamic> json) => CardDataItem(
moduleInfo: json['module_info'] == null
? null
: ModuleInfo.fromJson(json['module_info'] as Map<String, dynamic>),
list: (json['list'] as List<dynamic>?)
?.map((e) => CardLiveItem.fromJson(e as Map<String, dynamic>))
.toList(),
topView: json['top_view'] as dynamic,
extraInfo: json['extra_info'] == null
? null
: ExtraInfo.fromJson(json['extra_info'] as Map<String, dynamic>),
);
}
class ExtraInfo {
int? totalCount;
ExtraInfo.fromJson(Map<String, dynamic> json) {
totalCount = json['total_count'];
}
}

View File

@@ -0,0 +1,76 @@
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
class CardLiveItem {
int? roomid;
int? uid;
String? uname;
String? face;
String? cover;
String? title;
int? area;
int? liveTime;
String? areaName;
int? areaV2Id;
String? areaV2Name;
String? areaV2ParentName;
int? areaV2ParentId;
String? liveTagName;
int? online;
String? link;
int? officialVerify;
int? currentQn;
WatchedShow? watchedShow;
String? statusText;
int? tagType;
CardLiveItem({
this.roomid,
this.uid,
this.uname,
this.face,
this.cover,
this.title,
this.area,
this.liveTime,
this.areaName,
this.areaV2Id,
this.areaV2Name,
this.areaV2ParentName,
this.areaV2ParentId,
this.liveTagName,
this.online,
this.link,
this.officialVerify,
this.currentQn,
this.watchedShow,
this.statusText,
this.tagType,
});
factory CardLiveItem.fromJson(Map<String, dynamic> json) => CardLiveItem(
roomid: json['roomid'] ?? json['id'],
uid: json['uid'] as int?,
uname: json['uname'] as String?,
face: json['face'] as String?,
cover: json['cover'] as String?,
title: json['title'] as String?,
area: json['area'] as int?,
liveTime: json['live_time'] as int?,
areaName: json['area_name'] as String?,
areaV2Id: json['area_v2_id'] as int?,
areaV2Name: json['area_v2_name'] as String?,
areaV2ParentName: json['area_v2_parent_name'] as String?,
areaV2ParentId: json['area_v2_parent_id'] as int?,
liveTagName: json['live_tag_name'] as String?,
online: json['online'] as int?,
link: json['link'] as String?,
officialVerify: json['official_verify'] as int?,
currentQn: json['current_qn'] as int?,
watchedShow: json['watched_show'] == null
? null
: WatchedShow.fromJson(
json['watched_show'] as Map<String, dynamic>),
statusText: json['status_text'] as String?,
tagType: json['tag_type'],
);
}

View File

@@ -0,0 +1,15 @@
import 'package:PiliPlus/models_new/live/live_feed_index/card_data.dart';
class LiveCardList {
String? cardType;
CardData? cardData;
LiveCardList({this.cardType, this.cardData});
factory LiveCardList.fromJson(Map<String, dynamic> json) => LiveCardList(
cardType: json['card_type'] as String?,
cardData: json['card_data'] == null
? null
: CardData.fromJson(json['card_data'] as Map<String, dynamic>),
);
}

View File

@@ -0,0 +1,46 @@
import 'package:PiliPlus/models_new/live/live_feed_index/card_list.dart';
class LiveIndexData {
List<LiveCardList>? cardList;
int? isRollback;
int? hasMore;
int? triggerTime;
int? isNeedRefresh;
LiveCardList? followItem;
LiveCardList? areaItem;
LiveIndexData({
this.cardList,
this.isRollback,
this.hasMore,
this.triggerTime,
this.isNeedRefresh,
});
LiveIndexData.fromJson(Map<String, dynamic> json) {
if ((json['card_list'] as List<dynamic>?)?.isNotEmpty == true) {
// banner_v2
// my_idol_v1
// area_entrance_v3
// small_card_v1
for (var json in json['card_list']) {
switch (json['card_type']) {
case 'my_idol_v1':
followItem = LiveCardList.fromJson(json);
break;
case 'area_entrance_v3':
areaItem = LiveCardList.fromJson(json);
break;
case 'small_card_v1':
cardList ??= <LiveCardList>[];
cardList!.add(LiveCardList.fromJson(json));
break;
}
}
}
isRollback = json['is_rollback'] as int?;
hasMore = json['has_more'] as int?;
triggerTime = json['trigger_time'] as int?;
isNeedRefresh = json['is_need_refresh'] as int?;
}
}

View File

@@ -0,0 +1,19 @@
import 'package:PiliPlus/models_new/live/live_feed_index/data.dart';
class LiveFeedIndex {
int? code;
String? message;
int? ttl;
LiveIndexData? data;
LiveFeedIndex({this.code, this.message, this.ttl, this.data});
factory LiveFeedIndex.fromJson(Map<String, dynamic> json) => LiveFeedIndex(
code: json['code'] as int?,
message: json['message'] as String?,
ttl: json['ttl'] as int?,
data: json['data'] == null
? null
: LiveIndexData.fromJson(json['data'] as Map<String, dynamic>),
);
}

View File

@@ -0,0 +1,29 @@
class ModuleInfo {
int? id;
String? link;
String? pic;
String? title;
int? type;
int? sort;
int? count;
ModuleInfo({
this.id,
this.link,
this.pic,
this.title,
this.type,
this.sort,
this.count,
});
factory ModuleInfo.fromJson(Map<String, dynamic> json) => ModuleInfo(
id: json['id'] as int?,
link: json['link'] as String?,
pic: json['pic'] as String?,
title: json['title'] as String?,
type: json['type'] as int?,
sort: json['sort'] as int?,
count: json['count'] as int?,
);
}

View File

@@ -0,0 +1,14 @@
class WatchedShow {
String? textSmall;
String? textLarge;
WatchedShow({
this.textSmall,
this.textLarge,
});
factory WatchedShow.fromJson(Map<String, dynamic> json) => WatchedShow(
textSmall: json['text_small'] as String?,
textLarge: json['text_large'] as String?,
);
}