Skip to content

Commit

Permalink
✨ subscribe comics (service)
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Aug 30, 2024
1 parent a716b05 commit a535b57
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lib/basic/Entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, dynamic> 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"];
}
}
31 changes: 31 additions & 0 deletions lib/basic/Method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1051,4 +1051,35 @@ class Method {
Future<dynamic> setProServerName(String serverName) {
return _flatInvoke("setProServerName", serverName);
}

/// 加载已订阅
Future<ComicSubscribe?> 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<List<ComicSubscribe>> 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", "");
}
}

0 comments on commit a535b57

Please sign in to comment.