From a535b5721c906dd2774ff0d3d61d8b6bebe7324e Mon Sep 17 00:00:00 2001 From: niuhuan Date: Fri, 30 Aug 2024 18:19:44 +0800 Subject: [PATCH] :sparkles: subscribe comics (service) --- lib/basic/Entities.dart | 39 +++++++++++++++++++++++++++++++++++++++ lib/basic/Method.dart | 31 +++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/lib/basic/Entities.dart b/lib/basic/Entities.dart index 50174799..9320a7d3 100644 --- a/lib/basic/Entities.dart +++ b/lib/basic/Entities.dart @@ -1144,3 +1144,42 @@ class ResetPasswordResult { return _data; } } + +/// 浏览历史记录 +class ComicSubscribe { + late String id; + late String title; + late String author; + late int pagesCount; + late int epsCount; + late bool finished; + late String categories; + late String thumbOriginalName; + late String thumbFileServer; + late String thumbPath; + late String description; + late String chineseTeam; + late String tags; + late String subscribeTime; + late String updateSubscribeTime; + late int newEpCount; + + ComicSubscribe.fromJson(Map json) { + this.id = json["id"]; + this.title = json["title"]; + this.author = json["author"]; + this.pagesCount = json["pagesCount"]; + this.epsCount = json["epsCount"]; + this.finished = json["finished"]; + this.categories = json["categories"]; + this.thumbOriginalName = json["thumbOriginalName"]; + this.thumbFileServer = json["thumbFileServer"]; + this.thumbPath = json["thumbPath"]; + this.description = json["description"]; + this.chineseTeam = json["chineseTeam"]; + this.tags = json["tags"]; + this.subscribeTime = json["subscribeTime"]; + this.updateSubscribeTime = json["updateSubscribeTime"]; + this.newEpCount = json["newEpCount"]; + } +} diff --git a/lib/basic/Method.dart b/lib/basic/Method.dart index b4d17226..5c804d84 100644 --- a/lib/basic/Method.dart +++ b/lib/basic/Method.dart @@ -1051,4 +1051,35 @@ class Method { Future setProServerName(String serverName) { return _flatInvoke("setProServerName", serverName); } + + /// 加载已订阅 + Future loadSubscribed(String comicId) async { + String data = await _flatInvoke("loadSubscribed", comicId); + if (data == "") { + return null; + } + return ComicSubscribe.fromJson(jsonDecode(data)); + } + + Future addSubscribed(ComicInfo comicInfo) async { + return _flatInvoke("addSubscribed", comicInfo); + } + + Future removeAllSubscribed() async { + return _flatInvoke("removeAllSubscribed", ""); + } + + Future removeSubscribed(String comicId) async { + return _flatInvoke("removeSubscribed", comicId); + } + + Future> allSubscribed() async { + var data = await _flatInvoke("allSubscribed", ""); + List list = json.decode(data); + return list.map((e) => ComicSubscribe.fromJson(e)).toList(); + } + + Future updateSubscribed() async { + return _flatInvoke("updateSubscribed", ""); + } }