refa: opus (#762)

* feat: opus

* fix

* fix

* fix

* fix

* .

* fix

* remove

* wbi sign

* fix

* opus content null check

Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-04-27 17:24:14 +08:00
committed by GitHub
parent 3722ff1f33
commit bd3c76ef43
86 changed files with 1259 additions and 3222 deletions

View File

@@ -1,36 +1,27 @@
import 'package:json_annotation/json_annotation.dart';
import '../model_owner.dart';
import 'nameplate.dart';
import 'official_verify.dart';
import 'pendant.dart';
import 'vip.dart';
part 'author.g.dart';
class Author extends Owner {
Pendant? pendant;
OfficialVerify? officialVerify;
Nameplate? nameplate;
Vip? vip;
@JsonSerializable()
class Author {
int? mid;
String? name;
String? face;
Pendant? pendant;
@JsonKey(name: 'official_verify')
OfficialVerify? officialVerify;
Nameplate? nameplate;
Vip? vip;
Author({
this.mid,
this.name,
this.face,
this.pendant,
this.officialVerify,
this.nameplate,
this.vip,
});
factory Author.fromJson(Map<String, dynamic> json) {
return _$AuthorFromJson(json);
}
Map<String, dynamic> toJson() => _$AuthorToJson(this);
Author.fromJson(Map<String, dynamic> json) {
mid = json['mid'];
name = json['name'] as String?;
face = json['face'] as String?;
pendant =
json['pendant'] == null ? null : Pendant.fromJson(json['pendant']);
officialVerify = json['official_verify'] == null
? null
: OfficialVerify.fromJson(json['official_verify']);
nameplate = json['nameplate'] == null
? null
: Nameplate.fromJson(json['nameplate']);
vip = json['vip'] == null ? null : Vip.fromJson(json['vip']);
}
}

View File

@@ -1,36 +1 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'author.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Author _$AuthorFromJson(Map<String, dynamic> json) => Author(
mid: (json['mid'] as num?)?.toInt(),
name: json['name'] as String?,
face: json['face'] as String?,
pendant: json['pendant'] == null
? null
: Pendant.fromJson(json['pendant'] as Map<String, dynamic>),
officialVerify: json['official_verify'] == null
? null
: OfficialVerify.fromJson(
json['official_verify'] as Map<String, dynamic>),
nameplate: json['nameplate'] == null
? null
: Nameplate.fromJson(json['nameplate'] as Map<String, dynamic>),
vip: json['vip'] == null
? null
: Vip.fromJson(json['vip'] as Map<String, dynamic>),
);
Map<String, dynamic> _$AuthorToJson(Author instance) => <String, dynamic>{
'mid': instance.mid,
'name': instance.name,
'face': instance.face,
'pendant': instance.pendant,
'official_verify': instance.officialVerify,
'nameplate': instance.nameplate,
'vip': instance.vip,
};

View File

@@ -1,107 +1,142 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:PiliPlus/models/dynamics/article_content_model.dart';
import 'author.dart';
import 'category.dart';
import 'media.dart';
import 'stats.dart';
part 'item.g.dart';
@JsonSerializable()
class Item {
int? id;
Category? category;
List<Category>? categories;
String? title;
String? summary;
@JsonKey(name: 'banner_url')
String? bannerUrl;
@JsonKey(name: 'template_id')
int? templateId;
int? state;
Author? author;
int? reprint;
@JsonKey(name: 'image_urls')
List<String>? imageUrls;
@JsonKey(name: 'publish_time')
int? publishTime;
int? ctime;
int? mtime;
Stats? stats;
int? attributes;
int? words;
@JsonKey(name: 'origin_image_urls')
List<String>? originImageUrls;
dynamic list;
@JsonKey(name: 'is_like')
bool? isLike;
Media? media;
@JsonKey(name: 'apply_time')
String? applyTime;
@JsonKey(name: 'check_time')
String? checkTime;
int? original;
@JsonKey(name: 'act_id')
int? actId;
dynamic dispute;
dynamic authenMark;
@JsonKey(name: 'cover_avid')
int? coverAvid;
@JsonKey(name: 'top_video_info')
dynamic topVideoInfo;
int? type;
@JsonKey(name: 'check_state')
int? checkState;
@JsonKey(name: 'origin_template_id')
int? originTemplateId;
// 动态
String? uri;
String? param;
String? goto;
@JsonKey(name: 'publish_time_text')
String? publishTimeText;
String? dyn;
Item({
this.id,
this.category,
this.categories,
this.title,
this.summary,
this.bannerUrl,
this.templateId,
this.state,
this.author,
this.reprint,
this.imageUrls,
this.publishTime,
this.ctime,
this.mtime,
this.stats,
this.attributes,
this.words,
this.originImageUrls,
this.list,
this.isLike,
this.media,
this.applyTime,
this.checkTime,
this.original,
this.actId,
this.dispute,
this.authenMark,
this.coverAvid,
this.topVideoInfo,
this.type,
this.checkState,
this.originTemplateId,
this.uri,
this.param,
this.goto,
this.publishTimeText,
this.dyn,
});
// 专栏
List<Tag>? tags;
int? privatePub;
dynamic contentPicList;
String? content;
String? keywords;
Opus? opus;
int? versionId;
String? dynIdStr;
int? totalArtNum;
factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
Item.fromJson(Map<String, dynamic> json) {
id = json["id"];
category =
json["category"] == null ? null : Category.fromJson(json["category"]);
categories = (json["categories"] as List?)
?.map((x) => Category.fromJson(x))
.toList();
title = json["title"];
summary = json["summary"];
bannerUrl = json["banner_url"];
templateId = json["template_id"];
state = json["state"];
author = json["author"] == null ? null : Author.fromJson(json["author"]);
reprint = json["reprint"];
imageUrls = (json["image_urls"] as List?)?.cast<String>();
publishTime = json["publish_time"];
ctime = json["ctime"];
mtime = json["mtime"];
stats = json["stats"] == null ? null : Stats.fromJson(json["stats"]);
words = json["words"];
originImageUrls = (json["origin_image_urls"] as List?)?.cast<String>();
list = json["list"];
isLike = json["is_like"];
media = json["media"] == null ? null : Media.fromJson(json["media"]);
applyTime = json["apply_time"];
checkTime = json["check_time"];
original = json["original"];
actId = json["act_id"];
dispute = json["dispute"];
authenMark = json["authenMark"];
coverAvid = json["cover_avid"];
topVideoInfo = json["top_video_info"];
type = json["type"];
checkState = json["check_state"];
originTemplateId = json["origin_template_id"];
Map<String, dynamic> toJson() => _$ItemToJson(this);
uri = json['uri'];
param = json['param'];
goto = json['goto'];
publishTimeText = json['publish_time_text'];
dyn = json['dynamic'];
tags = (json["tags"] as List?)?.map((x) => Tag.fromJson(x)).toList();
privatePub = json["private_pub"];
contentPicList = json["content_pic_list"];
content = json["content"];
keywords = json["keywords"];
if (json['opus'] != null) opus = Opus.fromJson(json['opus']);
versionId = json["version_id"];
dynIdStr = json["dyn_id_str"];
totalArtNum = json["total_art_num"];
}
}
class Tag {
int? tid;
String? name;
Tag.fromJson(Map<String, dynamic> json) {
tid = json["tid"];
name = json["name"];
}
}
class Opus {
int? opusid;
int? opussource;
String? title;
List<ArticleContentModel>? content;
// PubInfo? pubinfo;
// Article? article;
// Version? version;
Opus.fromJson(Map<String, dynamic> json) {
opusid = json['opus_id'];
opussource = json['opus_source'];
title = json['title'];
if (json['content']?['paragraphs'] is List) {
content = (json['content']['paragraphs'] as List)
.map((i) => ArticleContentModel.fromJson(i))
.toList();
}
}
}

View File

@@ -1,101 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'item.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Item _$ItemFromJson(Map<String, dynamic> json) => Item(
id: (json['id'] as num?)?.toInt(),
category: json['category'] == null
? null
: Category.fromJson(json['category'] as Map<String, dynamic>),
categories: (json['categories'] as List<dynamic>?)
?.map((e) => Category.fromJson(e as Map<String, dynamic>))
.toList(),
title: json['title'] as String?,
summary: json['summary'] as String?,
bannerUrl: json['banner_url'] as String?,
templateId: (json['template_id'] as num?)?.toInt(),
state: (json['state'] as num?)?.toInt(),
author: json['author'] == null
? null
: Author.fromJson(json['author'] as Map<String, dynamic>),
reprint: (json['reprint'] as num?)?.toInt(),
imageUrls: (json['image_urls'] as List<dynamic>?)
?.map((e) => e as String)
.toList(),
publishTime: (json['publish_time'] as num?)?.toInt(),
ctime: (json['ctime'] as num?)?.toInt(),
mtime: (json['mtime'] as num?)?.toInt(),
stats: json['stats'] == null
? null
: Stats.fromJson(json['stats'] as Map<String, dynamic>),
attributes: (json['attributes'] as num?)?.toInt(),
words: (json['words'] as num?)?.toInt(),
originImageUrls: (json['origin_image_urls'] as List<dynamic>?)
?.map((e) => e as String)
.toList(),
list: json['list'],
isLike: json['is_like'] as bool?,
media: json['media'] == null
? null
: Media.fromJson(json['media'] as Map<String, dynamic>),
applyTime: json['apply_time'] as String?,
checkTime: json['check_time'] as String?,
original: (json['original'] as num?)?.toInt(),
actId: (json['act_id'] as num?)?.toInt(),
dispute: json['dispute'],
authenMark: json['authenMark'],
coverAvid: (json['cover_avid'] as num?)?.toInt(),
topVideoInfo: json['top_video_info'],
type: (json['type'] as num?)?.toInt(),
checkState: (json['check_state'] as num?)?.toInt(),
originTemplateId: (json['origin_template_id'] as num?)?.toInt(),
uri: json['uri'] as String?,
param: json['param'] as String?,
goto: json['goto'] as String?,
publishTimeText: json['publish_time_text'] as String?,
dyn: json['dynamic'] as String?,
);
Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
'id': instance.id,
'category': instance.category,
'categories': instance.categories,
'title': instance.title,
'summary': instance.summary,
'banner_url': instance.bannerUrl,
'template_id': instance.templateId,
'state': instance.state,
'author': instance.author,
'reprint': instance.reprint,
'image_urls': instance.imageUrls,
'publish_time': instance.publishTime,
'ctime': instance.ctime,
'mtime': instance.mtime,
'stats': instance.stats,
'attributes': instance.attributes,
'words': instance.words,
'origin_image_urls': instance.originImageUrls,
'list': instance.list,
'is_like': instance.isLike,
'media': instance.media,
'apply_time': instance.applyTime,
'check_time': instance.checkTime,
'original': instance.original,
'act_id': instance.actId,
'dispute': instance.dispute,
'authenMark': instance.authenMark,
'cover_avid': instance.coverAvid,
'top_video_info': instance.topVideoInfo,
'type': instance.type,
'check_state': instance.checkState,
'origin_template_id': instance.originTemplateId,
'uri': instance.uri,
'param': instance.param,
'goto': instance.goto,
'publish_time_text': instance.publishTimeText,
'dynamic': instance.dyn,
};