1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //
- // FKAddressDetailRequest.m
- // FirstLink
- //
- // Created by ascii on 15/12/7.
- // Copyright © 2015年 FirstLink. All rights reserved.
- //
- #import "FKAddressDetailRequest.h"
- #import "ShipAddress.h"
- @implementation FKAddressDetailRequest
- + (void)requestAddAddress:(int)identify
- address:(ShipAddress *)address
- deleagate:(id<FLNetworkDelegate>)delegate {
- if (!address.province || !address.city || !address.district || !address.address || !address.receiver || !address.receiverPhone) {
- return;
- }
-
- NSArray *keys = @[@"province", @"city", @"district", @"address", @"receiver", @"receiver_phone"];
- NSArray *values = @[address.province, address.city, address.district, address.address, address.receiver, address.receiverPhone];
- NSString *itemJSONString = [FLRequestHelper JSONStringWithKeys:keys
- values:values];
-
- NSMutableDictionary *para = [NSMutableDictionary dictionary];
- [para setValue:itemJSONString forKey:@"user_address_info_json"];
- [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_address_info/create_user_address_info.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:para
- identify:identify
- delegate:delegate];
- }
- + (void)requestModifyAddress:(int)identify
- address:(ShipAddress *)address
- deleagate:(id<FLNetworkDelegate>)delegate {
- if (!address.addressID || !address.province || !address.city || !address.district || !address.address || !address.receiver || !address.receiverPhone) {
- return;
- }
-
- NSArray *keys = @[@"id", @"province", @"city", @"district", @"address", @"zip", @"is_default", @"receiver", @"receiver_phone"];
- NSArray *values = @[address.addressID, address.province, address.city, address.district, address.address, [FLStringHelper replaceNilWithEmpty:address.zip], [FLStringHelper replaceNilWithEmpty:address.isDefault], address.receiver, address.receiverPhone];
- NSString *itemJSONString = [FLRequestHelper JSONStringWithKeys:keys
- values:values];
-
- NSMutableDictionary *para = [NSMutableDictionary dictionary];
- [para setValue:itemJSONString forKey:@"user_address_info_json"];
- [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_address_info/modify_user_address_info.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:para
- identify:identify
- delegate:delegate];
- }
- @end
|