NetworkUtils.h 1.3 KB

123456789101112131415161718192021222324252627
  1. //
  2. // NetworkUtils.h
  3. // AntsContract
  4. //
  5. // Created by Ray on 12/26/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "const.h"
  10. typedef NSMutableDictionary*(^resultBlock)(NSMutableDictionary* result);
  11. typedef NSMutableDictionary*(^decryptBlock)(NSMutableDictionary* result);
  12. typedef void(^resultHandler)(NSMutableDictionary *result);
  13. typedef void(^progressHandler)(NSURLSessionTask *task,double progress);
  14. @interface NetworkUtils : NSObject
  15. +(bool) IsNetworkAvailable;
  16. +(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString*)file_path err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock;
  17. +(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code;
  18. + (NSURLSessionTask *)upload:(NSString *)filePath Params:(NSDictionary *)params ToHost:(NSString *)url Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id(^)(NSString *result))decrypt;
  19. + (NSURLSessionTask *)upload:(NSData *)filedata FileName:(NSString*) filename Params:(NSDictionary *)params ToHost:(NSString *)urlString Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id (^)(NSString *))decrypt;
  20. @end