This commit is contained in:
唐明明
2022-05-26 11:31:11 +08:00
parent 84b6575e95
commit 4a635f3570
552 changed files with 23062 additions and 1 deletions

22
lib/https/auth_api.dart Normal file
View File

@@ -0,0 +1,22 @@
import 'dart:convert';
import 'package:http/http.dart' as Http;
class HttpApi {
final String BaseApi = 'http://api.gl.shangkelian.cn/api/';
/// post
ApiPost(String api, {Map? body}) async {
String apiUrl = BaseApi + api;
var url = Uri.parse(apiUrl);
var response = await Http.post(url, body: body);
int newCode = response.statusCode;
Map data = jsonDecode(response.body);
if (newCode == 200) {
print('请求成功返回值$data');
return data;
}
// print(apiUrl);
// print('可选参数${body}');
}
}