feat: 调整设置,支持导入导出,代码优化

This commit is contained in:
orz12
2024-04-27 02:05:50 +08:00
parent a4d3713b05
commit ea8f44f4da
41 changed files with 882 additions and 424 deletions

View File

@@ -28,7 +28,6 @@ class DynamicsHttp {
'data': DynamicsDataModel.fromJson(res.data['data']),
};
} catch (err) {
print(err);
return {
'status': false,
'data': [],

View File

@@ -105,7 +105,7 @@ class Request {
String jsonData = json.encode({
'3064': 1,
'39c8': '${spmPrefix}.fp.risk',
'39c8': '$spmPrefix.fp.risk',
'3c43': {
'adca': 'Linux',
'bfe9': rand_png_end.substring(rand_png_end.length - 50),
@@ -138,9 +138,9 @@ class Request {
enableSystemProxy = setting.get(SettingBoxKey.enableSystemProxy,
defaultValue: false) as bool;
systemProxyHost =
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
systemProxyPort =
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
dio = Dio(options);

View File

@@ -89,8 +89,10 @@ class SearchHttp {
try {
switch (searchType) {
case SearchType.video:
List<int> blackMidsList =
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
List<int> blackMidsList = setting
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
.map<int>((i) => i as int)
.toList();
for (var i in res.data['data']['result']) {
// 屏蔽推广和拉黑用户
i['available'] = !blackMidsList.contains(i['mid']);

View File

@@ -45,8 +45,10 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<RecVideoItemModel> list = [];
List<int> blackMidsList =
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
List<int> blackMidsList = setting
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['item']) {
//过滤掉live与ad以及拉黑用户
if (i['goto'] == 'av' &&
@@ -91,8 +93,10 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<RecVideoItemAppModel> list = [];
List<int> blackMidsList =
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
List<int> blackMidsList = setting
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['items']) {
// 屏蔽推广和拉黑用户
if (i['card_goto'] != 'ad_av' &&
@@ -123,8 +127,10 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList =
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
List<int> blackMidsList = setting
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['list']) {
if (!blackMidsList.contains(i['owner']['mid'])) {
list.add(HotVideoItemModel.fromJson(i));
@@ -377,12 +383,12 @@ class VideoHttp {
}
static Future replyDel({
required int type,//replyType
required int type, //replyType
required int oid,
required int rpid,
}) async {
var res = await Request().post(Api.replyDel, queryParameters: {
'type': type,//type.index
'type': type, //type.index
'oid': oid,
'rpid': rpid,
'csrf': await Request.getCsrf(),
@@ -615,8 +621,10 @@ class VideoHttp {
var res = await Request().get(rankApi);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList =
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
List<int> blackMidsList = setting
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
.map<int>((e) => e as int)
.toList();
for (var i in res.data['data']['list']) {
if (!blackMidsList.contains(i['owner']['mid'])) {
list.add(HotVideoItemModel.fromJson(i));