Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-26 12:15:25 +08:00
parent c9a02f9c74
commit 25fca498fc
41 changed files with 313 additions and 286 deletions

View File

@@ -164,12 +164,12 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
Future<void> queryAllStatus() async {
var result = await VideoHttp.videoRelation(bvid: bvid);
if (result case Success(:var response)) {
late final stat = videoDetail.value.stat!;
late final stat = videoDetail.value.stat;
if (response.like!) {
stat.like = max(1, stat.like);
stat?.like = max(1, stat.like);
}
if (response.favorite!) {
stat.favorite = max(1, stat.favorite);
stat?.favorite = max(1, stat.favorite);
}
hasLike.value = response.like!;
hasDislike.value = response.dislike!;
@@ -193,18 +193,18 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
}
var result = await VideoHttp.ugcTriple(bvid: bvid);
if (result case Success(:final response)) {
late final stat = videoDetail.value.stat!;
late final stat = videoDetail.value.stat;
if (response.like == true && !hasLike.value) {
stat.like++;
stat?.like++;
hasLike.value = true;
}
if (response.coin == true && !hasCoin) {
stat.coin += 2;
stat?.coin += 2;
coinNum.value = 2;
GlobalData().afterCoin(2);
}
if (response.fav == true && !hasFav.value) {
stat.favorite++;
stat?.favorite++;
hasFav.value = true;
}
hasDislike.value = false;
@@ -232,7 +232,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
var result = await VideoHttp.likeVideo(bvid: bvid, type: newVal);
if (result case Success(:final response)) {
SmartDialog.showToast(newVal ? response : '取消赞');
videoDetail.value.stat!.like += newVal ? 1 : -1;
videoDetail.value.stat?.like += newVal ? 1 : -1;
hasLike.value = newVal;
if (newVal) {
hasDislike.value = false;
@@ -256,7 +256,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
SmartDialog.showToast('点踩成功');
hasDislike.value = true;
if (hasLike.value) {
videoDetail.value.stat!.like--;
videoDetail.value.stat?.like--;
hasLike.value = false;
}
} else {