123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // ASUserModel.m
- // Asteria
- //
- // Created by iOS on 2023/11/27.
- //
- #import "ASUserModel.h"
- @implementation ASUserModel
- + (NSDictionary *)mj_replacedKeyFromPropertyName {
- return @{
- @"Id": @"id",
- @"is_subscribed": @"extension_attributes.is_subscribed",
- };
- }
- + (NSDictionary *)mj_objectClassInArray{
-
- return @{
-
- @"addresses" : [ASAddressModel class]
-
- };
-
-
-
- }
- @end
- @implementation ASAddressModel
- + (NSDictionary *)mj_replacedKeyFromPropertyName {
- return @{
- @"Id": @"id",
- @"title": @"extension_attributes.title",
- @"country": @"extension_attributes.country",
- @"addressType": @"extension_attributes.address_type",
- };
- }
- + (ASAddressModel *)defualtData {
- ASAddressModel *m = [ASAddressModel new];
- m.title = @"";
- m.firstname = @"";
- m.lastname = @"";
- m.street = @[@""];
- m.postcode = @"";
- m.city = @"";
- // m.region = @"";
- ASAddressReginModel *re = [ASAddressReginModel new];
- re.region = @"";
- re.region_code = @"";
- re.region_id = @"";
- m.region = re;
- m.region_id = @"";
- m.telephone = @"";
- m.country = @"Unites States";
- m.country_id = @"US";
-
- return m;
- }
- - (NSDictionary *)params {
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- dic[@"id"] = self.Id;
- dic[@"firstname"] = self.firstname;
- dic[@"lastname"] = self.lastname;
- NSString *stre = [self.street componentsJoinedByString:@","];
- dic[@"street[]"] = stre;
- dic[@"postcode"] = self.postcode;
- dic[@"city"] = self.city;
- dic[@"country_id"] = self.country_id;
- dic[@"region_id"] = self.region_id;
- dic[@"region"] = self.region.region;
- dic[@"telephone"] = self.telephone;
- dic[@"default_billing"] = @"0";
- dic[@"default_shipping"] = @"0";
- if (self.addressType == 3) {
- dic[@"default_billing"] = @"1";
- dic[@"default_shipping"] = @"1";
- }
- if (self.addressType == 2) {
- dic[@"default_billing"] = @"0";
- dic[@"default_shipping"] = @"1";
- }
- if (self.addressType == 1) {
- dic[@"default_billing"] = @"1";
- dic[@"default_shipping"] = @"0";
- }
-
- return dic;
- }
- @end
- @implementation ASAddressReginModel
- @end
|