|
@@ -4,9 +4,10 @@ import 'dart:io';
|
|
|
import 'package:dio/dio.dart';
|
|
|
import '../config/service_url.dart';
|
|
|
|
|
|
-Future<Response> getCategories() => request(servicePath['getCategory']);
|
|
|
-
|
|
|
-Future<Response> getMallGoods(String categoryId, String categorySubId, int page) => request(servicePath['getMallGoods'],
|
|
|
+//获得火爆专区商品的方法
|
|
|
+Future<Response> getCategories() async => request(servicePath['getCategory']);
|
|
|
+//获得商城首页信息的方法
|
|
|
+Future<Response> getMallGoods(String categoryId, String categorySubId, int page) async=> request(servicePath['getMallGoods'],
|
|
|
formData:
|
|
|
categorySubId != null ? {'categoryId': categoryId, 'categorySubId': categorySubId, 'page': page} : {'categoryId': categoryId, 'page': page});
|
|
|
|
|
@@ -23,7 +24,7 @@ Future<Response> request(String url, {Map formData}) async {
|
|
|
if (response.statusCode == 200) {
|
|
|
return response;
|
|
|
} else {
|
|
|
- throw Exception('Net Error');
|
|
|
+ throw Exception('后端接口出现异常,请检测代码和服务器情况.........');
|
|
|
}
|
|
|
} catch (e) {
|
|
|
print('ERROR: $e');
|