Nenhuma Descrição

FLDataCenter.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // DataCenter.h
  3. // FirstLink
  4. //
  5. // Created by unicode on 14-9-15.
  6. // Copyright (c) 2014年 FirstLink. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "FLLocalStorage.h"
  10. #import <AFNetworking.h>
  11. @protocol FLNetworkDelegate <NSObject>
  12. @optional
  13. - (void)networkNotReachable;
  14. - (void)networkDidReceiveError:(NSError*)error identify:(int)identify header:(MSGHeader*)header;
  15. - (void)networkDidSuccessResponse:(NSDictionary*)response identify:(int)identify header:(MSGHeader*)header;
  16. - (void)networkDidSuccessResponse:(NSDictionary*)response identify:(int)identify header:(MSGHeader*)header userInfo:(NSDictionary *)userInfo;
  17. @end
  18. @interface FLDataCenter : NSObject
  19. +(FLDataCenter*)sharedDataCenter;
  20. #pragma mark - Network Block API
  21. - (void)POST:(NSString *)URLString
  22. parameters:(NSDictionary *)parameters
  23. success:(void (^)(MSGHeader *header, id responseObject))success
  24. failure:(void (^)(MSGHeader *header, NSError *error))failure;
  25. - (void)POSTData:(NSData*)data
  26. name:(NSString*)name
  27. fileName:(NSString*)fileName
  28. mimeType:(NSString*)miniType
  29. url:(NSURL*)url
  30. parameters:(NSDictionary *)parameters
  31. success:(void (^)(MSGHeader *header, id responseObject))success
  32. progress:(void (^)(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite))progress
  33. failure:(void (^)(MSGHeader *header, NSError *error))failure;
  34. #pragma mark - Network Delegate API
  35. - (void)POST:(NSString *)url
  36. para:(NSDictionary *)para
  37. identify:(int)identify
  38. delegate:(id<FLNetworkDelegate>)delegate;
  39. - (void)POST:(NSString *)url
  40. para:(NSDictionary *)para
  41. identify:(int)identify
  42. delegate:(id<FLNetworkDelegate>)delegate
  43. userInfo:(NSDictionary *)userInfo;
  44. #pragma mark - Local DataBase API
  45. + (FMDatabase *)defaultDatabase;
  46. @end