41 lines
1.3 KiB
Dart
41 lines
1.3 KiB
Dart
|
|
import 'package:skywood/global/request/api_const.dart';
|
|
import 'package:skywood/global/request/app_request.dart';
|
|
import 'package:skywood/global/tool/sky_log.dart';
|
|
import 'package:skywood/utils/models/drama/skywood_category.dart';
|
|
import 'package:skywood/utils/models/drama/skywood_home.dart';
|
|
|
|
class PlayClient {
|
|
|
|
static Future<List<SkywoodHome>> getHomeData() {
|
|
return AppRequest.get(ApiStringPlay.getHomeModules).then((value) {
|
|
if (value.isSuccess) {
|
|
List? list = value.data['data']['list'];
|
|
List<SkywoodHome> homeList = [];
|
|
if (list != null) {
|
|
homeList = list.map((e) => SkywoodHome.fromJson(e)).toList();
|
|
}
|
|
return homeList;
|
|
}
|
|
return [];
|
|
});
|
|
}
|
|
|
|
static Future<List<SkywoodCategory>> getCategoriesList() {
|
|
return AppRequest.get(ApiStringPlay.getCategoriesList).then((value) {
|
|
SkyLog.print('vvvvv: ${value.data}');
|
|
if (!value.isSuccess) return [];
|
|
|
|
Map<String, dynamic> data = value.data['data'];
|
|
List? list = data['list'];
|
|
|
|
List<SkywoodCategory> categoryList = [];
|
|
if (list != null) {
|
|
// id 28 不显示,删除
|
|
categoryList = list.map((e) => SkywoodCategory.fromJson(e)).toList();
|
|
categoryList.removeWhere((element) => element.id == 28);
|
|
}
|
|
return categoryList;
|
|
});
|
|
}
|
|
} |