mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: remove fan
Closes #733 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:PiliPlus/http/fan.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/fans/result.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
|
||||
@@ -12,7 +14,7 @@ class FansController
|
||||
late int? mid;
|
||||
late String? name;
|
||||
dynamic userInfo;
|
||||
RxBool isOwner = false.obs;
|
||||
late bool isOwner = false;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -21,7 +23,7 @@ class FansController
|
||||
mid = Get.parameters['mid'] != null
|
||||
? int.parse(Get.parameters['mid']!)
|
||||
: userInfo?.mid;
|
||||
isOwner.value = mid == userInfo?.mid;
|
||||
isOwner = mid == userInfo?.mid;
|
||||
name = Get.parameters['name'] ?? userInfo?.uname;
|
||||
|
||||
queryData();
|
||||
@@ -39,4 +41,20 @@ class FansController
|
||||
ps: ps,
|
||||
orderType: 'attention',
|
||||
);
|
||||
|
||||
Future onRemoveFan(int index, int mid) async {
|
||||
final res = await VideoHttp.relationMod(
|
||||
mid: mid,
|
||||
act: 7,
|
||||
reSrc: 11,
|
||||
);
|
||||
if (res['status']) {
|
||||
List<FansItemModel> list = (loadingState.value as Success).response;
|
||||
list.removeAt(index);
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('移除成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user