mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
remove duplicated code (#396)
* remove duplicated code * partical revert --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
3048e36d2f
commit
b7cb977f2b
@@ -408,9 +408,6 @@ class Api {
|
|||||||
// 黑名单
|
// 黑名单
|
||||||
static const String blackLst = '/x/relation/blacks';
|
static const String blackLst = '/x/relation/blacks';
|
||||||
|
|
||||||
// 移除黑名单
|
|
||||||
static const String removeBlack = '/x/relation/modify';
|
|
||||||
|
|
||||||
// github 获取最新版
|
// github 获取最新版
|
||||||
static const String latestApp =
|
static const String latestApp =
|
||||||
'https://api.github.com/repos/bggRGjQaUbCoE/PiliPlus/releases';
|
'https://api.github.com/repos/bggRGjQaUbCoE/PiliPlus/releases';
|
||||||
|
|||||||
@@ -19,31 +19,4 @@ class BlackHttp {
|
|||||||
return LoadingState.error(res.data['message']);
|
return LoadingState.error(res.data['message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除黑名单
|
|
||||||
static Future removeBlack({required int fid}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.removeBlack,
|
|
||||||
queryParameters: {
|
|
||||||
'act': 6,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'fid': fid,
|
|
||||||
'jsonp': 'jsonp',
|
|
||||||
're_src': 116,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': [],
|
|
||||||
'msg': '操作成功',
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/dialog.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
||||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/user/black.dart';
|
import 'package:PiliPlus/models/user/black.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_controller.dart';
|
import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
@@ -143,14 +144,14 @@ class BlackListController extends CommonController {
|
|||||||
title: '确定将 $name 移出黑名单?',
|
title: '确定将 $name 移出黑名单?',
|
||||||
onConfirm: () async {
|
onConfirm: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
var result = await BlackHttp.removeBlack(fid: mid);
|
var result = await VideoHttp.relationMod(mid: mid, act: 6, reSrc: 11);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
List list = (loadingState.value as Success).response;
|
List list = (loadingState.value as Success).response;
|
||||||
list.removeWhere((e) => e.mid == mid);
|
list.removeWhere((e) => e.mid == mid);
|
||||||
total.value = total.value - 1;
|
total.value = total.value - 1;
|
||||||
loadingState.value =
|
loadingState.value =
|
||||||
LoadingState.success(list.isNotEmpty ? list : <BlackListItem>[]);
|
LoadingState.success(list.isNotEmpty ? list : <BlackListItem>[]);
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast('操作成功');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user