mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
fix audio action
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -339,6 +339,12 @@ class AudioController extends GetxController
|
|||||||
);
|
);
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
hasLike.value = newVal;
|
hasLike.value = newVal;
|
||||||
|
try {
|
||||||
|
audioItem.value!.stat
|
||||||
|
..hasLike_7 = newVal
|
||||||
|
..like += newVal ? 1 : -1;
|
||||||
|
audioItem.refresh();
|
||||||
|
} catch (_) {}
|
||||||
SmartDialog.showToast(res.data.message);
|
SmartDialog.showToast(res.data.message);
|
||||||
} else {
|
} else {
|
||||||
res.toast();
|
res.toast();
|
||||||
@@ -362,6 +368,12 @@ class AudioController extends GetxController
|
|||||||
if (data.coinOk && !hasCoin) {
|
if (data.coinOk && !hasCoin) {
|
||||||
coinNum.value = 2;
|
coinNum.value = 2;
|
||||||
GlobalData().afterCoin(2);
|
GlobalData().afterCoin(2);
|
||||||
|
try {
|
||||||
|
audioItem.value!.stat
|
||||||
|
..hasCoin_8 = true
|
||||||
|
..coin += 2;
|
||||||
|
audioItem.refresh();
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
hasFav.value = true;
|
hasFav.value = true;
|
||||||
if (!hasCoin) {
|
if (!hasCoin) {
|
||||||
@@ -412,10 +424,22 @@ class AudioController extends GetxController
|
|||||||
thumbUp: coinWithLike,
|
thumbUp: coinWithLike,
|
||||||
);
|
);
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
if (coinWithLike) {
|
final updateLike = !hasLike.value && coinWithLike;
|
||||||
|
if (updateLike) {
|
||||||
hasLike.value = true;
|
hasLike.value = true;
|
||||||
}
|
}
|
||||||
coinNum.value += coin;
|
coinNum.value += coin;
|
||||||
|
try {
|
||||||
|
final stat = audioItem.value!.stat
|
||||||
|
..hasCoin_8 = true
|
||||||
|
..coin += coin;
|
||||||
|
if (updateLike) {
|
||||||
|
stat
|
||||||
|
..hasLike_7 = true
|
||||||
|
..like += 1;
|
||||||
|
}
|
||||||
|
audioItem.refresh();
|
||||||
|
} catch (_) {}
|
||||||
GlobalData().afterCoin(coin);
|
GlobalData().afterCoin(coin);
|
||||||
} else {
|
} else {
|
||||||
res.toast();
|
res.toast();
|
||||||
@@ -600,7 +624,9 @@ class AudioController extends GetxController
|
|||||||
final audioItem = playlist![index];
|
final audioItem = playlist![index];
|
||||||
final item = audioItem.item;
|
final item = audioItem.item;
|
||||||
oid = item.oid;
|
oid = item.oid;
|
||||||
this.subId = subId ?? item.subId;
|
this.subId =
|
||||||
|
subId ??
|
||||||
|
(item.subId.isNotEmpty ? item.subId : [audioItem.parts.first.subId]);
|
||||||
itemType = item.itemType;
|
itemType = item.itemType;
|
||||||
_queryPlayUrl().then((res) {
|
_queryPlayUrl().then((res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
@@ -633,9 +659,12 @@ class AudioController extends GetxController
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateFavCount(int count) {
|
void updateFavCount(int count) {
|
||||||
audioItem
|
try {
|
||||||
..value?.stat.favourite += count
|
audioItem.value!.stat
|
||||||
..refresh();
|
..hasFav = count > 0
|
||||||
|
..favourite += count;
|
||||||
|
audioItem.refresh();
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadPrev(BuildContext context) async {
|
Future<void> loadPrev(BuildContext context) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user