mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 01:26:59 +08:00
opt video action
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,22 +1,22 @@
|
|||||||
class Stat {
|
class Stat {
|
||||||
num? coins;
|
num coins;
|
||||||
int? danmakus;
|
int? danmakus;
|
||||||
int? favorite;
|
int favorite;
|
||||||
int? favorites;
|
int? favorites;
|
||||||
String? followText;
|
String? followText;
|
||||||
int? likes;
|
int likes;
|
||||||
int? reply;
|
int? reply;
|
||||||
int? share;
|
int? share;
|
||||||
int? views;
|
int? views;
|
||||||
int? vt;
|
int? vt;
|
||||||
|
|
||||||
Stat({
|
Stat({
|
||||||
this.coins,
|
required this.coins,
|
||||||
this.danmakus,
|
this.danmakus,
|
||||||
this.favorite,
|
required this.favorite,
|
||||||
this.favorites,
|
this.favorites,
|
||||||
this.followText,
|
this.followText,
|
||||||
this.likes,
|
required this.likes,
|
||||||
this.reply,
|
this.reply,
|
||||||
this.share,
|
this.share,
|
||||||
this.views,
|
this.views,
|
||||||
@@ -24,12 +24,12 @@ class Stat {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
|
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
|
||||||
coins: json["coins"],
|
coins: json["coins"] ?? 0,
|
||||||
danmakus: json["danmakus"],
|
danmakus: json["danmakus"],
|
||||||
favorite: json["favorite"],
|
favorite: json["favorite"] ?? 0,
|
||||||
favorites: json["favorites"],
|
favorites: json["favorites"],
|
||||||
followText: json["follow_text"],
|
followText: json["follow_text"],
|
||||||
likes: json["likes"],
|
likes: json["likes"] ?? 0,
|
||||||
reply: json["reply"],
|
reply: json["reply"],
|
||||||
share: json["share"],
|
share: json["share"],
|
||||||
views: json["views"],
|
views: json["views"],
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ class Stat {
|
|||||||
int? view;
|
int? view;
|
||||||
int? danmaku;
|
int? danmaku;
|
||||||
int? reply;
|
int? reply;
|
||||||
int? favorite;
|
int favorite;
|
||||||
num? coin;
|
num coin;
|
||||||
int? share;
|
int? share;
|
||||||
int? nowRank;
|
int? nowRank;
|
||||||
int? hisRank;
|
int? hisRank;
|
||||||
int? like;
|
int like;
|
||||||
int? dislike;
|
int? dislike;
|
||||||
String? evaluation;
|
String? evaluation;
|
||||||
int? vt;
|
int? vt;
|
||||||
@@ -18,12 +18,12 @@ class Stat {
|
|||||||
this.view,
|
this.view,
|
||||||
this.danmaku,
|
this.danmaku,
|
||||||
this.reply,
|
this.reply,
|
||||||
this.favorite,
|
required this.favorite,
|
||||||
this.coin,
|
required this.coin,
|
||||||
this.share,
|
this.share,
|
||||||
this.nowRank,
|
this.nowRank,
|
||||||
this.hisRank,
|
this.hisRank,
|
||||||
this.like,
|
required this.like,
|
||||||
this.dislike,
|
this.dislike,
|
||||||
this.evaluation,
|
this.evaluation,
|
||||||
this.vt,
|
this.vt,
|
||||||
@@ -34,12 +34,12 @@ class Stat {
|
|||||||
view: json['view'] as int?,
|
view: json['view'] as int?,
|
||||||
danmaku: json['danmaku'] as int?,
|
danmaku: json['danmaku'] as int?,
|
||||||
reply: json['reply'] as int?,
|
reply: json['reply'] as int?,
|
||||||
favorite: json['favorite'] as int?,
|
favorite: json['favorite'] as int? ?? 0,
|
||||||
coin: json['coin'] as num?,
|
coin: json['coin'] as num? ?? 0,
|
||||||
share: json['share'] as int?,
|
share: json['share'] as int?,
|
||||||
nowRank: json['now_rank'] as int?,
|
nowRank: json['now_rank'] as int?,
|
||||||
hisRank: json['his_rank'] as int?,
|
hisRank: json['his_rank'] as int?,
|
||||||
like: json['like'] as int?,
|
like: json['like'] as int? ?? 0,
|
||||||
dislike: json['dislike'] as int?,
|
dislike: json['dislike'] as int?,
|
||||||
evaluation: json['evaluation'] as String?,
|
evaluation: json['evaluation'] as String?,
|
||||||
vt: json['vt'] as int?,
|
vt: json['vt'] as int?,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_folder/data.dart';
|
import 'package:PiliPlus/models_new/fav/fav_folder/data.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
|
||||||
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
||||||
import 'package:PiliPlus/services/account_service.dart';
|
import 'package:PiliPlus/services/account_service.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
@@ -35,20 +34,23 @@ abstract class CommonIntroController extends GetxController {
|
|||||||
Future<void> actionFavVideo({String type = 'choose'});
|
Future<void> actionFavVideo({String type = 'choose'});
|
||||||
|
|
||||||
late final enableQuickFav = Pref.enableQuickFav;
|
late final enableQuickFav = Pref.enableQuickFav;
|
||||||
late int? quickFavId = Pref.quickFavId;
|
int? quickFavId;
|
||||||
|
|
||||||
FavFolderInfo get favFolderInfo {
|
int get favFolderId {
|
||||||
|
if (this.quickFavId != null) {
|
||||||
|
return this.quickFavId!;
|
||||||
|
}
|
||||||
|
final quickFavId = Pref.quickFavId;
|
||||||
final list = favFolderData.value.list!;
|
final list = favFolderData.value.list!;
|
||||||
if (quickFavId != null) {
|
if (quickFavId != null) {
|
||||||
final folderInfo = list.firstWhereOrNull((e) => e.id == quickFavId);
|
final folderInfo = list.firstWhereOrNull((e) => e.id == quickFavId);
|
||||||
if (folderInfo != null) {
|
if (folderInfo != null) {
|
||||||
return folderInfo;
|
return this.quickFavId = quickFavId;
|
||||||
} else {
|
} else {
|
||||||
quickFavId = null;
|
|
||||||
GStorage.setting.delete(SettingBoxKey.quickFavId);
|
GStorage.setting.delete(SettingBoxKey.quickFavId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list.first;
|
return this.quickFavId = list.first.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math' show max;
|
||||||
|
|
||||||
import 'package:PiliPlus/grpc/bilibili/app/viewunite/pgcanymodel.pb.dart'
|
import 'package:PiliPlus/grpc/bilibili/app/viewunite/pgcanymodel.pb.dart'
|
||||||
show ViewPgcAny;
|
show ViewPgcAny;
|
||||||
@@ -59,9 +60,18 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
var result = await VideoHttp.pgcLikeCoinFav(epId: epId);
|
var result = await VideoHttp.pgcLikeCoinFav(epId: epId);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
PgcLCF data = result['data'];
|
PgcLCF data = result['data'];
|
||||||
hasLike.value = data.like == 1;
|
final hasLike = data.like == 1;
|
||||||
|
final hasFav = data.favorite == 1;
|
||||||
|
late final stat = pgcItem.stat!;
|
||||||
|
if (hasLike) {
|
||||||
|
stat.likes = max(1, stat.likes);
|
||||||
|
}
|
||||||
|
if (hasFav) {
|
||||||
|
stat.favorite = max(1, stat.favorite);
|
||||||
|
}
|
||||||
|
this.hasLike.value = hasLike;
|
||||||
coinNum.value = data.coinNumber!;
|
coinNum.value = data.coinNumber!;
|
||||||
hasFav.value = data.favorite == 1;
|
this.hasFav.value = hasFav;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
@@ -69,11 +79,16 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
|
|
||||||
// (取消)点赞
|
// (取消)点赞
|
||||||
Future<void> actionLikeVideo() async {
|
Future<void> actionLikeVideo() async {
|
||||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
if (!accountService.isLogin.value) {
|
||||||
|
SmartDialog.showToast('账号未登录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final newVal = !hasLike.value;
|
||||||
|
var result = await VideoHttp.likeVideo(bvid: bvid, type: newVal);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
SmartDialog.showToast(!hasLike.value ? result['data']['toast'] : '取消赞');
|
SmartDialog.showToast(newVal ? result['data']['toast'] : '取消赞');
|
||||||
pgcItem.stat!.likes = pgcItem.stat!.likes! + (!hasLike.value ? 1 : -1);
|
pgcItem.stat!.likes += newVal ? 1 : -1;
|
||||||
hasLike.value = !hasLike.value;
|
hasLike.value = newVal;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
@@ -87,13 +102,13 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功');
|
SmartDialog.showToast('投币成功');
|
||||||
pgcItem.stat!.coins = pgcItem.stat!.coins! + coin;
|
|
||||||
if (selectLike && !hasLike.value) {
|
|
||||||
hasLike.value = true;
|
|
||||||
pgcItem.stat!.likes = pgcItem.stat!.likes! + 1;
|
|
||||||
}
|
|
||||||
coinNum.value += coin;
|
coinNum.value += coin;
|
||||||
GlobalData().afterCoin(coin);
|
GlobalData().afterCoin(coin);
|
||||||
|
final stat = pgcItem.stat!..coins += coin;
|
||||||
|
if (selectLike && !hasLike.value) {
|
||||||
|
stat.likes++;
|
||||||
|
hasLike.value = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
@@ -130,18 +145,17 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
SmartDialog.showLoading(msg: '请求中');
|
SmartDialog.showLoading(msg: '请求中');
|
||||||
queryVideoInFolder().then((res) async {
|
queryVideoInFolder().then((res) async {
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
final favFolderInfo = this.favFolderInfo;
|
final hasFav = this.hasFav.value;
|
||||||
final defaultFolderId = favFolderInfo.id;
|
var result = hasFav
|
||||||
final isFav = favFolderInfo.favState == 1;
|
|
||||||
var result = isFav
|
|
||||||
? await FavHttp.unfavAll(rid: epId, type: 24)
|
? await FavHttp.unfavAll(rid: epId, type: 24)
|
||||||
: await FavHttp.favVideo(
|
: await FavHttp.favVideo(
|
||||||
resources: '$epId:24',
|
resources: '$epId:24',
|
||||||
addIds: defaultFolderId.toString(),
|
addIds: favFolderId.toString(),
|
||||||
);
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
hasFav.value = !isFav;
|
pgcItem.stat!.favorite += hasFav ? -1 : 1;
|
||||||
|
this.hasFav.value = !hasFav;
|
||||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@@ -177,8 +191,12 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
SmartDialog.showToast('操作成功');
|
SmartDialog.showToast('操作成功');
|
||||||
Get.back();
|
Get.back();
|
||||||
hasFav.value =
|
final newVal =
|
||||||
addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length;
|
addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length;
|
||||||
|
if (hasFav.value != newVal) {
|
||||||
|
pgcItem.stat!.favorite += newVal ? 1 : -1;
|
||||||
|
hasFav.value = newVal;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
@@ -483,12 +501,20 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
var result = await VideoHttp.triple(epId: epId, seasonId: seasonId);
|
var result = await VideoHttp.triple(epId: epId, seasonId: seasonId);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
PgcTriple data = result['data'];
|
PgcTriple data = result['data'];
|
||||||
hasLike.value = data.like == 1;
|
late final stat = pgcItem.stat!;
|
||||||
if (data.coin == 1) {
|
if ((data.like == 1) != hasLike.value) {
|
||||||
|
stat.likes++;
|
||||||
|
hasLike.value = true;
|
||||||
|
}
|
||||||
|
if ((data.coin == 1) != hasCoin) {
|
||||||
|
stat.coins += 2;
|
||||||
coinNum.value = 2;
|
coinNum.value = 2;
|
||||||
GlobalData().afterCoin(2);
|
GlobalData().afterCoin(2);
|
||||||
}
|
}
|
||||||
hasFav.value = data.favorite == 1;
|
if ((data.favorite == 1) != hasFav.value) {
|
||||||
|
stat.favorite++;
|
||||||
|
hasFav.value = true;
|
||||||
|
}
|
||||||
SmartDialog.showToast('三连成功');
|
SmartDialog.showToast('三连成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||||
import 'package:PiliPlus/http/api.dart';
|
import 'package:PiliPlus/http/api.dart';
|
||||||
@@ -200,6 +201,13 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
var result = await VideoHttp.videoRelation(bvid: bvid);
|
var result = await VideoHttp.videoRelation(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
VideoRelation data = result['data'];
|
VideoRelation data = result['data'];
|
||||||
|
late final stat = videoDetail.value.stat!;
|
||||||
|
if (data.like!) {
|
||||||
|
stat.like = max(1, stat.like);
|
||||||
|
}
|
||||||
|
if (data.favorite!) {
|
||||||
|
stat.favorite = max(1, stat.favorite);
|
||||||
|
}
|
||||||
hasLike.value = data.like!;
|
hasLike.value = data.like!;
|
||||||
hasDislike.value = data.dislike!;
|
hasDislike.value = data.dislike!;
|
||||||
coinNum.value = data.coin!;
|
coinNum.value = data.coin!;
|
||||||
@@ -222,12 +230,21 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
var result = await VideoHttp.oneThree(bvid: bvid);
|
var result = await VideoHttp.oneThree(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
UgcTriple data = result['data'];
|
UgcTriple data = result['data'];
|
||||||
hasLike.value = data.like!;
|
late final stat = videoDetail.value.stat!;
|
||||||
if (data.coin == true) {
|
if (data.like != hasLike.value) {
|
||||||
|
stat.like++;
|
||||||
|
hasLike.value = true;
|
||||||
|
}
|
||||||
|
if (data.coin != hasCoin) {
|
||||||
|
stat.coin += 2;
|
||||||
coinNum.value = 2;
|
coinNum.value = 2;
|
||||||
GlobalData().afterCoin(2);
|
GlobalData().afterCoin(2);
|
||||||
}
|
}
|
||||||
hasFav.value = data.fav!;
|
if (data.fav != hasFav.value) {
|
||||||
|
stat.favorite++;
|
||||||
|
hasFav.value = true;
|
||||||
|
}
|
||||||
|
hasDislike.value = false;
|
||||||
SmartDialog.showToast('三连成功');
|
SmartDialog.showToast('三连成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@@ -240,20 +257,17 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (videoDetail.value.stat?.like == null) {
|
if (videoDetail.value.stat == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
final newVal = !hasLike.value;
|
||||||
|
var result = await VideoHttp.likeVideo(bvid: bvid, type: newVal);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (!hasLike.value) {
|
SmartDialog.showToast(newVal ? result['data']['toast'] : '取消赞');
|
||||||
SmartDialog.showToast(result['data']['toast']);
|
videoDetail.value.stat!.like += newVal ? 1 : -1;
|
||||||
hasLike.value = true;
|
hasLike.value = newVal;
|
||||||
|
if (newVal) {
|
||||||
hasDislike.value = false;
|
hasDislike.value = false;
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
|
||||||
} else if (hasLike.value) {
|
|
||||||
SmartDialog.showToast('取消赞');
|
|
||||||
hasLike.value = false;
|
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! - 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@@ -273,7 +287,10 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
if (!hasDislike.value) {
|
if (!hasDislike.value) {
|
||||||
SmartDialog.showToast('点踩成功');
|
SmartDialog.showToast('点踩成功');
|
||||||
hasDislike.value = true;
|
hasDislike.value = true;
|
||||||
hasLike.value = false;
|
if (hasLike.value) {
|
||||||
|
videoDetail.value.stat!.like--;
|
||||||
|
hasLike.value = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('取消踩');
|
SmartDialog.showToast('取消踩');
|
||||||
hasDislike.value = false;
|
hasDislike.value = false;
|
||||||
@@ -292,8 +309,7 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> coinVideo(int coin, [bool selectLike = false]) async {
|
Future<void> coinVideo(int coin, [bool selectLike = false]) async {
|
||||||
if (videoDetail.value.stat?.coin == null) {
|
if (videoDetail.value.stat == null) {
|
||||||
// not init
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var res = await VideoHttp.coinVideo(
|
var res = await VideoHttp.coinVideo(
|
||||||
@@ -305,10 +321,10 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
SmartDialog.showToast('投币成功');
|
SmartDialog.showToast('投币成功');
|
||||||
coinNum.value += coin;
|
coinNum.value += coin;
|
||||||
GlobalData().afterCoin(coin);
|
GlobalData().afterCoin(coin);
|
||||||
videoDetail.value.stat!.coin = videoDetail.value.stat!.coin! + coin;
|
final stat = videoDetail.value.stat!..coin += coin;
|
||||||
if (selectLike && !hasLike.value) {
|
if (selectLike && !hasLike.value) {
|
||||||
|
stat.like++;
|
||||||
hasLike.value = true;
|
hasLike.value = true;
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
@@ -348,18 +364,17 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
SmartDialog.showLoading(msg: '请求中');
|
SmartDialog.showLoading(msg: '请求中');
|
||||||
queryVideoInFolder().then((res) async {
|
queryVideoInFolder().then((res) async {
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
final favFolderInfo = this.favFolderInfo;
|
final hasFav = this.hasFav.value;
|
||||||
final defaultFolderId = favFolderInfo.id;
|
var result = hasFav
|
||||||
final isFav = favFolderInfo.favState == 1;
|
|
||||||
var result = isFav
|
|
||||||
? await FavHttp.unfavAll(rid: IdUtils.bv2av(bvid), type: 2)
|
? await FavHttp.unfavAll(rid: IdUtils.bv2av(bvid), type: 2)
|
||||||
: await FavHttp.favVideo(
|
: await FavHttp.favVideo(
|
||||||
resources: '${IdUtils.bv2av(bvid)}:2',
|
resources: '${IdUtils.bv2av(bvid)}:2',
|
||||||
addIds: defaultFolderId.toString(),
|
addIds: favFolderId.toString(),
|
||||||
);
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
hasFav.value = !isFav;
|
videoDetail.value.stat!.favorite += hasFav ? -1 : 1;
|
||||||
|
this.hasFav.value = !hasFav;
|
||||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@@ -398,8 +413,12 @@ class VideoIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
Get.back();
|
Get.back();
|
||||||
hasFav.value =
|
final newVal =
|
||||||
addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length;
|
addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length;
|
||||||
|
if (hasFav.value != newVal) {
|
||||||
|
videoDetail.value.stat!.favorite += newVal ? 1 : -1;
|
||||||
|
hasFav.value = newVal;
|
||||||
|
}
|
||||||
SmartDialog.showToast('操作成功');
|
SmartDialog.showToast('操作成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class GlobalData {
|
|||||||
|
|
||||||
num? coins;
|
num? coins;
|
||||||
|
|
||||||
void afterCoin(int coin) {
|
void afterCoin(num coin) {
|
||||||
if (coins != null) {
|
if (coins != null) {
|
||||||
coins = coins! - coin;
|
coins = coins! - coin;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user