mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
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:
committed by
GitHub
parent
3722ff1f33
commit
bd3c76ef43
@@ -304,29 +304,24 @@ class RequestUtils {
|
||||
}
|
||||
|
||||
// 动态点赞
|
||||
static Future onLikeDynamic(item, VoidCallback callback) async {
|
||||
static Future onLikeDynamic(
|
||||
DynamicItemModel item, VoidCallback callback) async {
|
||||
feedBack();
|
||||
String dynamicId = item.idStr!;
|
||||
// 1 已点赞 2 不喜欢 0 未操作
|
||||
item.modules?.moduleStat ??= ModuleStatModel();
|
||||
item.modules?.moduleStat.like ??= Like();
|
||||
Like like = item.modules.moduleStat.like;
|
||||
int count = like.count == '点赞' ? 0 : int.parse(like.count ?? '0');
|
||||
bool status = like.status ?? false;
|
||||
DynamicStat? like = item.modules.moduleStat?.like;
|
||||
int count = like?.count ?? 0;
|
||||
bool status = like?.status ?? false;
|
||||
int up = status ? 2 : 1;
|
||||
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
||||
if (up == 1) {
|
||||
item.modules.moduleStat.like.count = (count + 1).toString();
|
||||
item.modules.moduleStat.like.status = true;
|
||||
like?.count = count + 1;
|
||||
like?.status = true;
|
||||
} else {
|
||||
if (count == 1) {
|
||||
item.modules.moduleStat.like.count = '点赞';
|
||||
} else {
|
||||
item.modules.moduleStat.like.count = (count - 1).toString();
|
||||
}
|
||||
item.modules.moduleStat.like.status = false;
|
||||
like?.count = count - 1;
|
||||
like?.status = false;
|
||||
}
|
||||
callback();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user