+(void)PostWithURL:(NSString *)url parameters:(id)params progress:(ProgressBlock)progress success:(SuccessBlock)success failure:(FailureBlock)failure
{
// 创建请求对象
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
// 设置超时时长
manager.requestSerializer.timeoutInterval = 30.0f;
[manager POST:[NSString stringWithFormat:@"%@%@",kURLMain, url] parameters:params progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
// 回调成功代码块
success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
#if DEBUG
// 取得错误信息
NSData *data = error.userInfo[@"com.alamofire.serialization.response.error.data"];
// 写入本地
[data writeToFile:ErrorPath atomically:NO];
#else
#endif
NSString *strError = [NSString stringWithFormat:@"错误接口---%@",error.userInfo[@"NSErrorFailingURLKey"]];
// 回调失败代码块
failure(strError);
}];
}