Merge branch 'fix-videoIntroError'

This commit is contained in:
guozhigq
2024-02-03 23:39:17 +08:00
2 changed files with 12 additions and 8 deletions

View File

@ -224,10 +224,11 @@ class VideoHttp {
// 获取投币状态 // 获取投币状态
static Future hasCoinVideo({required String bvid}) async { static Future hasCoinVideo({required String bvid}) async {
var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid}); var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid});
print('res: $res');
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']}; return {'status': true, 'data': res.data['data']};
} else { } else {
return {'status': true, 'data': []}; return {'status': false, 'data': []};
} }
} }
@ -361,7 +362,7 @@ class VideoHttp {
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']}; return {'status': true, 'data': res.data['data']};
} else { } else {
return {'status': true, 'data': []}; return {'status': false, 'data': []};
} }
} }
@ -377,7 +378,7 @@ class VideoHttp {
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']}; return {'status': true, 'data': res.data['data']};
} else { } else {
return {'status': true, 'data': []}; return {'status': false, 'data': []};
} }
} }
@ -455,10 +456,7 @@ class VideoHttp {
'data': AiConclusionModel.fromJson(res.data['data']), 'data': AiConclusionModel.fromJson(res.data['data']),
}; };
} else { } else {
return { return {'status': false, 'data': []};
'status': false,
'data': []
};
} }
} }
} }

View File

@ -148,7 +148,9 @@ class VideoIntroController extends GetxController {
// 获取投币状态 // 获取投币状态
Future queryHasCoinVideo() async { Future queryHasCoinVideo() async {
var result = await VideoHttp.hasCoinVideo(bvid: bvid); var result = await VideoHttp.hasCoinVideo(bvid: bvid);
hasCoin.value = result["data"]['multiply'] == 0 ? false : true; if (result['status']) {
hasCoin.value = result["data"]['multiply'] == 0 ? false : true;
}
} }
// 获取收藏状态 // 获取收藏状态
@ -208,6 +210,10 @@ class VideoIntroController extends GetxController {
// (取消)点赞 // (取消)点赞
Future actionLikeVideo() async { Future actionLikeVideo() async {
if (userInfo == null) {
SmartDialog.showToast('账号未登录');
return;
}
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value); var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
if (result['status']) { if (result['status']) {
// hasLike.value = result["data"] == 1 ? true : false; // hasLike.value = result["data"] == 1 ? true : false;