Ei kuvausta

FKAddressDetailRequest.m 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // FKAddressDetailRequest.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/12/7.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKAddressDetailRequest.h"
  9. #import "ShipAddress.h"
  10. @implementation FKAddressDetailRequest
  11. + (void)requestAddAddress:(int)identify
  12. address:(ShipAddress *)address
  13. deleagate:(id<FLNetworkDelegate>)delegate {
  14. if (!address.province || !address.city || !address.district || !address.address || !address.receiver || !address.receiverPhone) {
  15. return;
  16. }
  17. NSArray *keys = @[@"province", @"city", @"district", @"address", @"receiver", @"receiver_phone"];
  18. NSArray *values = @[address.province, address.city, address.district, address.address, address.receiver, address.receiverPhone];
  19. NSString *itemJSONString = [FLRequestHelper JSONStringWithKeys:keys
  20. values:values];
  21. NSMutableDictionary *para = [NSMutableDictionary dictionary];
  22. [para setValue:itemJSONString forKey:@"user_address_info_json"];
  23. [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  24. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_address_info/create_user_address_info.json", [[FKServerUtil sharedInstance] apiServer]];
  25. [[FLDataCenter sharedDataCenter] POST:URLString
  26. para:para
  27. identify:identify
  28. delegate:delegate];
  29. }
  30. + (void)requestModifyAddress:(int)identify
  31. address:(ShipAddress *)address
  32. deleagate:(id<FLNetworkDelegate>)delegate {
  33. if (!address.addressID || !address.province || !address.city || !address.district || !address.address || !address.receiver || !address.receiverPhone) {
  34. return;
  35. }
  36. NSArray *keys = @[@"id", @"province", @"city", @"district", @"address", @"zip", @"is_default", @"receiver", @"receiver_phone"];
  37. NSArray *values = @[address.addressID, address.province, address.city, address.district, address.address, [FLStringHelper replaceNilWithEmpty:address.zip], [FLStringHelper replaceNilWithEmpty:address.isDefault], address.receiver, address.receiverPhone];
  38. NSString *itemJSONString = [FLRequestHelper JSONStringWithKeys:keys
  39. values:values];
  40. NSMutableDictionary *para = [NSMutableDictionary dictionary];
  41. [para setValue:itemJSONString forKey:@"user_address_info_json"];
  42. [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  43. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_address_info/modify_user_address_info.json", [[FKServerUtil sharedInstance] apiServer]];
  44. [[FLDataCenter sharedDataCenter] POST:URLString
  45. para:para
  46. identify:identify
  47. delegate:delegate];
  48. }
  49. @end