94 lines
3.4 KiB
Dart
94 lines
3.4 KiB
Dart
// Author: fengshengxiong
|
|
// Date: 2024/8/6
|
|
// Description: 广告配置模型
|
|
|
|
import 'dart:convert';
|
|
|
|
class AdConfigModel {
|
|
List<AdModel>? coldLoading;
|
|
List<AdModel>? hotLoading;
|
|
List<AdModel>? play;
|
|
List<AdModel>? download;
|
|
List<AdModel>? list;
|
|
List<AdModel>? library;
|
|
List<AdModel>? playCut;
|
|
List<AdModel>? search;
|
|
List<AdModel>? searchResult;
|
|
List<AdModel>? backup;
|
|
|
|
AdConfigModel({
|
|
this.coldLoading,
|
|
this.hotLoading,
|
|
this.play,
|
|
this.download,
|
|
this.list,
|
|
this.library,
|
|
this.playCut,
|
|
this.search,
|
|
this.searchResult,
|
|
this.backup,
|
|
});
|
|
|
|
factory AdConfigModel.fromJson(String str) => AdConfigModel.fromMap(json.decode(str));
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory AdConfigModel.fromMap(Map<String, dynamic> json) => AdConfigModel(
|
|
coldLoading: json["coldLoading"] == null ? [] : List<AdModel>.from(json["coldLoading"]!.map((x) => AdModel.fromMap(x))),
|
|
hotLoading: json["hotLoading"] == null ? [] : List<AdModel>.from(json["hotLoading"]!.map((x) => AdModel.fromMap(x))),
|
|
play: json["play"] == null ? [] : List<AdModel>.from(json["play"]!.map((x) => AdModel.fromMap(x))),
|
|
download: json["download"] == null ? [] : List<AdModel>.from(json["download"]!.map((x) => AdModel.fromMap(x))),
|
|
list: json["list"] == null ? [] : List<AdModel>.from(json["list"]!.map((x) => AdModel.fromMap(x))),
|
|
library: json["library"] == null ? [] : List<AdModel>.from(json["library"]!.map((x) => AdModel.fromMap(x))),
|
|
playCut: json["playCut"] == null ? [] : List<AdModel>.from(json["playCut"]!.map((x) => AdModel.fromMap(x))),
|
|
search: json["search"] == null ? [] : List<AdModel>.from(json["search"]!.map((x) => AdModel.fromMap(x))),
|
|
searchResult: json["searchResult"] == null ? [] : List<AdModel>.from(json["searchResult"]!.map((x) => AdModel.fromMap(x))),
|
|
backup: json["backup"] == null ? [] : List<AdModel>.from(json["backup"]!.map((x) => AdModel.fromMap(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
"coldLoading": coldLoading == null ? [] : List<dynamic>.from(coldLoading!.map((x) => x.toMap())),
|
|
"hotLoading": hotLoading == null ? [] : List<dynamic>.from(hotLoading!.map((x) => x.toMap())),
|
|
"play": play == null ? [] : List<dynamic>.from(play!.map((x) => x.toMap())),
|
|
"download": download == null ? [] : List<dynamic>.from(download!.map((x) => x.toMap())),
|
|
"list": list == null ? [] : List<dynamic>.from(list!.map((x) => x.toMap())),
|
|
"library": library == null ? [] : List<dynamic>.from(library!.map((x) => x.toMap())),
|
|
"playCut": playCut == null ? [] : List<dynamic>.from(playCut!.map((x) => x.toMap())),
|
|
"search": search == null ? [] : List<dynamic>.from(search!.map((x) => x.toMap())),
|
|
"searchResult": searchResult == null ? [] : List<dynamic>.from(searchResult!.map((x) => x.toMap())),
|
|
"backup": backup == null ? [] : List<dynamic>.from(backup!.map((x) => x.toMap())),
|
|
};
|
|
}
|
|
|
|
class AdModel {
|
|
int? level;
|
|
String? identifier;
|
|
String? ad;
|
|
String? type;
|
|
|
|
AdModel({
|
|
this.level,
|
|
this.identifier,
|
|
this.ad,
|
|
this.type,
|
|
});
|
|
|
|
factory AdModel.fromJson(String str) => AdModel.fromMap(json.decode(str));
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory AdModel.fromMap(Map<String, dynamic> json) => AdModel(
|
|
level: json["level"],
|
|
identifier: json["identifier"],
|
|
ad: json["ad"],
|
|
type: json["type"],
|
|
);
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
"level": level,
|
|
"identifier": identifier,
|
|
"ad": ad,
|
|
"type": type,
|
|
};
|
|
}
|