122 lines
3.5 KiB
Dart
122 lines
3.5 KiB
Dart
import 'dart:convert';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:rogapp/utils/const.dart';
|
|
|
|
|
|
class PerfectureService{
|
|
|
|
static Future<List<dynamic>?> loadPerfectures() async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/perf_main/';
|
|
print('@@@@@@+++ perfeture_service LOADPERFECTURES - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/subperfinmain/?area=' + area;
|
|
print('@@@@@@+++ perfeture_service LOADSUBPERFECTURES - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
|
|
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/mainperfext/?perf=' + id;
|
|
print('@@@@@@+++ perfeture_service GETMAINPERFEXT - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
|
|
print('@@@@@@+++ perfeture_service LOADGIFUAREAS - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
static Future<List<dynamic>?> loadCustomAreas() async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/customareanames';
|
|
print('@@@@@@+++ perfeture_service LOADCUSTOMAREAS - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
|
|
static Future<List<dynamic>?> getSubExt(String id) async {
|
|
List<dynamic> perfs = [];
|
|
String server_url = ConstValues.currentServer();
|
|
String url = '${server_url}/api/perfext/?sub_perf=' + id;
|
|
print('@@@@@@+++ perfeture_service GETSUBEXT - GET, @@@@@@ ${url}');
|
|
final response = await http.get(Uri.parse(url),
|
|
headers: <String, String>{
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
},
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
|
}
|
|
return perfs;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|