mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-29 14:56:29 +08:00
@@ -1,4 +1,4 @@
|
||||
import 'package:PiliPlus/models_new/live/live_contribution_rank/medal_info.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
|
||||
|
||||
class LiveContributionRankItem {
|
||||
int? uid;
|
||||
@@ -6,7 +6,7 @@ class LiveContributionRankItem {
|
||||
String? face;
|
||||
int? rank;
|
||||
int? score;
|
||||
MedalInfo? medalInfo;
|
||||
UinfoMedal? uinfoMedal;
|
||||
|
||||
LiveContributionRankItem({
|
||||
this.uid,
|
||||
@@ -14,7 +14,7 @@ class LiveContributionRankItem {
|
||||
this.face,
|
||||
this.rank,
|
||||
this.score,
|
||||
this.medalInfo,
|
||||
this.uinfoMedal,
|
||||
});
|
||||
|
||||
factory LiveContributionRankItem.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -24,8 +24,8 @@ class LiveContributionRankItem {
|
||||
face: json['face'] as String?,
|
||||
rank: json['rank'] as int?,
|
||||
score: json['score'] as int?,
|
||||
medalInfo: json['medal_info'] == null
|
||||
uinfoMedal: json['uinfo']?['medal'] == null
|
||||
? null
|
||||
: MedalInfo.fromJson(json['medal_info'] as Map<String, dynamic>),
|
||||
: UinfoMedal.fromJson(json['uinfo']?['medal']),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
class MedalInfo {
|
||||
String? medalName;
|
||||
int? level;
|
||||
|
||||
MedalInfo({
|
||||
this.medalName,
|
||||
this.level,
|
||||
});
|
||||
|
||||
factory MedalInfo.fromJson(Map<String, dynamic> json) => MedalInfo(
|
||||
medalName: json['medal_name'] as String?,
|
||||
level: json['level'] as int?,
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_danmaku/live_emote.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
|
||||
import 'package:PiliPlus/pages/danmaku/danmaku_model.dart';
|
||||
|
||||
class DanmakuMsg {
|
||||
@@ -9,6 +10,7 @@ class DanmakuMsg {
|
||||
final BaseEmote? uemote;
|
||||
final Owner? reply;
|
||||
final LiveDanmaku extra;
|
||||
final UinfoMedal? medalInfo;
|
||||
|
||||
const DanmakuMsg({
|
||||
required this.name,
|
||||
@@ -17,6 +19,7 @@ class DanmakuMsg {
|
||||
this.uemote,
|
||||
this.reply,
|
||||
required this.extra,
|
||||
this.medalInfo,
|
||||
});
|
||||
|
||||
factory DanmakuMsg.fromPrefetch(Map<String, dynamic> obj) {
|
||||
@@ -36,6 +39,7 @@ class DanmakuMsg {
|
||||
);
|
||||
}
|
||||
}
|
||||
final medal = user['medal'];
|
||||
return DanmakuMsg(
|
||||
name: user['base']['name'],
|
||||
text: obj['text'],
|
||||
@@ -51,6 +55,7 @@ class DanmakuMsg {
|
||||
ts: checkInfo['ts'],
|
||||
ct: checkInfo['ct'],
|
||||
),
|
||||
medalInfo: medal == null ? null : UinfoMedal.fromJson(medal),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,26 @@
|
||||
class UinfoMedal {
|
||||
String? name;
|
||||
int? level;
|
||||
int? colorBorder;
|
||||
int? color;
|
||||
int? id;
|
||||
int? ruid;
|
||||
String? v2MedalColorStart;
|
||||
String? v2MedalColorEnd;
|
||||
String? v2MedalColorBorder;
|
||||
String? v2MedalColorText;
|
||||
String? v2MedalColorLevel;
|
||||
|
||||
UinfoMedal({
|
||||
this.name,
|
||||
this.level,
|
||||
this.colorBorder,
|
||||
this.color,
|
||||
this.id,
|
||||
this.ruid,
|
||||
this.v2MedalColorStart,
|
||||
this.v2MedalColorEnd,
|
||||
this.v2MedalColorBorder,
|
||||
this.v2MedalColorText,
|
||||
this.v2MedalColorLevel,
|
||||
});
|
||||
|
||||
factory UinfoMedal.fromJson(Map<String, dynamic> json) => UinfoMedal(
|
||||
name: json['name'] as String?,
|
||||
level: json['level'] as int?,
|
||||
colorBorder: json['color_border'] as int?,
|
||||
color: json['color'] as int?,
|
||||
id: json['id'] as int?,
|
||||
ruid: json['ruid'] as int?,
|
||||
v2MedalColorStart: json['v2_medal_color_start'] as String?,
|
||||
v2MedalColorEnd: json['v2_medal_color_end'] as String?,
|
||||
v2MedalColorBorder: json['v2_medal_color_border'] as String?,
|
||||
v2MedalColorText: json['v2_medal_color_text'] as String?,
|
||||
v2MedalColorLevel: json['v2_medal_color_level'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_superchat/user_info.dart';
|
||||
import 'package:PiliPlus/utils/parse_string.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
class SuperChatItem {
|
||||
int id;
|
||||
int uid;
|
||||
int price;
|
||||
String? backgroundImage;
|
||||
String backgroundColor;
|
||||
String backgroundBottomColor;
|
||||
String backgroundPriceColor;
|
||||
@@ -16,11 +19,13 @@ class SuperChatItem {
|
||||
UserInfo userInfo;
|
||||
late bool expired = false;
|
||||
late bool deleted = false;
|
||||
UinfoMedal? medalInfo;
|
||||
|
||||
SuperChatItem({
|
||||
required this.id,
|
||||
required this.uid,
|
||||
required this.price,
|
||||
this.backgroundImage,
|
||||
required this.backgroundColor,
|
||||
required this.backgroundBottomColor,
|
||||
required this.backgroundPriceColor,
|
||||
@@ -30,6 +35,7 @@ class SuperChatItem {
|
||||
required this.token,
|
||||
required this.ts,
|
||||
required this.userInfo,
|
||||
this.medalInfo,
|
||||
});
|
||||
|
||||
static SuperChatItem get random => SuperChatItem.fromJson({
|
||||
@@ -50,6 +56,7 @@ class SuperChatItem {
|
||||
id: Utils.safeToInt(json['id']) ?? Utils.random.nextInt(2147483647),
|
||||
uid: Utils.safeToInt(json['uid'])!,
|
||||
price: json['price'],
|
||||
backgroundImage: noneNullOrEmptyString(json['background_image']),
|
||||
backgroundColor: json['background_color'] ?? '#EDF5FF',
|
||||
backgroundBottomColor: json['background_bottom_color'] ?? '#2A60B2',
|
||||
backgroundPriceColor: json['background_price_color'] ?? '#7497CD',
|
||||
@@ -59,6 +66,9 @@ class SuperChatItem {
|
||||
token: json['token'],
|
||||
ts: Utils.safeToInt(json['ts'])!,
|
||||
userInfo: UserInfo.fromJson(json['user_info'] as Map<String, dynamic>),
|
||||
medalInfo: json['uinfo']?['medal'] == null
|
||||
? null
|
||||
: UinfoMedal.fromJson(json['uinfo']['medal']),
|
||||
);
|
||||
|
||||
SuperChatItem copyWith({
|
||||
@@ -75,6 +85,7 @@ class SuperChatItem {
|
||||
int? ts,
|
||||
UserInfo? userInfo,
|
||||
bool? expired,
|
||||
UinfoMedal? medalInfo,
|
||||
}) {
|
||||
return SuperChatItem(
|
||||
id: id ?? this.id,
|
||||
@@ -90,6 +101,7 @@ class SuperChatItem {
|
||||
token: token ?? this.token,
|
||||
ts: ts ?? this.ts,
|
||||
userInfo: userInfo ?? this.userInfo,
|
||||
medalInfo: medalInfo ?? this.medalInfo,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,6 +109,7 @@ class SuperChatItem {
|
||||
'id': id,
|
||||
'uid': uid,
|
||||
'price': price,
|
||||
'background_image': backgroundImage,
|
||||
'background_color': backgroundColor,
|
||||
'background_bottom_color': backgroundBottomColor,
|
||||
'background_price_color': backgroundPriceColor,
|
||||
|
||||
Reference in New Issue
Block a user