1234567891011121314151617181920212223242526272829303132333435363738 |
- import 'dart:convert';
- import 'package:dio/dio.dart';
- import 'package:hengyi/config/config.dart';
- import 'package:hengyi/data/base_model_entity.dart';
- import 'package:hengyi/data/continent_entity.dart';
- import 'package:hengyi/data/country_detail_entity.dart';
- import 'package:hengyi/data/country_entity.dart';
- class NetworkUtil {
- ///获取几大洲列表
- Future<List<ContinentEntity>> getContinentList() async {
- var response =
- await Dio().get("${AppConfig.baseUrl}api/home/visa/part/list");
- var data = json.decode(response.toString());
- return BaseModelEntity<List<ContinentEntity>>.fromJson(data).data;
- }
- ///获取每个洲对应国家列表
- Future<List<CountryEntity>> getCountryList(int id) async {
- var queryParams = {"part_id": id};
- var response = await Dio().get(
- "${AppConfig.baseUrl}/api/home/visa/country/list",
- queryParameters: queryParams);
- var data = json.decode(response.toString());
- return BaseModelEntity<List<CountryEntity>>.fromJson(data).data;
- }
- ///获取国家详情
- Future<CountryDetailEntity> getCountryDetail(int id) async {
- var queryParams = {"country_id": id};
- var response = await Dio().get(
- "${AppConfig.baseUrl}api/home/visa/country/detail",
- queryParameters: queryParams);
- var data = json.decode(response.toString());
- return BaseModelEntity<CountryDetailEntity>.fromJson(data).data;
- }
- }
|