|
|
@@ -357,6 +357,28 @@ class NetUtil { |
|
|
|
return EncodeUtil.generateMd5(path + map.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
// 七牛云文件上传 |
|
|
|
static Future uploadFile(String url, File file, |
|
|
|
{String method = 'POST', |
|
|
|
Map<String, dynamic> params, |
|
|
|
OnSuccess onSuccess, |
|
|
|
OnError onError}) async { |
|
|
|
if (params == null) { |
|
|
|
params = {}; |
|
|
|
} |
|
|
|
Dio dio = Dio(BaseOptions( |
|
|
|
method: "post", |
|
|
|
connectTimeout: 15000, |
|
|
|
receiveTimeout: 15000, |
|
|
|
contentType: Headers.jsonContentType, |
|
|
|
followRedirects: true, |
|
|
|
)); |
|
|
|
|
|
|
|
params['file'] = await MultipartFile.fromFile(file.path); |
|
|
|
FormData format = FormData.fromMap(params); |
|
|
|
return dio.request(url, data: format, options: Options(method: method)); |
|
|
|
} |
|
|
|
|
|
|
|
/// 签名 |
|
|
|
static String signWithArray(List<String> params) { |
|
|
|
// 字母升序 |
|
|
|