mod: 本地缓存字段修改、登录状态

This commit is contained in:
guozhigq
2023-08-20 14:28:50 +08:00
parent 8627869309
commit 83341cd62b
29 changed files with 217 additions and 167 deletions

View File

@ -42,7 +42,7 @@ class VideoIntroController extends GetxController {
RxBool hasCoin = false.obs;
// 是否收藏
RxBool hasFav = false.obs;
Box user = GStrorage.user;
Box userInfoCache = GStrorage.userInfo;
bool userLogin = false;
Rx<FavFolderData> favFolderData = FavFolderData().obs;
List addMediaIdsNew = [];
@ -52,10 +52,12 @@ class VideoIntroController extends GetxController {
int _tempThemeValue = -1;
RxInt lastPlayCid = 0.obs;
var userInfo;
@override
void onInit() {
super.onInit();
userInfo = userInfoCache.get('userInfoCache');
if (Get.arguments.isNotEmpty) {
if (Get.arguments.containsKey('videoItem')) {
preRender = true;
@ -77,7 +79,7 @@ class VideoIntroController extends GetxController {
videoItem!['owner'] = args.owner;
}
}
userLogin = user.get(UserBoxKey.userLogin) != null;
userLogin = userInfo == null;
lastPlayCid.value = int.parse(Get.parameters['cid']!);
}
@ -143,7 +145,7 @@ class VideoIntroController extends GetxController {
// 一键三连
Future actionOneThree() async {
if (user.get(UserBoxKey.userMid) == null) {
if (userInfo == null) {
SmartDialog.showToast('账号未登录');
return;
}
@ -206,7 +208,7 @@ class VideoIntroController extends GetxController {
// 投币
Future actionCoinVideo() async {
if (user.get(UserBoxKey.userMid) == null) {
if (userInfo == null) {
SmartDialog.showToast('账号未登录');
return;
}
@ -302,7 +304,7 @@ class VideoIntroController extends GetxController {
Future queryVideoInFolder() async {
var result = await VideoHttp.videoInFolder(
mid: user.get(UserBoxKey.userMid), rid: IdUtils.bv2av(bvid));
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
if (result['status']) {
favFolderData.value = result['data'];
}
@ -337,7 +339,7 @@ class VideoIntroController extends GetxController {
// 关注/取关up
Future actionRelationMod() async {
feedBack();
if (user.get(UserBoxKey.userMid) == null) {
if (userInfo == null) {
SmartDialog.showToast('账号未登录');
return;
}