This commit is contained in:
Yao
2024-12-20 17:49:45 +08:00
parent 86b0363ce1
commit 654d456c7d
7011 changed files with 1705926 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
//
// BankModelData.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BankModelData : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *bankCode;
@property (nonatomic, assign) NSInteger identifier;
@property (nonatomic, strong) NSString *bankName;
@property (nonatomic, strong) NSString *country;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,94 @@
//
// BankModelData.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "BankModelData.h"
NSString *const kBankModelDataBankCode = @"bankCode";
NSString *const kBankModelDataId = @"id";
NSString *const kBankModelDataBankName = @"bankName";
NSString *const kBankModelDataCountry = @"country";
@interface BankModelData ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation BankModelData
@synthesize bankCode = _bankCode;
@synthesize identifier = _identifier;
@synthesize bankName = _bankName;
@synthesize country = _country;
+ (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.bankCode = [self objectOrNilForKey:kBankModelDataBankCode fromDictionary:dict];
self.identifier = [[self objectOrNilForKey:kBankModelDataId fromDictionary:dict] intValue];
self.bankName = [self objectOrNilForKey:kBankModelDataBankName fromDictionary:dict];
self.country = [self objectOrNilForKey:kBankModelDataCountry fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.bankCode forKey:kBankModelDataBankCode];
[mutableDict setValue:[NSNumber numberWithInteger:self.identifier] forKey:kBankModelDataId];
[mutableDict setValue:self.bankName forKey:kBankModelDataBankName];
[mutableDict setValue:self.country forKey:kBankModelDataCountry];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.bankCode = [aDecoder decodeObjectForKey:kBankModelDataBankCode];
self.identifier = [aDecoder decodeIntegerForKey:kBankModelDataId];
self.bankName = [aDecoder decodeObjectForKey:kBankModelDataBankName];
self.country = [aDecoder decodeObjectForKey:kBankModelDataCountry];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:_bankCode forKey:kBankModelDataBankCode];
[aCoder encodeInteger:_identifier forKey:kBankModelDataId];
[aCoder encodeObject:_bankName forKey:kBankModelDataBankName];
[aCoder encodeObject:_country forKey:kBankModelDataCountry];
}
- (id)copyWithZone:(NSZone *)zone {
BankModelData *copy = [[BankModelData alloc] init];
if (copy) {
copy.bankCode = [self.bankCode copyWithZone:zone];
copy.identifier = self.identifier;
copy.bankName = [self.bankName copyWithZone:zone];
copy.country = [self.country copyWithZone:zone];
}
return copy;
}
@end

View File

@@ -0,0 +1,19 @@
//
// BankModelDataModel.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BankModelDataModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray *data;
@property (nonatomic, assign) NSInteger code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,105 @@
//
// BankModelDataModel.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "BankModelDataModel.h"
#import "BankModelData.h"
NSString *const kBankModelDataModelData = @"data";
NSString *const kBankModelDataModelCode = @"code";
@interface BankModelDataModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation BankModelDataModel
@synthesize data = _data;
@synthesize code = _code;
+ (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]]) {
NSObject *receivedBankModelData = [dict objectForKey:kBankModelDataModelData];
NSMutableArray *parsedBankModelData = [NSMutableArray array];
if ([receivedBankModelData isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedBankModelData) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedBankModelData addObject:[BankModelData modelObjectWithDictionary:item]];
}
}
} else if ([receivedBankModelData isKindOfClass:[NSDictionary class]]) {
[parsedBankModelData addObject:[BankModelData modelObjectWithDictionary:(NSDictionary *)receivedBankModelData]];
}
self.data = [NSArray arrayWithArray:parsedBankModelData];
self.code = [[self objectOrNilForKey:kBankModelDataModelCode fromDictionary:dict] intValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
NSMutableArray *tempArrayForData = [NSMutableArray array];
for (NSObject *subArrayObject in self.data) {
if ([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForData addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForData addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForData] forKey:kBankModelDataModelData];
[mutableDict setValue:[NSNumber numberWithInteger:self.code] forKey:kBankModelDataModelCode];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.data = [aDecoder decodeObjectForKey:kBankModelDataModelData];
self.code = [aDecoder decodeIntegerForKey:kBankModelDataModelCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:_data forKey:kBankModelDataModelData];
[aCoder encodeInteger:_code forKey:kBankModelDataModelCode];
}
- (id)copyWithZone:(NSZone *)zone {
BankModelDataModel *copy = [[BankModelDataModel alloc] init];
if (copy) {
copy.data = [self.data copyWithZone:zone];
copy.code = self.code;
}
return copy;
}
@end

16
ShenQi/Model/DataModels.h Normal file
View File

@@ -0,0 +1,16 @@
//
// DataModels.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "BankModelData.h"
#import "BankModelDataModel.h"
#import "InviteCodeModelDataModel.h"
#import "InviteCodeModelData.h"
#import "WithdrawRecordDataModel.h"
#import "WithdrawRecordData.h"
#import "WithdrawRecordList.h"

View File

@@ -0,0 +1,29 @@
//
// InviteCodeModelData.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface InviteCodeModelData : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) NSInteger identifier;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *bankName;
@property (nonatomic, strong) NSString *inviteCode;
@property (nonatomic, assign) NSInteger inviteNum;
@property (nonatomic, assign) CGFloat balance;
@property (nonatomic, strong) NSString *bankNo;
@property (nonatomic, assign) NSInteger userId;
@property (nonatomic, assign) CGFloat income;
@property (nonatomic, assign) NSInteger bankId;
@property (nonatomic, assign) NSInteger status;
@property (nonatomic, strong) NSString *deviceCode;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,150 @@
//
// InviteCodeModelData.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "InviteCodeModelData.h"
NSString *const kInviteCodeModelDataId = @"id";
NSString *const kInviteCodeModelDataName = @"name";
NSString *const kInviteCodeModelDataBankName = @"bankName";
NSString *const kInviteCodeModelDataInviteCode = @"inviteCode";
NSString *const kInviteCodeModelDataInviteNum = @"inviteNum";
NSString *const kInviteCodeModelDataBalance = @"balance";
NSString *const kInviteCodeModelDataBankNo = @"bankNo";
NSString *const kInviteCodeModelDataUserId = @"userId";
NSString *const kInviteCodeModelDataIncome = @"income";
NSString *const kInviteCodeModelDataBankId = @"bankId";
NSString *const kInviteCodeModelDataStatus = @"status";
NSString *const kInviteCodeModelDataDeviceCode = @"deviceCode";
@interface InviteCodeModelData ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation InviteCodeModelData
@synthesize identifier = _identifier;
@synthesize name = _name;
@synthesize bankName = _bankName;
@synthesize inviteCode = _inviteCode;
@synthesize inviteNum = _inviteNum;
@synthesize balance = _balance;
@synthesize bankNo = _bankNo;
@synthesize userId = _userId;
@synthesize income = _income;
@synthesize bankId = _bankId;
@synthesize status = _status;
@synthesize deviceCode = _deviceCode;
+ (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.identifier = [[self objectOrNilForKey:kInviteCodeModelDataId fromDictionary:dict] intValue];
self.name = [self objectOrNilForKey:kInviteCodeModelDataName fromDictionary:dict];
self.bankName = [self objectOrNilForKey:kInviteCodeModelDataBankName fromDictionary:dict];
self.inviteCode = [self objectOrNilForKey:kInviteCodeModelDataInviteCode fromDictionary:dict];
self.inviteNum = [[self objectOrNilForKey:kInviteCodeModelDataInviteNum fromDictionary:dict] intValue];
self.balance = [[self objectOrNilForKey:kInviteCodeModelDataBalance fromDictionary:dict] doubleValue];
self.bankNo = [self objectOrNilForKey:kInviteCodeModelDataBankNo fromDictionary:dict];
self.userId = [[self objectOrNilForKey:kInviteCodeModelDataUserId fromDictionary:dict] intValue];
self.income = [[self objectOrNilForKey:kInviteCodeModelDataIncome fromDictionary:dict] doubleValue];
self.bankId = [[self objectOrNilForKey:kInviteCodeModelDataBankId fromDictionary:dict] intValue];
self.status = [[self objectOrNilForKey:kInviteCodeModelDataStatus fromDictionary:dict] intValue];
self.deviceCode = [self objectOrNilForKey:kInviteCodeModelDataDeviceCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithInteger:self.identifier] forKey:kInviteCodeModelDataId];
[mutableDict setValue:self.name forKey:kInviteCodeModelDataName];
[mutableDict setValue:self.bankName forKey:kInviteCodeModelDataBankName];
[mutableDict setValue:self.inviteCode forKey:kInviteCodeModelDataInviteCode];
[mutableDict setValue:[NSNumber numberWithInteger:self.inviteNum] forKey:kInviteCodeModelDataInviteNum];
[mutableDict setValue:[NSNumber numberWithDouble:self.balance] forKey:kInviteCodeModelDataBalance];
[mutableDict setValue:self.bankNo forKey:kInviteCodeModelDataBankNo];
[mutableDict setValue:[NSNumber numberWithInteger:self.userId] forKey:kInviteCodeModelDataUserId];
[mutableDict setValue:[NSNumber numberWithDouble:self.income] forKey:kInviteCodeModelDataIncome];
[mutableDict setValue:[NSNumber numberWithInteger:self.bankId] forKey:kInviteCodeModelDataBankId];
[mutableDict setValue:[NSNumber numberWithInteger:self.status] forKey:kInviteCodeModelDataStatus];
[mutableDict setValue:self.deviceCode forKey:kInviteCodeModelDataDeviceCode];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.identifier = [aDecoder decodeIntegerForKey:kInviteCodeModelDataId];
self.name = [aDecoder decodeObjectForKey:kInviteCodeModelDataName];
self.bankName = [aDecoder decodeObjectForKey:kInviteCodeModelDataBankName];
self.inviteCode = [aDecoder decodeObjectForKey:kInviteCodeModelDataInviteCode];
self.inviteNum = [aDecoder decodeIntegerForKey:kInviteCodeModelDataInviteNum];
self.balance = [aDecoder decodeDoubleForKey:kInviteCodeModelDataBalance];
self.bankNo = [aDecoder decodeObjectForKey:kInviteCodeModelDataBankNo];
self.userId = [aDecoder decodeIntegerForKey:kInviteCodeModelDataUserId];
self.income = [aDecoder decodeDoubleForKey:kInviteCodeModelDataIncome];
self.bankId = [aDecoder decodeIntegerForKey:kInviteCodeModelDataBankId];
self.status = [aDecoder decodeIntegerForKey:kInviteCodeModelDataStatus];
self.deviceCode = [aDecoder decodeObjectForKey:kInviteCodeModelDataDeviceCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeInteger:_identifier forKey:kInviteCodeModelDataId];
[aCoder encodeObject:_name forKey:kInviteCodeModelDataName];
[aCoder encodeObject:_bankName forKey:kInviteCodeModelDataBankName];
[aCoder encodeObject:_inviteCode forKey:kInviteCodeModelDataInviteCode];
[aCoder encodeInteger:_inviteNum forKey:kInviteCodeModelDataInviteNum];
[aCoder encodeDouble:_balance forKey:kInviteCodeModelDataBalance];
[aCoder encodeObject:_bankNo forKey:kInviteCodeModelDataBankNo];
[aCoder encodeInteger:_userId forKey:kInviteCodeModelDataUserId];
[aCoder encodeDouble:_income forKey:kInviteCodeModelDataIncome];
[aCoder encodeInteger:_bankId forKey:kInviteCodeModelDataBankId];
[aCoder encodeInteger:_status forKey:kInviteCodeModelDataStatus];
[aCoder encodeObject:_deviceCode forKey:kInviteCodeModelDataDeviceCode];
}
- (id)copyWithZone:(NSZone *)zone {
InviteCodeModelData *copy = [[InviteCodeModelData alloc] init];
if (copy) {
copy.identifier = self.identifier;
copy.name = [self.name copyWithZone:zone];
copy.bankName = [self.bankName copyWithZone:zone];
copy.inviteCode = [self.inviteCode copyWithZone:zone];
copy.inviteNum = self.inviteNum;
copy.balance = self.balance;
copy.bankNo = [self.bankNo copyWithZone:zone];
copy.userId = self.userId;
copy.income = self.income;
copy.bankId = self.bankId;
copy.status = self.status;
copy.deviceCode = [self.deviceCode copyWithZone:zone];
}
return copy;
}
@end

View File

@@ -0,0 +1,19 @@
//
// InviteCodeModelDataModel.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@class InviteCodeModelData;
@interface InviteCodeModelDataModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) InviteCodeModelData *data;
@property (nonatomic, assign) NSInteger code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,81 @@
//
// InviteCodeModelDataModel.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "InviteCodeModelDataModel.h"
#import "InviteCodeModelData.h"
NSString *const kInviteCodeModelDataModelData = @"data";
NSString *const kInviteCodeModelDataModelCode = @"code";
@interface InviteCodeModelDataModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation InviteCodeModelDataModel
@synthesize data = _data;
@synthesize code = _code;
+ (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.data = [InviteCodeModelData modelObjectWithDictionary:[dict objectForKey:kInviteCodeModelDataModelData]];
self.code = [[self objectOrNilForKey:kInviteCodeModelDataModelCode fromDictionary:dict] intValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.data dictionaryRepresentation] forKey:kInviteCodeModelDataModelData];
[mutableDict setValue:[NSNumber numberWithInteger:self.code] forKey:kInviteCodeModelDataModelCode];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.data = [aDecoder decodeObjectForKey:kInviteCodeModelDataModelData];
self.code = [aDecoder decodeIntegerForKey:kInviteCodeModelDataModelCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:_data forKey:kInviteCodeModelDataModelData];
[aCoder encodeInteger:_code forKey:kInviteCodeModelDataModelCode];
}
- (id)copyWithZone:(NSZone *)zone {
InviteCodeModelDataModel *copy = [[InviteCodeModelDataModel alloc] init];
if (copy) {
copy.data = [self.data copyWithZone:zone];
copy.code = self.code;
}
return copy;
}
@end

View File

@@ -0,0 +1,24 @@
//
// WithdrawRecordData.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WithdrawRecordData : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) NSInteger pages;
@property (nonatomic, assign) BOOL hasNextPage;
@property (nonatomic, assign) NSInteger nextPage;
@property (nonatomic, assign) NSInteger total;
@property (nonatomic, strong) NSArray *list;
@property (nonatomic, assign) BOOL hasPreviousPage;
@property (nonatomic, assign) NSInteger prePage;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,140 @@
//
// WithdrawRecordData.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "WithdrawRecordData.h"
#import "WithdrawRecordList.h"
NSString *const kWithdrawRecordDataPages = @"pages";
NSString *const kWithdrawRecordDataHasNextPage = @"hasNextPage";
NSString *const kWithdrawRecordDataNextPage = @"nextPage";
NSString *const kWithdrawRecordDataTotal = @"total";
NSString *const kWithdrawRecordDataList = @"list";
NSString *const kWithdrawRecordDataHasPreviousPage = @"hasPreviousPage";
NSString *const kWithdrawRecordDataPrePage = @"prePage";
@interface WithdrawRecordData ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation WithdrawRecordData
@synthesize pages = _pages;
@synthesize hasNextPage = _hasNextPage;
@synthesize nextPage = _nextPage;
@synthesize total = _total;
@synthesize list = _list;
@synthesize hasPreviousPage = _hasPreviousPage;
@synthesize prePage = _prePage;
+ (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.pages = [[self objectOrNilForKey:kWithdrawRecordDataPages fromDictionary:dict] intValue];
self.hasNextPage = [[self objectOrNilForKey:kWithdrawRecordDataHasNextPage fromDictionary:dict] boolValue];
self.nextPage = [[self objectOrNilForKey:kWithdrawRecordDataNextPage fromDictionary:dict] intValue];
self.total = [[self objectOrNilForKey:kWithdrawRecordDataTotal fromDictionary:dict] intValue];
NSObject *receivedWithdrawRecordList = [dict objectForKey:kWithdrawRecordDataList];
NSMutableArray *parsedWithdrawRecordList = [NSMutableArray array];
if ([receivedWithdrawRecordList isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedWithdrawRecordList) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedWithdrawRecordList addObject:[WithdrawRecordList modelObjectWithDictionary:item]];
}
}
} else if ([receivedWithdrawRecordList isKindOfClass:[NSDictionary class]]) {
[parsedWithdrawRecordList addObject:[WithdrawRecordList modelObjectWithDictionary:(NSDictionary *)receivedWithdrawRecordList]];
}
self.list = [NSArray arrayWithArray:parsedWithdrawRecordList];
self.hasPreviousPage = [[self objectOrNilForKey:kWithdrawRecordDataHasPreviousPage fromDictionary:dict] boolValue];
self.prePage = [[self objectOrNilForKey:kWithdrawRecordDataPrePage fromDictionary:dict] intValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithInteger:self.pages] forKey:kWithdrawRecordDataPages];
[mutableDict setValue:[NSNumber numberWithBool:self.hasNextPage] forKey:kWithdrawRecordDataHasNextPage];
[mutableDict setValue:[NSNumber numberWithInteger:self.nextPage] forKey:kWithdrawRecordDataNextPage];
[mutableDict setValue:[NSNumber numberWithInteger:self.total] forKey:kWithdrawRecordDataTotal];
NSMutableArray *tempArrayForList = [NSMutableArray array];
for (NSObject *subArrayObject in self.list) {
if ([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForList addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForList addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForList] forKey:kWithdrawRecordDataList];
[mutableDict setValue:[NSNumber numberWithBool:self.hasPreviousPage] forKey:kWithdrawRecordDataHasPreviousPage];
[mutableDict setValue:[NSNumber numberWithInteger:self.prePage] forKey:kWithdrawRecordDataPrePage];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.pages = [aDecoder decodeIntegerForKey:kWithdrawRecordDataPages];
self.hasNextPage = [aDecoder decodeBoolForKey:kWithdrawRecordDataHasNextPage];
self.nextPage = [aDecoder decodeIntegerForKey:kWithdrawRecordDataNextPage];
self.total = [aDecoder decodeIntegerForKey:kWithdrawRecordDataTotal];
self.list = [aDecoder decodeObjectForKey:kWithdrawRecordDataList];
self.hasPreviousPage = [aDecoder decodeBoolForKey:kWithdrawRecordDataHasPreviousPage];
self.prePage = [aDecoder decodeIntegerForKey:kWithdrawRecordDataPrePage];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeInteger:_pages forKey:kWithdrawRecordDataPages];
[aCoder encodeBool:_hasNextPage forKey:kWithdrawRecordDataHasNextPage];
[aCoder encodeInteger:_nextPage forKey:kWithdrawRecordDataNextPage];
[aCoder encodeInteger:_total forKey:kWithdrawRecordDataTotal];
[aCoder encodeObject:_list forKey:kWithdrawRecordDataList];
[aCoder encodeBool:_hasPreviousPage forKey:kWithdrawRecordDataHasPreviousPage];
[aCoder encodeInteger:_prePage forKey:kWithdrawRecordDataPrePage];
}
- (id)copyWithZone:(NSZone *)zone {
WithdrawRecordData *copy = [[WithdrawRecordData alloc] init];
if (copy) {
copy.pages = self.pages;
copy.hasNextPage = self.hasNextPage;
copy.nextPage = self.nextPage;
copy.total = self.total;
copy.list = [self.list copyWithZone:zone];
copy.hasPreviousPage = self.hasPreviousPage;
copy.prePage = self.prePage;
}
return copy;
}
@end

View File

@@ -0,0 +1,19 @@
//
// WithdrawRecordDataModel.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@class WithdrawRecordData;
@interface WithdrawRecordDataModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) WithdrawRecordData *data;
@property (nonatomic, assign) NSInteger code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,81 @@
//
// WithdrawRecordDataModel.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "WithdrawRecordDataModel.h"
#import "WithdrawRecordData.h"
NSString *const kWithdrawRecordDataModelData = @"data";
NSString *const kWithdrawRecordDataModelCode = @"code";
@interface WithdrawRecordDataModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation WithdrawRecordDataModel
@synthesize data = _data;
@synthesize code = _code;
+ (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.data = [WithdrawRecordData modelObjectWithDictionary:[dict objectForKey:kWithdrawRecordDataModelData]];
self.code = [[self objectOrNilForKey:kWithdrawRecordDataModelCode fromDictionary:dict] intValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.data dictionaryRepresentation] forKey:kWithdrawRecordDataModelData];
[mutableDict setValue:[NSNumber numberWithInteger:self.code] forKey:kWithdrawRecordDataModelCode];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.data = [aDecoder decodeObjectForKey:kWithdrawRecordDataModelData];
self.code = [aDecoder decodeIntegerForKey:kWithdrawRecordDataModelCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:_data forKey:kWithdrawRecordDataModelData];
[aCoder encodeInteger:_code forKey:kWithdrawRecordDataModelCode];
}
- (id)copyWithZone:(NSZone *)zone {
WithdrawRecordDataModel *copy = [[WithdrawRecordDataModel alloc] init];
if (copy) {
copy.data = [self.data copyWithZone:zone];
copy.code = self.code;
}
return copy;
}
@end

View File

@@ -0,0 +1,27 @@
//
// WithdrawRecordList.h
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WithdrawRecordList : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) CGFloat amount;
@property (nonatomic, strong) NSString *bankName;
@property (nonatomic, assign) NSInteger bankId;
@property (nonatomic, assign) NSInteger identifier;
@property (nonatomic, assign) NSInteger status;
@property (nonatomic, assign) NSInteger inviteId;
@property (nonatomic, strong) NSString *inviteCode;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) CGFloat balance;
@property (nonatomic, strong) NSString *createTime;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end

View File

@@ -0,0 +1,136 @@
//
// WithdrawRecordList.m
//
// Created by Yao on 2024/11/9
// Copyright (c) 2024 zL. All rights reserved.
//
#import "WithdrawRecordList.h"
NSString *const kWithdrawRecordListAmount = @"amount";
NSString *const kWithdrawRecordListBankName = @"bankName";
NSString *const kWithdrawRecordListBankId = @"bankId";
NSString *const kWithdrawRecordListId = @"id";
NSString *const kWithdrawRecordListStatus = @"status";
NSString *const kWithdrawRecordListInviteId = @"inviteId";
NSString *const kWithdrawRecordListInviteCode = @"inviteCode";
NSString *const kWithdrawRecordListName = @"name";
NSString *const kWithdrawRecordListBalance = @"balance";
NSString *const kWithdrawRecordListCreateTime = @"createTime";
@interface WithdrawRecordList ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation WithdrawRecordList
@synthesize amount = _amount;
@synthesize bankName = _bankName;
@synthesize bankId = _bankId;
@synthesize identifier = _identifier;
@synthesize status = _status;
@synthesize inviteId = _inviteId;
@synthesize inviteCode = _inviteCode;
@synthesize name = _name;
@synthesize balance = _balance;
@synthesize createTime = _createTime;
+ (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.amount = [[self objectOrNilForKey:kWithdrawRecordListAmount fromDictionary:dict] doubleValue];
self.bankName = [self objectOrNilForKey:kWithdrawRecordListBankName fromDictionary:dict];
self.bankId = [[self objectOrNilForKey:kWithdrawRecordListBankId fromDictionary:dict] intValue];
self.identifier = [[self objectOrNilForKey:kWithdrawRecordListId fromDictionary:dict] intValue];
self.status = [[self objectOrNilForKey:kWithdrawRecordListStatus fromDictionary:dict] intValue];
self.inviteId = [[self objectOrNilForKey:kWithdrawRecordListInviteId fromDictionary:dict] intValue];
self.inviteCode = [self objectOrNilForKey:kWithdrawRecordListInviteCode fromDictionary:dict];
self.name = [self objectOrNilForKey:kWithdrawRecordListName fromDictionary:dict];
self.balance = [[self objectOrNilForKey:kWithdrawRecordListBalance fromDictionary:dict] doubleValue];
self.createTime = [self objectOrNilForKey:kWithdrawRecordListCreateTime fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.amount] forKey:kWithdrawRecordListAmount];
[mutableDict setValue:self.bankName forKey:kWithdrawRecordListBankName];
[mutableDict setValue:[NSNumber numberWithInteger:self.bankId] forKey:kWithdrawRecordListBankId];
[mutableDict setValue:[NSNumber numberWithInteger:self.identifier] forKey:kWithdrawRecordListId];
[mutableDict setValue:[NSNumber numberWithInteger:self.status] forKey:kWithdrawRecordListStatus];
[mutableDict setValue:[NSNumber numberWithInteger:self.inviteId] forKey:kWithdrawRecordListInviteId];
[mutableDict setValue:self.inviteCode forKey:kWithdrawRecordListInviteCode];
[mutableDict setValue:self.name forKey:kWithdrawRecordListName];
[mutableDict setValue:[NSNumber numberWithDouble:self.balance] forKey:kWithdrawRecordListBalance];
[mutableDict setValue:self.createTime forKey:kWithdrawRecordListCreateTime];
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;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
self.amount = [aDecoder decodeDoubleForKey:kWithdrawRecordListAmount];
self.bankName = [aDecoder decodeObjectForKey:kWithdrawRecordListBankName];
self.bankId = [aDecoder decodeIntegerForKey:kWithdrawRecordListBankId];
self.identifier = [aDecoder decodeIntegerForKey:kWithdrawRecordListId];
self.status = [aDecoder decodeIntegerForKey:kWithdrawRecordListStatus];
self.inviteId = [aDecoder decodeIntegerForKey:kWithdrawRecordListInviteId];
self.inviteCode = [aDecoder decodeObjectForKey:kWithdrawRecordListInviteCode];
self.name = [aDecoder decodeObjectForKey:kWithdrawRecordListName];
self.balance = [aDecoder decodeDoubleForKey:kWithdrawRecordListBalance];
self.createTime = [aDecoder decodeObjectForKey:kWithdrawRecordListCreateTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeDouble:_amount forKey:kWithdrawRecordListAmount];
[aCoder encodeObject:_bankName forKey:kWithdrawRecordListBankName];
[aCoder encodeInteger:_bankId forKey:kWithdrawRecordListBankId];
[aCoder encodeInteger:_identifier forKey:kWithdrawRecordListId];
[aCoder encodeInteger:_status forKey:kWithdrawRecordListStatus];
[aCoder encodeInteger:_inviteId forKey:kWithdrawRecordListInviteId];
[aCoder encodeObject:_inviteCode forKey:kWithdrawRecordListInviteCode];
[aCoder encodeObject:_name forKey:kWithdrawRecordListName];
[aCoder encodeDouble:_balance forKey:kWithdrawRecordListBalance];
[aCoder encodeObject:_createTime forKey:kWithdrawRecordListCreateTime];
}
- (id)copyWithZone:(NSZone *)zone {
WithdrawRecordList *copy = [[WithdrawRecordList alloc] init];
if (copy) {
copy.amount = self.amount;
copy.bankName = [self.bankName copyWithZone:zone];
copy.bankId = self.bankId;
copy.identifier = self.identifier;
copy.status = self.status;
copy.inviteId = self.inviteId;
copy.inviteCode = [self.inviteCode copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
copy.balance = self.balance;
copy.createTime = [self.createTime copyWithZone:zone];
}
return copy;
}
@end