123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- //
- // ModelWallet.m
- //
- // Created by on 2021/8/10
- // Copyright (c) 2021 __MyCompanyName__. All rights reserved.
- //
- #import "ModelWallet.h"
- NSString *const kModelWalletProfitBalance = @"profitBalance";
- NSString *const kModelWalletAccount = @"account";
- NSString *const kModelWalletMerchantNum = @"merchantNum";
- NSString *const kModelWalletRecCode = @"recCode";
- NSString *const kModelWalletCardHoldFront = @"cardHoldFront";
- NSString *const kModelWalletAgentCode = @"agentCode";
- NSString *const kModelWalletGesturePassword = @"gesturePassword";
- NSString *const kModelWalletNickName = @"nickName";
- NSString *const kModelWalletProfitPos = @"profitPos";
- NSString *const kModelWalletHeadPortrait = @"headPortrait";
- NSString *const kModelWalletRealName = @"realName";
- NSString *const kModelWalletIsAuthentication = @"isAuthentication";
- NSString *const kModelWalletUnallocatedBalance = @"UnallocatedBalance";
- NSString *const kModelWalletCardFront = @"cardFront";
- NSString *const kModelWalletUserLevel = @"userLevel";
- NSString *const kModelWalletId = @"id";
- NSString *const kModelWalletProfitActivation = @"profitActivation";
- NSString *const kModelWalletProfitCard = @"profitCard";
- NSString *const kModelWalletProfitIntegral = @"profitIntegral";
- NSString *const kModelWalletCardReverse = @"cardReverse";
- NSString *const kModelWalletPhone = @"phone";
- NSString *const kModelWalletProfitTotal = @"profitTotal";
- NSString *const kModelWalletTransactionTotal = @"transactionTotal";
- NSString *const kModelWalletCardNo = @"cardNo";
- NSString *const kModelWalletAgentNum = @"agentNum";
- NSString *const kModelWalletAuditTime = @"auditTime";
- NSString *const kModelWalletRemark = @"remark";
- NSString *const kModelWalletCardHoldReverse = @"cardHoldReverse";
- @interface ModelWallet ()
- - (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
- @end
- @implementation ModelWallet
- @synthesize profitBalance = _profitBalance;
- @synthesize account = _account;
- @synthesize merchantNum = _merchantNum;
- @synthesize recCode = _recCode;
- @synthesize cardHoldFront = _cardHoldFront;
- @synthesize agentCode = _agentCode;
- @synthesize gesturePassword = _gesturePassword;
- @synthesize nickName = _nickName;
- @synthesize profitPos = _profitPos;
- @synthesize headPortrait = _headPortrait;
- @synthesize realName = _realName;
- @synthesize isAuthentication = _isAuthentication;
- @synthesize unallocatedBalance = _unallocatedBalance;
- @synthesize cardFront = _cardFront;
- @synthesize userLevel = _userLevel;
- @synthesize internalBaseClassIdentifier = _internalBaseClassIdentifier;
- @synthesize profitActivation = _profitActivation;
- @synthesize profitCard = _profitCard;
- @synthesize profitIntegral = _profitIntegral;
- @synthesize cardReverse = _cardReverse;
- @synthesize phone = _phone;
- @synthesize profitTotal = _profitTotal;
- @synthesize transactionTotal = _transactionTotal;
- @synthesize cardNo = _cardNo;
- @synthesize agentNum = _agentNum;
- @synthesize auditTime = _auditTime;
- @synthesize remark = _remark;
- @synthesize cardHoldReverse = _cardHoldReverse;
- + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict {
- return [[self alloc] initWithDictionary:dict];
- }
- - (instancetype)initWithDictionary:(NSDictionary *)dict {
- self = [super init];
-
- // This check serves to make sure that a non-NSDictionary object
- // passed into the model class doesn't break the parsing.
- if (self && [dict isKindOfClass:[NSDictionary class]]) {
- self.profitBalance = [[self objectOrNilForKey:kModelWalletProfitBalance fromDictionary:dict] doubleValue];
- self.account = [self objectOrNilForKey:kModelWalletAccount fromDictionary:dict];
- self.merchantNum = [[self objectOrNilForKey:kModelWalletMerchantNum fromDictionary:dict] doubleValue];
- self.recCode = [self objectOrNilForKey:kModelWalletRecCode fromDictionary:dict];
- self.cardHoldFront = [self objectOrNilForKey:kModelWalletCardHoldFront fromDictionary:dict];
- self.agentCode = [self objectOrNilForKey:kModelWalletAgentCode fromDictionary:dict];
- self.gesturePassword = [self objectOrNilForKey:kModelWalletGesturePassword fromDictionary:dict];
- self.nickName = [self objectOrNilForKey:kModelWalletNickName fromDictionary:dict];
- self.profitPos = [[self objectOrNilForKey:kModelWalletProfitPos fromDictionary:dict] doubleValue];
- self.headPortrait = [self objectOrNilForKey:kModelWalletHeadPortrait fromDictionary:dict];
- self.realName = [self objectOrNilForKey:kModelWalletRealName fromDictionary:dict];
- self.isAuthentication = [[self objectOrNilForKey:kModelWalletIsAuthentication fromDictionary:dict] doubleValue];
- self.unallocatedBalance = [[self objectOrNilForKey:kModelWalletUnallocatedBalance fromDictionary:dict] doubleValue];
- self.cardFront = [self objectOrNilForKey:kModelWalletCardFront fromDictionary:dict];
- self.userLevel = [[self objectOrNilForKey:kModelWalletUserLevel fromDictionary:dict] doubleValue];
- self.internalBaseClassIdentifier = [self objectOrNilForKey:kModelWalletId fromDictionary:dict];
- self.profitActivation = [[self objectOrNilForKey:kModelWalletProfitActivation fromDictionary:dict] doubleValue];
- self.profitCard = [[self objectOrNilForKey:kModelWalletProfitCard fromDictionary:dict] doubleValue];
- self.profitIntegral = [[self objectOrNilForKey:kModelWalletProfitIntegral fromDictionary:dict] doubleValue];
- self.cardReverse = [self objectOrNilForKey:kModelWalletCardReverse fromDictionary:dict];
- self.phone = [self objectOrNilForKey:kModelWalletPhone fromDictionary:dict];
- self.profitTotal = [[self objectOrNilForKey:kModelWalletProfitTotal fromDictionary:dict] doubleValue];
- self.transactionTotal = [[self objectOrNilForKey:kModelWalletTransactionTotal fromDictionary:dict] doubleValue];
- self.cardNo = [self objectOrNilForKey:kModelWalletCardNo fromDictionary:dict];
- self.agentNum = [[self objectOrNilForKey:kModelWalletAgentNum fromDictionary:dict] doubleValue];
- self.auditTime = [self objectOrNilForKey:kModelWalletAuditTime fromDictionary:dict];
- self.remark = [self objectOrNilForKey:kModelWalletRemark fromDictionary:dict];
- self.cardHoldReverse = [self objectOrNilForKey:kModelWalletCardHoldReverse fromDictionary:dict];
- }
-
- return self;
-
- }
- - (NSDictionary *)dictionaryRepresentation {
- NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitBalance] forKey:kModelWalletProfitBalance];
- [mutableDict setValue:self.account forKey:kModelWalletAccount];
- [mutableDict setValue:[NSNumber numberWithDouble:self.merchantNum] forKey:kModelWalletMerchantNum];
- [mutableDict setValue:self.recCode forKey:kModelWalletRecCode];
- [mutableDict setValue:self.cardHoldFront forKey:kModelWalletCardHoldFront];
- [mutableDict setValue:self.agentCode forKey:kModelWalletAgentCode];
- [mutableDict setValue:self.gesturePassword forKey:kModelWalletGesturePassword];
- [mutableDict setValue:self.nickName forKey:kModelWalletNickName];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitPos] forKey:kModelWalletProfitPos];
- [mutableDict setValue:self.headPortrait forKey:kModelWalletHeadPortrait];
- [mutableDict setValue:self.realName forKey:kModelWalletRealName];
- [mutableDict setValue:[NSNumber numberWithDouble:self.isAuthentication] forKey:kModelWalletIsAuthentication];
- [mutableDict setValue:[NSNumber numberWithDouble:self.unallocatedBalance] forKey:kModelWalletUnallocatedBalance];
- [mutableDict setValue:self.cardFront forKey:kModelWalletCardFront];
- [mutableDict setValue:[NSNumber numberWithDouble:self.userLevel] forKey:kModelWalletUserLevel];
- [mutableDict setValue:self.internalBaseClassIdentifier forKey:kModelWalletId];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitActivation] forKey:kModelWalletProfitActivation];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitCard] forKey:kModelWalletProfitCard];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitIntegral] forKey:kModelWalletProfitIntegral];
- [mutableDict setValue:self.cardReverse forKey:kModelWalletCardReverse];
- [mutableDict setValue:self.phone forKey:kModelWalletPhone];
- [mutableDict setValue:[NSNumber numberWithDouble:self.profitTotal] forKey:kModelWalletProfitTotal];
- [mutableDict setValue:[NSNumber numberWithDouble:self.transactionTotal] forKey:kModelWalletTransactionTotal];
- [mutableDict setValue:self.cardNo forKey:kModelWalletCardNo];
- [mutableDict setValue:[NSNumber numberWithDouble:self.agentNum] forKey:kModelWalletAgentNum];
- [mutableDict setValue:self.auditTime forKey:kModelWalletAuditTime];
- [mutableDict setValue:self.remark forKey:kModelWalletRemark];
- [mutableDict setValue:self.cardHoldReverse forKey:kModelWalletCardHoldReverse];
- return [NSDictionary dictionaryWithDictionary:mutableDict];
- }
- - (NSString *)description {
- return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
- }
- #pragma mark - Helper Method
- - (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict {
- id object = [dict objectForKey:aKey];
- return [object isEqual:[NSNull null]] ? nil : object;
- }
- @end
|