省钱达人

ZmzRequest.m 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // ZmzRequest.m
  3. // MZAFNetworking
  4. //
  5. // Created by CiHon-IOS2 on 16/9/30.
  6. // Copyright © 2016年 walkingzmz. All rights reserved.
  7. //
  8. #import "ZmzRequest.h"
  9. @interface ZmzRequest()
  10. @property(nonatomic,strong)ZmzAFNetworking *networking;
  11. @end
  12. @implementation ZmzRequest
  13. - (void)getDateWithParams:(NSDictionary *)params WithDataBlock:(sendData)sendBlock{
  14. self.networking = [[ZmzAFNetworking alloc]init];
  15. [self.networking requsetWithPath:@"/api/goods/goodlistByGid" withParams:params withCacheType:YBCacheTypeReturnCacheDataThenLoad withRequestType:NetworkPostType withResult:^(id responseObject, NSError *error,BOOL isCache) {
  16. if (!error) {
  17. NSDictionary *dataDic = (NSDictionary *)responseObject;
  18. sendBlock(dataDic,YES);
  19. }else{
  20. sendBlock(error,NO);
  21. }
  22. }];
  23. }
  24. -(void)getListDataBlock:(sendData)sendBlock{
  25. self.networking = [[ZmzAFNetworking alloc]init];
  26. [self.networking requsetWithPath:@"http://api2.pianke.me/pub/today" withParams:nil withCacheType:YBCacheTypeReturnCacheDataThenLoad withRequestType:NetworkGetType withResult:^(id responseObject, NSError *error,BOOL isCache) {
  27. if (!error) {
  28. NSDictionary *dic = (NSDictionary *)responseObject;
  29. sendBlock(dic,YES);
  30. }else{
  31. sendBlock(error,NO);
  32. }
  33. }];
  34. }
  35. @end