Commit 6cf9cecc authored by Sandy's avatar Sandy

首页collectionView的调整等

parent 0fed7605
This diff is collapsed.
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection0.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection0@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection3.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection3@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection4.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection4@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection5.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection5@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection6.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection6@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection7.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection7@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "homeCollection8.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "homeCollection8@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// CommotityListBrand.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListLastModifyInfo, CommotityListCreateInfo;
@interface CommotityListBrand : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *brandDescription;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) CommotityListLastModifyInfo *lastModifyInfo;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *location;
@property (nonatomic, assign) double order;
@property (nonatomic, strong) NSString *logo;
@property (nonatomic, strong) CommotityListCreateInfo *createInfo;
@property (nonatomic, strong) NSString *website;
@property (nonatomic, strong) NSString *name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListBrand.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListBrand.h"
#import "CommotityListLastModifyInfo.h"
#import "CommotityListCreateInfo.h"
NSString *const kCommotityListBrandUuid = @"uuid";
NSString *const kCommotityListBrandDescription = @"description";
NSString *const kCommotityListBrandState = @"state";
NSString *const kCommotityListBrandVersion = @"version";
NSString *const kCommotityListBrandDomain = @"domain";
NSString *const kCommotityListBrandLastModifyInfo = @"lastModifyInfo";
NSString *const kCommotityListBrandCode = @"code";
NSString *const kCommotityListBrandLocation = @"location";
NSString *const kCommotityListBrandOrder = @"order";
NSString *const kCommotityListBrandLogo = @"logo";
NSString *const kCommotityListBrandCreateInfo = @"createInfo";
NSString *const kCommotityListBrandWebsite = @"website";
NSString *const kCommotityListBrandName = @"name";
@interface CommotityListBrand ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListBrand
@synthesize uuid = _uuid;
@synthesize brandDescription = _brandDescription;
@synthesize state = _state;
@synthesize version = _version;
@synthesize domain = _domain;
@synthesize lastModifyInfo = _lastModifyInfo;
@synthesize code = _code;
@synthesize location = _location;
@synthesize order = _order;
@synthesize logo = _logo;
@synthesize createInfo = _createInfo;
@synthesize website = _website;
@synthesize name = _name;
+ (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.uuid = [self objectOrNilForKey:kCommotityListBrandUuid fromDictionary:dict];
self.brandDescription = [self objectOrNilForKey:kCommotityListBrandDescription fromDictionary:dict];
self.state = [self objectOrNilForKey:kCommotityListBrandState fromDictionary:dict];
self.version = [[self objectOrNilForKey:kCommotityListBrandVersion fromDictionary:dict] doubleValue];
self.domain = [self objectOrNilForKey:kCommotityListBrandDomain fromDictionary:dict];
self.lastModifyInfo = [CommotityListLastModifyInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListBrandLastModifyInfo]];
self.code = [self objectOrNilForKey:kCommotityListBrandCode fromDictionary:dict];
self.location = [self objectOrNilForKey:kCommotityListBrandLocation fromDictionary:dict];
self.order = [[self objectOrNilForKey:kCommotityListBrandOrder fromDictionary:dict] doubleValue];
self.logo = [self objectOrNilForKey:kCommotityListBrandLogo fromDictionary:dict];
self.createInfo = [CommotityListCreateInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListBrandCreateInfo]];
self.website = [self objectOrNilForKey:kCommotityListBrandWebsite fromDictionary:dict];
self.name = [self objectOrNilForKey:kCommotityListBrandName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.uuid forKey:kCommotityListBrandUuid];
[mutableDict setValue:self.brandDescription forKey:kCommotityListBrandDescription];
[mutableDict setValue:self.state forKey:kCommotityListBrandState];
[mutableDict setValue:[NSNumber numberWithDouble:self.version] forKey:kCommotityListBrandVersion];
[mutableDict setValue:self.domain forKey:kCommotityListBrandDomain];
[mutableDict setValue:[self.lastModifyInfo dictionaryRepresentation] forKey:kCommotityListBrandLastModifyInfo];
[mutableDict setValue:self.code forKey:kCommotityListBrandCode];
[mutableDict setValue:self.location forKey:kCommotityListBrandLocation];
[mutableDict setValue:[NSNumber numberWithDouble:self.order] forKey:kCommotityListBrandOrder];
[mutableDict setValue:self.logo forKey:kCommotityListBrandLogo];
[mutableDict setValue:[self.createInfo dictionaryRepresentation] forKey:kCommotityListBrandCreateInfo];
[mutableDict setValue:self.website forKey:kCommotityListBrandWebsite];
[mutableDict setValue:self.name forKey:kCommotityListBrandName];
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.uuid = [aDecoder decodeObjectForKey:kCommotityListBrandUuid];
self.brandDescription = [aDecoder decodeObjectForKey:kCommotityListBrandDescription];
self.state = [aDecoder decodeObjectForKey:kCommotityListBrandState];
self.version = [aDecoder decodeDoubleForKey:kCommotityListBrandVersion];
self.domain = [aDecoder decodeObjectForKey:kCommotityListBrandDomain];
self.lastModifyInfo = [aDecoder decodeObjectForKey:kCommotityListBrandLastModifyInfo];
self.code = [aDecoder decodeObjectForKey:kCommotityListBrandCode];
self.location = [aDecoder decodeObjectForKey:kCommotityListBrandLocation];
self.order = [aDecoder decodeDoubleForKey:kCommotityListBrandOrder];
self.logo = [aDecoder decodeObjectForKey:kCommotityListBrandLogo];
self.createInfo = [aDecoder decodeObjectForKey:kCommotityListBrandCreateInfo];
self.website = [aDecoder decodeObjectForKey:kCommotityListBrandWebsite];
self.name = [aDecoder decodeObjectForKey:kCommotityListBrandName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_uuid forKey:kCommotityListBrandUuid];
[aCoder encodeObject:_brandDescription forKey:kCommotityListBrandDescription];
[aCoder encodeObject:_state forKey:kCommotityListBrandState];
[aCoder encodeDouble:_version forKey:kCommotityListBrandVersion];
[aCoder encodeObject:_domain forKey:kCommotityListBrandDomain];
[aCoder encodeObject:_lastModifyInfo forKey:kCommotityListBrandLastModifyInfo];
[aCoder encodeObject:_code forKey:kCommotityListBrandCode];
[aCoder encodeObject:_location forKey:kCommotityListBrandLocation];
[aCoder encodeDouble:_order forKey:kCommotityListBrandOrder];
[aCoder encodeObject:_logo forKey:kCommotityListBrandLogo];
[aCoder encodeObject:_createInfo forKey:kCommotityListBrandCreateInfo];
[aCoder encodeObject:_website forKey:kCommotityListBrandWebsite];
[aCoder encodeObject:_name forKey:kCommotityListBrandName];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListBrand *copy = [[CommotityListBrand alloc] init];
if (copy) {
copy.uuid = [self.uuid copyWithZone:zone];
copy.brandDescription = [self.brandDescription copyWithZone:zone];
copy.state = [self.state copyWithZone:zone];
copy.version = self.version;
copy.domain = [self.domain copyWithZone:zone];
copy.lastModifyInfo = [self.lastModifyInfo copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.location = [self.location copyWithZone:zone];
copy.order = self.order;
copy.logo = [self.logo copyWithZone:zone];
copy.createInfo = [self.createInfo copyWithZone:zone];
copy.website = [self.website copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
}
return copy;
}
@end
//
// CommotityListCategory.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListUpper, CommotityListLastModifyInfo, CommotityListCreateInfo;
@interface CommotityListCategory : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *categoryDescription;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) CommotityListUpper *upper;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSString *path;
@property (nonatomic, strong) CommotityListLastModifyInfo *lastModifyInfo;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, assign) double order;
@property (nonatomic, assign) double level;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) CommotityListCreateInfo *createInfo;
@property (nonatomic, strong) NSString *name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListCategory.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListCategory.h"
#import "CommotityListUpper.h"
#import "CommotityListLastModifyInfo.h"
#import "CommotityListCreateInfo.h"
NSString *const kCommotityListCategoryUuid = @"uuid";
NSString *const kCommotityListCategoryDescription = @"description";
NSString *const kCommotityListCategoryState = @"state";
NSString *const kCommotityListCategoryVersion = @"version";
NSString *const kCommotityListCategoryUpper = @"upper";
NSString *const kCommotityListCategoryDomain = @"domain";
NSString *const kCommotityListCategoryPath = @"path";
NSString *const kCommotityListCategoryLastModifyInfo = @"lastModifyInfo";
NSString *const kCommotityListCategoryCode = @"code";
NSString *const kCommotityListCategoryOrder = @"order";
NSString *const kCommotityListCategoryLevel = @"level";
NSString *const kCommotityListCategoryPictures = @"pictures";
NSString *const kCommotityListCategoryCreateInfo = @"createInfo";
NSString *const kCommotityListCategoryName = @"name";
@interface CommotityListCategory ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListCategory
@synthesize uuid = _uuid;
@synthesize categoryDescription = _categoryDescription;
@synthesize state = _state;
@synthesize version = _version;
@synthesize upper = _upper;
@synthesize domain = _domain;
@synthesize path = _path;
@synthesize lastModifyInfo = _lastModifyInfo;
@synthesize code = _code;
@synthesize order = _order;
@synthesize level = _level;
@synthesize pictures = _pictures;
@synthesize createInfo = _createInfo;
@synthesize name = _name;
+ (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.uuid = [self objectOrNilForKey:kCommotityListCategoryUuid fromDictionary:dict];
self.categoryDescription = [self objectOrNilForKey:kCommotityListCategoryDescription fromDictionary:dict];
self.state = [self objectOrNilForKey:kCommotityListCategoryState fromDictionary:dict];
self.version = [[self objectOrNilForKey:kCommotityListCategoryVersion fromDictionary:dict] doubleValue];
self.upper = [CommotityListUpper modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryUpper]];
self.domain = [self objectOrNilForKey:kCommotityListCategoryDomain fromDictionary:dict];
self.path = [self objectOrNilForKey:kCommotityListCategoryPath fromDictionary:dict];
self.lastModifyInfo = [CommotityListLastModifyInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryLastModifyInfo]];
self.code = [self objectOrNilForKey:kCommotityListCategoryCode fromDictionary:dict];
self.order = [[self objectOrNilForKey:kCommotityListCategoryOrder fromDictionary:dict] doubleValue];
self.level = [[self objectOrNilForKey:kCommotityListCategoryLevel fromDictionary:dict] doubleValue];
self.pictures = [self objectOrNilForKey:kCommotityListCategoryPictures fromDictionary:dict];
self.createInfo = [CommotityListCreateInfo modelObjectWithDictionary:[dict objectForKey:kCommotityListCategoryCreateInfo]];
self.name = [self objectOrNilForKey:kCommotityListCategoryName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.uuid forKey:kCommotityListCategoryUuid];
[mutableDict setValue:self.categoryDescription forKey:kCommotityListCategoryDescription];
[mutableDict setValue:self.state forKey:kCommotityListCategoryState];
[mutableDict setValue:[NSNumber numberWithDouble:self.version] forKey:kCommotityListCategoryVersion];
[mutableDict setValue:[self.upper dictionaryRepresentation] forKey:kCommotityListCategoryUpper];
[mutableDict setValue:self.domain forKey:kCommotityListCategoryDomain];
[mutableDict setValue:self.path forKey:kCommotityListCategoryPath];
[mutableDict setValue:[self.lastModifyInfo dictionaryRepresentation] forKey:kCommotityListCategoryLastModifyInfo];
[mutableDict setValue:self.code forKey:kCommotityListCategoryCode];
[mutableDict setValue:[NSNumber numberWithDouble:self.order] forKey:kCommotityListCategoryOrder];
[mutableDict setValue:[NSNumber numberWithDouble:self.level] forKey:kCommotityListCategoryLevel];
[mutableDict setValue:self.pictures forKey:kCommotityListCategoryPictures];
[mutableDict setValue:[self.createInfo dictionaryRepresentation] forKey:kCommotityListCategoryCreateInfo];
[mutableDict setValue:self.name forKey:kCommotityListCategoryName];
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.uuid = [aDecoder decodeObjectForKey:kCommotityListCategoryUuid];
self.categoryDescription = [aDecoder decodeObjectForKey:kCommotityListCategoryDescription];
self.state = [aDecoder decodeObjectForKey:kCommotityListCategoryState];
self.version = [aDecoder decodeDoubleForKey:kCommotityListCategoryVersion];
self.upper = [aDecoder decodeObjectForKey:kCommotityListCategoryUpper];
self.domain = [aDecoder decodeObjectForKey:kCommotityListCategoryDomain];
self.path = [aDecoder decodeObjectForKey:kCommotityListCategoryPath];
self.lastModifyInfo = [aDecoder decodeObjectForKey:kCommotityListCategoryLastModifyInfo];
self.code = [aDecoder decodeObjectForKey:kCommotityListCategoryCode];
self.order = [aDecoder decodeDoubleForKey:kCommotityListCategoryOrder];
self.level = [aDecoder decodeDoubleForKey:kCommotityListCategoryLevel];
self.pictures = [aDecoder decodeObjectForKey:kCommotityListCategoryPictures];
self.createInfo = [aDecoder decodeObjectForKey:kCommotityListCategoryCreateInfo];
self.name = [aDecoder decodeObjectForKey:kCommotityListCategoryName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_uuid forKey:kCommotityListCategoryUuid];
[aCoder encodeObject:_categoryDescription forKey:kCommotityListCategoryDescription];
[aCoder encodeObject:_state forKey:kCommotityListCategoryState];
[aCoder encodeDouble:_version forKey:kCommotityListCategoryVersion];
[aCoder encodeObject:_upper forKey:kCommotityListCategoryUpper];
[aCoder encodeObject:_domain forKey:kCommotityListCategoryDomain];
[aCoder encodeObject:_path forKey:kCommotityListCategoryPath];
[aCoder encodeObject:_lastModifyInfo forKey:kCommotityListCategoryLastModifyInfo];
[aCoder encodeObject:_code forKey:kCommotityListCategoryCode];
[aCoder encodeDouble:_order forKey:kCommotityListCategoryOrder];
[aCoder encodeDouble:_level forKey:kCommotityListCategoryLevel];
[aCoder encodeObject:_pictures forKey:kCommotityListCategoryPictures];
[aCoder encodeObject:_createInfo forKey:kCommotityListCategoryCreateInfo];
[aCoder encodeObject:_name forKey:kCommotityListCategoryName];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListCategory *copy = [[CommotityListCategory alloc] init];
if (copy) {
copy.uuid = [self.uuid copyWithZone:zone];
copy.categoryDescription = [self.categoryDescription copyWithZone:zone];
copy.state = [self.state copyWithZone:zone];
copy.version = self.version;
copy.upper = [self.upper copyWithZone:zone];
copy.domain = [self.domain copyWithZone:zone];
copy.path = [self.path copyWithZone:zone];
copy.lastModifyInfo = [self.lastModifyInfo copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.order = self.order;
copy.level = self.level;
copy.pictures = [self.pictures copyWithZone:zone];
copy.createInfo = [self.createInfo copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
}
return copy;
}
@end
//
// CommotityListCreateInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListOperator;
@interface CommotityListCreateInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListOperator *operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListCreateInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListCreateInfo.h"
#import "CommotityListOperator.h"
NSString *const kCommotityListCreateInfoOperator = @"operator";
NSString *const kCommotityListCreateInfoTime = @"time";
@interface CommotityListCreateInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListCreateInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (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.operator = [CommotityListOperator modelObjectWithDictionary:[dict objectForKey:kCommotityListCreateInfoOperator]];
self.time = [[self objectOrNilForKey:kCommotityListCreateInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kCommotityListCreateInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kCommotityListCreateInfoTime];
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.operator = [aDecoder decodeObjectForKey:kCommotityListCreateInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kCommotityListCreateInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kCommotityListCreateInfoOperator];
[aCoder encodeDouble:_time forKey:kCommotityListCreateInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListCreateInfo *copy = [[CommotityListCreateInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// CommotityListLastModifyInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListOperator;
@interface CommotityListLastModifyInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListOperator *operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListLastModifyInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListLastModifyInfo.h"
#import "CommotityListOperator.h"
NSString *const kCommotityListLastModifyInfoOperator = @"operator";
NSString *const kCommotityListLastModifyInfoTime = @"time";
@interface CommotityListLastModifyInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListLastModifyInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (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.operator = [CommotityListOperator modelObjectWithDictionary:[dict objectForKey:kCommotityListLastModifyInfoOperator]];
self.time = [[self objectOrNilForKey:kCommotityListLastModifyInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kCommotityListLastModifyInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kCommotityListLastModifyInfoTime];
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.operator = [aDecoder decodeObjectForKey:kCommotityListLastModifyInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kCommotityListLastModifyInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kCommotityListLastModifyInfoOperator];
[aCoder encodeDouble:_time forKey:kCommotityListLastModifyInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListLastModifyInfo *copy = [[CommotityListLastModifyInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// CommotityListModel.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class CommotityListCategory, CommotityListBrand;
@interface CommotityListModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) CommotityListCategory *category;
@property (nonatomic, assign) double brokerageRate;
@property (nonatomic, assign) double originalPrice;
@property (nonatomic, assign) double inv;
@property (nonatomic, assign) double price;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *engName;
@property (nonatomic, strong) CommotityListBrand *brand;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *tranferType;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListModel.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListModel.h"
#import "CommotityListCategory.h"
#import "CommotityListBrand.h"
NSString *const kCommotityListModelCategory = @"category";
NSString *const kCommotityListModelBrokerageRate = @"brokerageRate";
NSString *const kCommotityListModelOriginalPrice = @"originalPrice";
NSString *const kCommotityListModelInv = @"inv";
NSString *const kCommotityListModelPrice = @"price";
NSString *const kCommotityListModelUuid = @"uuid";
NSString *const kCommotityListModelEngName = @"engName";
NSString *const kCommotityListModelBrand = @"brand";
NSString *const kCommotityListModelPictures = @"pictures";
NSString *const kCommotityListModelName = @"name";
NSString *const kCommotityListModelTranferType = @"tranferType";
@interface CommotityListModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListModel
@synthesize category = _category;
@synthesize brokerageRate = _brokerageRate;
@synthesize originalPrice = _originalPrice;
@synthesize inv = _inv;
@synthesize price = _price;
@synthesize uuid = _uuid;
@synthesize engName = _engName;
@synthesize brand = _brand;
@synthesize pictures = _pictures;
@synthesize name = _name;
@synthesize tranferType = _tranferType;
+ (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.category = [CommotityListCategory modelObjectWithDictionary:[dict objectForKey:kCommotityListModelCategory]];
self.brokerageRate = [[self objectOrNilForKey:kCommotityListModelBrokerageRate fromDictionary:dict] doubleValue];
self.originalPrice = [[self objectOrNilForKey:kCommotityListModelOriginalPrice fromDictionary:dict] doubleValue];
self.inv = [[self objectOrNilForKey:kCommotityListModelInv fromDictionary:dict] doubleValue];
self.price = [[self objectOrNilForKey:kCommotityListModelPrice fromDictionary:dict] doubleValue];
self.uuid = [self objectOrNilForKey:kCommotityListModelUuid fromDictionary:dict];
self.engName = [self objectOrNilForKey:kCommotityListModelEngName fromDictionary:dict];
self.brand = [CommotityListBrand modelObjectWithDictionary:[dict objectForKey:kCommotityListModelBrand]];
self.pictures = [self objectOrNilForKey:kCommotityListModelPictures fromDictionary:dict];
self.name = [self objectOrNilForKey:kCommotityListModelName fromDictionary:dict];
self.tranferType = [self objectOrNilForKey:kCommotityListModelTranferType fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.category dictionaryRepresentation] forKey:kCommotityListModelCategory];
[mutableDict setValue:[NSNumber numberWithDouble:self.brokerageRate] forKey:kCommotityListModelBrokerageRate];
[mutableDict setValue:[NSNumber numberWithDouble:self.originalPrice] forKey:kCommotityListModelOriginalPrice];
[mutableDict setValue:[NSNumber numberWithDouble:self.inv] forKey:kCommotityListModelInv];
[mutableDict setValue:[NSNumber numberWithDouble:self.price] forKey:kCommotityListModelPrice];
[mutableDict setValue:self.uuid forKey:kCommotityListModelUuid];
[mutableDict setValue:self.engName forKey:kCommotityListModelEngName];
[mutableDict setValue:[self.brand dictionaryRepresentation] forKey:kCommotityListModelBrand];
[mutableDict setValue:self.pictures forKey:kCommotityListModelPictures];
[mutableDict setValue:self.name forKey:kCommotityListModelName];
[mutableDict setValue:self.tranferType forKey:kCommotityListModelTranferType];
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.category = [aDecoder decodeObjectForKey:kCommotityListModelCategory];
self.brokerageRate = [aDecoder decodeDoubleForKey:kCommotityListModelBrokerageRate];
self.originalPrice = [aDecoder decodeDoubleForKey:kCommotityListModelOriginalPrice];
self.inv = [aDecoder decodeDoubleForKey:kCommotityListModelInv];
self.price = [aDecoder decodeDoubleForKey:kCommotityListModelPrice];
self.uuid = [aDecoder decodeObjectForKey:kCommotityListModelUuid];
self.engName = [aDecoder decodeObjectForKey:kCommotityListModelEngName];
self.brand = [aDecoder decodeObjectForKey:kCommotityListModelBrand];
self.pictures = [aDecoder decodeObjectForKey:kCommotityListModelPictures];
self.name = [aDecoder decodeObjectForKey:kCommotityListModelName];
self.tranferType = [aDecoder decodeObjectForKey:kCommotityListModelTranferType];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_category forKey:kCommotityListModelCategory];
[aCoder encodeDouble:_brokerageRate forKey:kCommotityListModelBrokerageRate];
[aCoder encodeDouble:_originalPrice forKey:kCommotityListModelOriginalPrice];
[aCoder encodeDouble:_inv forKey:kCommotityListModelInv];
[aCoder encodeDouble:_price forKey:kCommotityListModelPrice];
[aCoder encodeObject:_uuid forKey:kCommotityListModelUuid];
[aCoder encodeObject:_engName forKey:kCommotityListModelEngName];
[aCoder encodeObject:_brand forKey:kCommotityListModelBrand];
[aCoder encodeObject:_pictures forKey:kCommotityListModelPictures];
[aCoder encodeObject:_name forKey:kCommotityListModelName];
[aCoder encodeObject:_tranferType forKey:kCommotityListModelTranferType];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListModel *copy = [[CommotityListModel alloc] init];
if (copy) {
copy.category = [self.category copyWithZone:zone];
copy.brokerageRate = self.brokerageRate;
copy.originalPrice = self.originalPrice;
copy.inv = self.inv;
copy.price = self.price;
copy.uuid = [self.uuid copyWithZone:zone];
copy.engName = [self.engName copyWithZone:zone];
copy.brand = [self.brand copyWithZone:zone];
copy.pictures = [self.pictures copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
copy.tranferType = [self.tranferType copyWithZone:zone];
}
return copy;
}
@end
//
// CommotityListOperator.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CommotityListOperator : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *operatorIdentifier;
@property (nonatomic, strong) NSString *fullName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListOperator.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListOperator.h"
NSString *const kCommotityListOperatorId = @"id";
NSString *const kCommotityListOperatorFullName = @"fullName";
@interface CommotityListOperator ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListOperator
@synthesize operatorIdentifier = _operatorIdentifier;
@synthesize fullName = _fullName;
+ (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.operatorIdentifier = [self objectOrNilForKey:kCommotityListOperatorId fromDictionary:dict];
self.fullName = [self objectOrNilForKey:kCommotityListOperatorFullName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.operatorIdentifier forKey:kCommotityListOperatorId];
[mutableDict setValue:self.fullName forKey:kCommotityListOperatorFullName];
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.operatorIdentifier = [aDecoder decodeObjectForKey:kCommotityListOperatorId];
self.fullName = [aDecoder decodeObjectForKey:kCommotityListOperatorFullName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operatorIdentifier forKey:kCommotityListOperatorId];
[aCoder encodeObject:_fullName forKey:kCommotityListOperatorFullName];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListOperator *copy = [[CommotityListOperator alloc] init];
if (copy) {
copy.operatorIdentifier = [self.operatorIdentifier copyWithZone:zone];
copy.fullName = [self.fullName copyWithZone:zone];
}
return copy;
}
@end
//
// CommotityListUpper.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CommotityListUpper : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityListUpper.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityListUpper.h"
NSString *const kCommotityListUpperName = @"name";
NSString *const kCommotityListUpperCode = @"code";
NSString *const kCommotityListUpperUuid = @"uuid";
@interface CommotityListUpper ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityListUpper
@synthesize name = _name;
@synthesize code = _code;
@synthesize uuid = _uuid;
+ (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.name = [self objectOrNilForKey:kCommotityListUpperName fromDictionary:dict];
self.code = [self objectOrNilForKey:kCommotityListUpperCode fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kCommotityListUpperUuid fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kCommotityListUpperName];
[mutableDict setValue:self.code forKey:kCommotityListUpperCode];
[mutableDict setValue:self.uuid forKey:kCommotityListUpperUuid];
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.name = [aDecoder decodeObjectForKey:kCommotityListUpperName];
self.code = [aDecoder decodeObjectForKey:kCommotityListUpperCode];
self.uuid = [aDecoder decodeObjectForKey:kCommotityListUpperUuid];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kCommotityListUpperName];
[aCoder encodeObject:_code forKey:kCommotityListUpperCode];
[aCoder encodeObject:_uuid forKey:kCommotityListUpperUuid];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityListUpper *copy = [[CommotityListUpper alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
}
return copy;
}
@end
//
// RequstBodyCommodityListModel.h
// ALand
//
// Created by Z on 16/4/11.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@class Defintion,Orders,Conditions,Parameter,Parameters;
@interface RequstBodyCommodityListModel : NSObject
@property (nonatomic, strong) Defintion *defintion;
@property (nonatomic, strong) NSArray<NSString *> *fetchParts;
@end
@interface Defintion : NSObject
@property (nonatomic, assign) NSInteger probePages;
@property (nonatomic, strong) NSArray<Orders *> *orders;
@property (nonatomic, strong) NSArray<Conditions *> *conditions;
@property (nonatomic, assign) NSInteger pageSize;
@property (nonatomic, assign) NSInteger page;
@end
@interface Orders : NSObject
@property (nonatomic, copy) NSString *field;
@property (nonatomic, copy) NSString *direction;
@end
@interface Conditions : NSObject
@property (nonatomic, strong) NSArray<Parameters *> *parameters;
@property (nonatomic, copy) NSString *operation;
@property (nonatomic, strong) Parameter *parameter;
@end
@interface Parameter : NSObject
@end
@interface Parameters : NSObject
@end
//
// RequstBodyCommodityListModel.m
// ALand
//
// Created by Z on 16/4/11.
// Copyright © 2016年 Z. All rights reserved.
//
#import "RequstBodyCommodityListModel.h"
@implementation RequstBodyCommodityListModel
- (Defintion *)defintion {
if (!_defintion) {
_defintion = [[Defintion alloc] init];
}
return _defintion;
}
@end
@implementation Defintion
+ (NSDictionary *)objectClassInArray{
return @{@"orders" : [Orders class], @"conditions" : [Conditions class]};
}
- (NSArray<Conditions *> *)conditions {
if (!_conditions) {
Conditions *condition = [[Conditions alloc] init];
_conditions = @[condition];
}
return _conditions;
}
@end
@implementation Orders
@end
@implementation Conditions
+ (NSDictionary *)objectClassInArray{
return @{@"parameters" : [Parameters class]};
}
@end
@implementation Parameter
@end
@implementation Parameters
@end
......@@ -7,8 +7,10 @@
//
#import <UIKit/UIKit.h>
#import "CommodityListModel/CommotityListModel.h"
@interface CommodityListCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelRealPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelSalePrice;
- (void)cellWithModel:(CommotityListModel *)model;
@end
......@@ -13,11 +13,23 @@
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelCommission;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelOriginalPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelBrokerageRate;
@end
@implementation CommodityListCollectionViewCell
- (void)cellWithModel:(CommotityListModel *)model {
self.labelPrice.text = [NSString stringWithFormat:@"%.0f",model.price];
[self.imageViewTop sd_setImageWithURL:[NSURL URLWithString:model.pictures] placeholderImage:nil];
self.labelOriginalPrice.text = [NSString stringWithFormat:@"%.0f", model.originalPrice];
self.labelBrokerageRate.text = [NSString stringWithFormat:@"%.2f", model.brokerageRate];
self.labelTitle.text = model.name;
}
- (void)awakeFromNib {
// Initialization code
}
......
......@@ -148,7 +148,10 @@
</variation>
<connections>
<outlet property="imageViewTop" destination="cBw-zL-p9z" id="zPI-ay-h1c"/>
<outlet property="labelBrokerageRate" destination="LFM-Hc-7OR" id="65C-IR-cp1"/>
<outlet property="labelCommission" destination="LFM-Hc-7OR" id="DT7-sD-Mww"/>
<outlet property="labelOriginalPrice" destination="JDW-37-wfV" id="FFB-9Z-rJw"/>
<outlet property="labelPrice" destination="ig6-43-sUi" id="d63-fZ-UmH"/>
<outlet property="labelRealPrice" destination="JDW-37-wfV" id="eBM-3D-ezH"/>
<outlet property="labelSalePrice" destination="ig6-43-sUi" id="NaO-uj-sLU"/>
<outlet property="labelTitle" destination="vlk-5l-QDd" id="FAQ-2a-zdq"/>
......
......@@ -9,6 +9,6 @@
#import <UIKit/UIKit.h>
@interface HomeCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelCellTitle;
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@end
......@@ -8,32 +8,32 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="HomeCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="162" height="88"/>
<rect key="frame" x="0.0" y="0.0" width="133" height="175"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="162" height="88"/>
<rect key="frame" x="0.0" y="0.0" width="133" height="175"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="cell描述" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WbW-XT-8QE">
<rect key="frame" x="0.0" y="35" width="162" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="homeCollection0" translatesAutoresizingMaskIntoConstraints="NO" id="D99-gm-QhP">
<rect key="frame" x="0.0" y="10" width="133" height="155"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="WbW-XT-8QE" secondAttribute="trailing" id="FfO-6c-pc1"/>
<constraint firstItem="WbW-XT-8QE" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="GtD-Lt-4bT"/>
<constraint firstItem="WbW-XT-8QE" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="f7s-un-iVP"/>
<constraint firstItem="WbW-XT-8QE" firstAttribute="centerY" secondItem="gTV-IL-0wX" secondAttribute="centerY" id="zQY-2i-NVV"/>
<constraint firstItem="D99-gm-QhP" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="10" id="aZq-nH-q2d"/>
<constraint firstItem="D99-gm-QhP" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="jXj-Lf-0f1"/>
<constraint firstAttribute="bottom" secondItem="D99-gm-QhP" secondAttribute="bottom" constant="10" id="qTX-cx-Pfg"/>
<constraint firstAttribute="trailing" secondItem="D99-gm-QhP" secondAttribute="trailing" id="zAQ-0v-9If"/>
</constraints>
<size key="customSize" width="162" height="88"/>
<size key="customSize" width="133" height="175"/>
<connections>
<outlet property="labelCellTitle" destination="WbW-XT-8QE" id="EsH-6m-9Dd"/>
<outlet property="imgView" destination="D99-gm-QhP" id="33R-h5-L3T"/>
</connections>
<point key="canvasLocation" x="430" y="379"/>
<point key="canvasLocation" x="156.5" y="357.5"/>
</collectionViewCell>
</objects>
<resources>
<image name="homeCollection0" width="80" height="116"/>
</resources>
</document>
......@@ -201,10 +201,10 @@
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityListViewController *commodityVC = [[CommodityListViewController alloc] init];
commodityVC.hidesBottomBarWhenPushed = YES;
CommodityListViewController *commodityVC = [[CommodityListViewController alloc] init];
commodityVC.hidesBottomBarWhenPushed = YES;
commodityVC.model = self.arrData[indexPath.section][indexPath.row];
[self.navigationController pushViewController:commodityVC animated:YES];
[self.navigationController pushViewController:commodityVC animated:YES];
}
- (void)didReceiveMemoryWarning {
......
......@@ -10,4 +10,5 @@
@interface CommodityListViewController : IBTUIViewController
@property (nonatomic, strong) id model;
@property (nonatomic, copy) NSString *type;
@end
......@@ -10,13 +10,19 @@
#import "CommodityListCollectionViewCell.h"
#import "SortView.h"
#import "CommodityDetailViewController.h"
#import "RequstBodyCommodityListModel.h"
#import "CommotityRequestModel.h"
#import "HotBrandModel.h"
#import "CatgoryModel.h"
#import "CommodityListModel/CommotityListModel.h"
#define kCellID @"commodityCell"
@interface CommodityListViewController ()<UICollectionViewDataSource, UICollectionViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) SortView *sortView;
@property (nonatomic, strong) NSMutableArray *arrItemDatas;
@property (nonatomic, assign) NSInteger page;
@end
@implementation CommodityListViewController
......@@ -31,30 +37,55 @@
// Do any additional setup after loading the view.
}
- (NSMutableArray *)arrItemDatas {
if (!_arrItemDatas) {
_arrItemDatas = [NSMutableArray array];
}
return _arrItemDatas;
}
- (void)setUpData {
RequstBodyCommodityListModel *requstBody = [[RequstBodyCommodityListModel alloc] init];
if ([self.model isKindOfClass:[HotBrandModel class]]) {
NSString *jsonString = @"{\"defintion\":{\"conditions\":[{\"operation\":\"string\",\"parameter\":{},\"parameters\":[{}]}],\"orders\":[{\"field\":\"string\",\"direction\":\"asc\"}],\"pageSize\":0,\"page\":0,\"probePages\":0},\"fetchParts\":[\"string\"]}";
NSDictionary *dic = [jsonString mj_JSONObject];
CommotityRequestModel *requstBody = [CommotityRequestModel modelObjectWithDictionary:dic];
if ([self.model isKindOfClass:[HotBrandModel class]]) {//热门品牌
//设置请求模型
HotBrandModel *model = self.model;
requstBody.defintion.conditions[0].operation = [NSString stringWithFormat:@"goodsData brand %@ equals", model.uuid];
requstBody.defintion.conditions[0].parameters = @[model.uuid];
//requstBody.defintion.orders = @[@"10",@"1",@"1"];
requstBody.defintion.pageSize = 10;
requstBody.defintion.page = 0;
requstBody.defintion.probePages = 0;
NSDictionary *params = requstBody.mj_keyValues;
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
CLog(@"d");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}else if([self.model isKindOfClass:[CatgoryModel class]]){
CatgoryModel *model = self.model;
requstBody.defintion.conditions[0].operation = [NSString stringWithFormat:@"goodsData brand %@ equals", model.uuid];
requstBody.defintion.conditions[0].parameters = @[model.uuid];
requstBody.defintion.pageSize = 10;
requstBody.defintion.page = 0;
requstBody.defintion.probePages = 0;
}
//请求模型转化为字典
NSDictionary *params = requstBody.mj_keyValues;
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
[weakSelf.arrItemDatas addObject:model];
}
[weakSelf.collectionView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
......@@ -103,7 +134,7 @@
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return 20;
return self.arrItemDatas.count;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
......@@ -114,9 +145,8 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellID forIndexPath:indexPath];
//假数据
NSArray *arr = @[@"234",@"23",@"234234",@"2344",@"33",@"2",@"234",@"23",@"234234",@"2344",@"33",@"2",@"234",@"23",@"234234",@"2344",@"33",@"2",@"234",@"23",@"234234",@"2344",@"33",@"2"];
cell.labelSalePrice.text = arr[indexPath.row];
[cell cellWithModel:self.arrItemDatas[indexPath.row]];
return cell;
}
......
......@@ -20,7 +20,7 @@
#define kCollectionViewHeadHeight 350
@interface HomeCollectionViewController ()<UICollectionViewDataSource, UICollectionViewDelegate,SDCycleScrollViewDelegate>
@property (nonatomic, strong) NSArray *cellTitle;
@property (nonatomic, strong) NSMutableArray *arrImages;
@property (nonatomic, strong) UICollectionView *collectionView;
@end
......@@ -30,7 +30,11 @@
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = NO;
_cellTitle = @[@"商品管理",@"订单管理",@"分销管理",@"客户管理",@"店铺管理",@"邀请合伙人",@"aland商城",@""];
_arrImages = [NSMutableArray array];
for (int i = 0; i < 8; i++) {
NSString *imageName = [NSString stringWithFormat:@"homeCollection%d",i];
[_arrImages addObject:imageName];
}
......@@ -38,7 +42,7 @@
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 1;
layout.minimumInteritemSpacing = 1;
layout.itemSize = CGSizeMake((ScreenSize.width - 3) / 4, (ScreenSize.width - 3) / 4 - 10);
layout.itemSize = CGSizeMake((ScreenSize.width - 3) / 4, (ScreenSize.width - 3) / 4 + 20);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) collectionViewLayout:layout];
_collectionView.backgroundColor = kBacroundColor;
......@@ -105,13 +109,12 @@
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.cellTitle.count;
return self.arrImages.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
HomeCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kHomeCollectionViewID forIndexPath:indexPath];
//cell.backgroundColor = kRandomColor;
cell.labelCellTitle.text = self.cellTitle[indexPath.row];
cell.imgView.image = [UIImage imageNamed:self.arrImages[indexPath.row]];
return cell;
}
......
......@@ -9,6 +9,7 @@
#import "ToLoginViewController.h"
#import "ResetPasswordViewController.h"
#import "BaseViewController.h"
#import "UserInfoBaseClass.h"
@interface ToLoginViewController ()
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextFiled;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextFiled;
......@@ -33,11 +34,12 @@
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
UserInfo *info = [UserInfo shareInstance];
[UserInfo mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
return @{@"description":@"adescription"};
}];
info = [UserInfo mj_objectWithKeyValues:responseObject[@"reseller"]];
// [UserInfo mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
// return @{@"description":@"adescription"};
// }];
// info = [UserInfo mj_objectWithKeyValues:responseObject[@"reseller"]];
info = [UserInfo modelObjectWithDictionary:responseObject[@"reseller"]];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
......
//
// CommotityRequestModel.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Defintion.h"
@interface CommotityRequestModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) Defintion *defintion;
@property (nonatomic, strong) NSArray *fetchParts;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// CommotityRequestModel.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "CommotityRequestModel.h"
#import "Defintion.h"
NSString *const kCommotityRequestModelDefintion = @"defintion";
NSString *const kCommotityRequestModelFetchParts = @"fetchParts";
@interface CommotityRequestModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation CommotityRequestModel
@synthesize defintion = _defintion;
@synthesize fetchParts = _fetchParts;
+ (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.defintion = [Defintion modelObjectWithDictionary:[dict objectForKey:kCommotityRequestModelDefintion]];
self.fetchParts = [self objectOrNilForKey:kCommotityRequestModelFetchParts fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.defintion dictionaryRepresentation] forKey:kCommotityRequestModelDefintion];
NSMutableArray *tempArrayForFetchParts = [NSMutableArray array];
for (NSObject *subArrayObject in self.fetchParts) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForFetchParts addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForFetchParts addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForFetchParts] forKey:kCommotityRequestModelFetchParts];
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.defintion = [aDecoder decodeObjectForKey:kCommotityRequestModelDefintion];
self.fetchParts = [aDecoder decodeObjectForKey:kCommotityRequestModelFetchParts];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_defintion forKey:kCommotityRequestModelDefintion];
[aCoder encodeObject:_fetchParts forKey:kCommotityRequestModelFetchParts];
}
- (id)copyWithZone:(NSZone *)zone
{
CommotityRequestModel *copy = [[CommotityRequestModel alloc] init];
if (copy) {
copy.defintion = [self.defintion copyWithZone:zone];
copy.fetchParts = [self.fetchParts copyWithZone:zone];
}
return copy;
}
@end
//
// Conditions.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class Parameter;
@interface Conditions : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray *parameters;
@property (nonatomic, strong) NSString *operation;
@property (nonatomic, strong) Parameter *parameter;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// Conditions.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Conditions.h"
#import "Parameters.h"
#import "Parameter.h"
NSString *const kConditionsParameters = @"parameters";
NSString *const kConditionsOperation = @"operation";
NSString *const kConditionsParameter = @"parameter";
@interface Conditions ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Conditions
@synthesize parameters = _parameters;
@synthesize operation = _operation;
@synthesize parameter = _parameter;
+ (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 *receivedParameters = [dict objectForKey:kConditionsParameters];
NSMutableArray *parsedParameters = [NSMutableArray array];
if ([receivedParameters isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedParameters) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedParameters addObject:[Parameters modelObjectWithDictionary:item]];
}
}
} else if ([receivedParameters isKindOfClass:[NSDictionary class]]) {
[parsedParameters addObject:[Parameters modelObjectWithDictionary:(NSDictionary *)receivedParameters]];
}
self.parameters = [NSArray arrayWithArray:parsedParameters];
self.operation = [self objectOrNilForKey:kConditionsOperation fromDictionary:dict];
self.parameter = [Parameter modelObjectWithDictionary:[dict objectForKey:kConditionsParameter]];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
NSMutableArray *tempArrayForParameters = [NSMutableArray array];
for (NSObject *subArrayObject in self.parameters) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForParameters addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForParameters addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForParameters] forKey:kConditionsParameters];
[mutableDict setValue:self.operation forKey:kConditionsOperation];
[mutableDict setValue:[self.parameter dictionaryRepresentation] forKey:kConditionsParameter];
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.parameters = [aDecoder decodeObjectForKey:kConditionsParameters];
self.operation = [aDecoder decodeObjectForKey:kConditionsOperation];
self.parameter = [aDecoder decodeObjectForKey:kConditionsParameter];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_parameters forKey:kConditionsParameters];
[aCoder encodeObject:_operation forKey:kConditionsOperation];
[aCoder encodeObject:_parameter forKey:kConditionsParameter];
}
- (id)copyWithZone:(NSZone *)zone
{
Conditions *copy = [[Conditions alloc] init];
if (copy) {
copy.parameters = [self.parameters copyWithZone:zone];
copy.operation = [self.operation copyWithZone:zone];
copy.parameter = [self.parameter copyWithZone:zone];
}
return copy;
}
@end
//
// DataModels.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Defintion.h" #import "Orders.h" #import "Parameter.h" #import "Conditions.h" #import "CommotityRequestModel.h" #import "Parameters.h"
\ No newline at end of file
//
// Defintion.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Conditions.h"
@interface Defintion : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double pageSize;
@property (nonatomic, strong) NSArray *orders;
@property (nonatomic, strong) NSArray<Conditions *> *conditions;
@property (nonatomic, assign) double probePages;
@property (nonatomic, assign) double page;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// Defintion.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Defintion.h"
#import "Orders.h"
#import "Conditions.h"
NSString *const kDefintionPageSize = @"pageSize";
NSString *const kDefintionOrders = @"orders";
NSString *const kDefintionConditions = @"conditions";
NSString *const kDefintionProbePages = @"probePages";
NSString *const kDefintionPage = @"page";
@interface Defintion ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Defintion
@synthesize pageSize = _pageSize;
@synthesize orders = _orders;
@synthesize conditions = _conditions;
@synthesize probePages = _probePages;
@synthesize page = _page;
+ (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.pageSize = [[self objectOrNilForKey:kDefintionPageSize fromDictionary:dict] doubleValue];
NSObject *receivedOrders = [dict objectForKey:kDefintionOrders];
NSMutableArray *parsedOrders = [NSMutableArray array];
if ([receivedOrders isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedOrders) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedOrders addObject:[Orders modelObjectWithDictionary:item]];
}
}
} else if ([receivedOrders isKindOfClass:[NSDictionary class]]) {
[parsedOrders addObject:[Orders modelObjectWithDictionary:(NSDictionary *)receivedOrders]];
}
self.orders = [NSArray arrayWithArray:parsedOrders];
NSObject *receivedConditions = [dict objectForKey:kDefintionConditions];
NSMutableArray *parsedConditions = [NSMutableArray array];
if ([receivedConditions isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedConditions) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedConditions addObject:[Conditions modelObjectWithDictionary:item]];
}
}
} else if ([receivedConditions isKindOfClass:[NSDictionary class]]) {
[parsedConditions addObject:[Conditions modelObjectWithDictionary:(NSDictionary *)receivedConditions]];
}
self.conditions = [NSArray arrayWithArray:parsedConditions];
self.probePages = [[self objectOrNilForKey:kDefintionProbePages fromDictionary:dict] doubleValue];
self.page = [[self objectOrNilForKey:kDefintionPage fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.pageSize] forKey:kDefintionPageSize];
NSMutableArray *tempArrayForOrders = [NSMutableArray array];
for (NSObject *subArrayObject in self.orders) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForOrders addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForOrders addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForOrders] forKey:kDefintionOrders];
NSMutableArray *tempArrayForConditions = [NSMutableArray array];
for (NSObject *subArrayObject in self.conditions) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForConditions addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForConditions addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForConditions] forKey:kDefintionConditions];
[mutableDict setValue:[NSNumber numberWithDouble:self.probePages] forKey:kDefintionProbePages];
[mutableDict setValue:[NSNumber numberWithDouble:self.page] forKey:kDefintionPage];
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.pageSize = [aDecoder decodeDoubleForKey:kDefintionPageSize];
self.orders = [aDecoder decodeObjectForKey:kDefintionOrders];
self.conditions = [aDecoder decodeObjectForKey:kDefintionConditions];
self.probePages = [aDecoder decodeDoubleForKey:kDefintionProbePages];
self.page = [aDecoder decodeDoubleForKey:kDefintionPage];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_pageSize forKey:kDefintionPageSize];
[aCoder encodeObject:_orders forKey:kDefintionOrders];
[aCoder encodeObject:_conditions forKey:kDefintionConditions];
[aCoder encodeDouble:_probePages forKey:kDefintionProbePages];
[aCoder encodeDouble:_page forKey:kDefintionPage];
}
- (id)copyWithZone:(NSZone *)zone
{
Defintion *copy = [[Defintion alloc] init];
if (copy) {
copy.pageSize = self.pageSize;
copy.orders = [self.orders copyWithZone:zone];
copy.conditions = [self.conditions copyWithZone:zone];
copy.probePages = self.probePages;
copy.page = self.page;
}
return copy;
}
@end
//
// Orders.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Orders : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *field;
@property (nonatomic, strong) NSString *direction;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// Orders.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Orders.h"
NSString *const kOrdersField = @"field";
NSString *const kOrdersDirection = @"direction";
@interface Orders ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Orders
@synthesize field = _field;
@synthesize direction = _direction;
+ (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.field = [self objectOrNilForKey:kOrdersField fromDictionary:dict];
self.direction = [self objectOrNilForKey:kOrdersDirection fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.field forKey:kOrdersField];
[mutableDict setValue:self.direction forKey:kOrdersDirection];
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.field = [aDecoder decodeObjectForKey:kOrdersField];
self.direction = [aDecoder decodeObjectForKey:kOrdersDirection];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_field forKey:kOrdersField];
[aCoder encodeObject:_direction forKey:kOrdersDirection];
}
- (id)copyWithZone:(NSZone *)zone
{
Orders *copy = [[Orders alloc] init];
if (copy) {
copy.field = [self.field copyWithZone:zone];
copy.direction = [self.direction copyWithZone:zone];
}
return copy;
}
@end
//
// Parameter.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Parameter : NSObject <NSCoding, NSCopying>
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// Parameter.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Parameter.h"
@interface Parameter ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Parameter
+ (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]]) {
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
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];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
}
- (id)copyWithZone:(NSZone *)zone
{
Parameter *copy = [[Parameter alloc] init];
if (copy) {
}
return copy;
}
@end
//
// Parameters.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Parameters : NSObject <NSCoding, NSCopying>
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// Parameters.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "Parameters.h"
@interface Parameters ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation Parameters
+ (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]]) {
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
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];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
}
- (id)copyWithZone:(NSZone *)zone
{
Parameters *copy = [[Parameters alloc] init];
if (copy) {
}
return copy;
}
@end
......@@ -2,148 +2,12 @@
// UserInfo.h
// ALand
//
// Created by Z on 16/3/23.
// Created by Z on 16/4/11.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@class Certificate,Lastmodifyinfo,Passwordcontrol,Shop,Createinfo,Ownerorg,Logincontrol,Operator;
@interface UserInfo : NSObject
@property (nonatomic, copy) NSString *birthday;
@property (nonatomic, copy) NSString *portrait;
@property (nonatomic, strong) Ownerorg *ownerOrg;
@property (nonatomic, copy) NSString *code;
@property (nonatomic, copy) NSString *telephone;
@property (nonatomic, copy) NSString *mobilephone;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, strong) Lastmodifyinfo *lastModifyInfo;
@property (nonatomic, copy) NSString *socialContact;
@property (nonatomic, strong) Certificate *certificate;
@property (nonatomic, assign) NSInteger version;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *invitationCode;
@property (nonatomic, copy) NSString *state;
@property (nonatomic, copy) NSString *domain;
@property (nonatomic, copy) NSString *idCard;
@property (nonatomic, copy) NSString *gender;
@property (nonatomic, strong) Passwordcontrol *passwordControl;
@property (nonatomic, copy) NSString *postalAddresses;
@property (nonatomic, strong) NSArray *roles;
@property (nonatomic, copy) NSString *referrer;
@property (nonatomic, strong) Shop *shop;
@property (nonatomic, strong) Createinfo *createInfo;
@property (nonatomic, assign) NSInteger order;
@property (nonatomic, strong) Logincontrol *loginControl;
@property (nonatomic, copy) NSString *adescription;
#import "UserInfoBaseClass.h"
@interface UserInfo : UserInfoBaseClass
+ (UserInfo *)shareInstance;
@end
@interface Certificate : NSObject
@property (nonatomic, strong) NSArray *bankCards;
@property (nonatomic, assign) BOOL idValidated;
@property (nonatomic, copy) NSString *code;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *good;
@property (nonatomic, copy) NSString *trueName;
@property (nonatomic, copy) NSString *name;
@end
@interface Lastmodifyinfo : NSObject
@property (nonatomic, assign) long long time;
@property (nonatomic, strong) Operator *aoperator;
@end
@interface Passwordcontrol : NSObject
@property (nonatomic, assign) long long created;
@property (nonatomic, copy) NSString *ainitPassword; //initPassword
@property (nonatomic, assign) long long expiry;
@end
@interface Shop : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *code;
@end
@interface Createinfo : NSObject
@property (nonatomic, strong) Operator *aoperator;
@property (nonatomic, assign) long long time;
@end
@interface Ownerorg : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *code;
@end
@interface Logincontrol : NSObject
@property (nonatomic, copy) NSString *loginIp;
@property (nonatomic, assign) long long loginTime;
@property (nonatomic, assign) NSInteger failedTimes;
@end
@interface Operator : NSObject
@property (nonatomic, copy) NSString *aid;
@property (nonatomic, copy) NSString *fullName;
@end
......@@ -2,7 +2,7 @@
// UserInfo.m
// ALand
//
// Created by Z on 16/3/23.
// Created by Z on 16/4/11.
// Copyright © 2016年 Z. All rights reserved.
//
......@@ -17,45 +17,4 @@
});
return userInfo;
}
@end
@implementation Certificate
@end
@implementation Lastmodifyinfo
@end
@implementation Passwordcontrol
@end
@implementation Shop
@end
@implementation Createinfo
@end
@implementation Ownerorg
@end
@implementation Logincontrol
@end
@implementation Operator
@end
//
// DataModels.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoCertificate.h" #import "UserInfoLastModifyInfo.h" #import "UserInfoPasswordControl.h" #import "UserInfoShop.h" #import "UserInfoCreateInfo.h" #import "UserInfoOwnerOrg.h" #import "UserInfoLoginControl.h" #import "UserInfoBaseClass.h"
\ No newline at end of file
//
// UserInfoBaseClass.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class UserInfoOwnerOrg, UserInfoLastModifyInfo, UserInfoCertificate, UserInfoPasswordControl, UserInfoShop, UserInfoCreateInfo, UserInfoLoginControl;
@interface UserInfoBaseClass : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) id birthday;
@property (nonatomic, assign) id portrait;
@property (nonatomic, strong) UserInfoOwnerOrg *ownerOrg;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, assign) id telephone;
@property (nonatomic, strong) NSString *mobilephone;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) UserInfoLastModifyInfo *lastModifyInfo;
@property (nonatomic, assign) id socialContact;
@property (nonatomic, strong) UserInfoCertificate *certificate;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *invitationCode;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) UserInfoPasswordControl *passwordControl;
@property (nonatomic, strong) NSString *gender;
@property (nonatomic, strong) NSArray *roles;
@property (nonatomic, assign) id postalAddresses;
@property (nonatomic, assign) id idCard;
@property (nonatomic, assign) id referrer;
@property (nonatomic, strong) UserInfoShop *shop;
@property (nonatomic, strong) UserInfoCreateInfo *createInfo;
@property (nonatomic, assign) double order;
@property (nonatomic, strong) UserInfoLoginControl *loginControl;
@property (nonatomic, assign) id internalBaseClassDescription;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
This diff is collapsed.
//
// UserInfoCertificate.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoCertificate : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray *bankCards;
@property (nonatomic, assign) BOOL idValidated;
@property (nonatomic, assign) id code;
@property (nonatomic, assign) id uuid;
@property (nonatomic, assign) id trueName;
@property (nonatomic, assign) id good;
@property (nonatomic, assign) id name;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoCertificate.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoCertificate.h"
NSString *const kUserInfoCertificateBankCards = @"bankCards";
NSString *const kUserInfoCertificateIdValidated = @"idValidated";
NSString *const kUserInfoCertificateCode = @"code";
NSString *const kUserInfoCertificateUuid = @"uuid";
NSString *const kUserInfoCertificateTrueName = @"trueName";
NSString *const kUserInfoCertificateGood = @"good";
NSString *const kUserInfoCertificateName = @"name";
@interface UserInfoCertificate ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoCertificate
@synthesize bankCards = _bankCards;
@synthesize idValidated = _idValidated;
@synthesize code = _code;
@synthesize uuid = _uuid;
@synthesize trueName = _trueName;
@synthesize good = _good;
@synthesize name = _name;
+ (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.bankCards = [self objectOrNilForKey:kUserInfoCertificateBankCards fromDictionary:dict];
self.idValidated = [[self objectOrNilForKey:kUserInfoCertificateIdValidated fromDictionary:dict] boolValue];
self.code = [self objectOrNilForKey:kUserInfoCertificateCode fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kUserInfoCertificateUuid fromDictionary:dict];
self.trueName = [self objectOrNilForKey:kUserInfoCertificateTrueName fromDictionary:dict];
self.good = [self objectOrNilForKey:kUserInfoCertificateGood fromDictionary:dict];
self.name = [self objectOrNilForKey:kUserInfoCertificateName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
NSMutableArray *tempArrayForBankCards = [NSMutableArray array];
for (NSObject *subArrayObject in self.bankCards) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForBankCards addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForBankCards addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForBankCards] forKey:kUserInfoCertificateBankCards];
[mutableDict setValue:[NSNumber numberWithBool:self.idValidated] forKey:kUserInfoCertificateIdValidated];
[mutableDict setValue:self.code forKey:kUserInfoCertificateCode];
[mutableDict setValue:self.uuid forKey:kUserInfoCertificateUuid];
[mutableDict setValue:self.trueName forKey:kUserInfoCertificateTrueName];
[mutableDict setValue:self.good forKey:kUserInfoCertificateGood];
[mutableDict setValue:self.name forKey:kUserInfoCertificateName];
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.bankCards = [aDecoder decodeObjectForKey:kUserInfoCertificateBankCards];
self.idValidated = [aDecoder decodeBoolForKey:kUserInfoCertificateIdValidated];
self.code = [aDecoder decodeObjectForKey:kUserInfoCertificateCode];
self.uuid = [aDecoder decodeObjectForKey:kUserInfoCertificateUuid];
self.trueName = [aDecoder decodeObjectForKey:kUserInfoCertificateTrueName];
self.good = [aDecoder decodeObjectForKey:kUserInfoCertificateGood];
self.name = [aDecoder decodeObjectForKey:kUserInfoCertificateName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_bankCards forKey:kUserInfoCertificateBankCards];
[aCoder encodeBool:_idValidated forKey:kUserInfoCertificateIdValidated];
[aCoder encodeObject:_code forKey:kUserInfoCertificateCode];
[aCoder encodeObject:_uuid forKey:kUserInfoCertificateUuid];
[aCoder encodeObject:_trueName forKey:kUserInfoCertificateTrueName];
[aCoder encodeObject:_good forKey:kUserInfoCertificateGood];
[aCoder encodeObject:_name forKey:kUserInfoCertificateName];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoCertificate *copy = [[UserInfoCertificate alloc] init];
if (copy) {
copy.bankCards = [self.bankCards copyWithZone:zone];
copy.idValidated = self.idValidated;
copy.code = [self.code copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.trueName = [self.trueName copyWithZone:zone];
copy.good = [self.good copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
}
return copy;
}
@end
//
// UserInfoCreateInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoCreateInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) id operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoCreateInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoCreateInfo.h"
NSString *const kUserInfoCreateInfoOperator = @"operator";
NSString *const kUserInfoCreateInfoTime = @"time";
@interface UserInfoCreateInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoCreateInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (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.operator = [self objectOrNilForKey:kUserInfoCreateInfoOperator fromDictionary:dict];
self.time = [[self objectOrNilForKey:kUserInfoCreateInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.operator forKey:kUserInfoCreateInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kUserInfoCreateInfoTime];
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.operator = [aDecoder decodeObjectForKey:kUserInfoCreateInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kUserInfoCreateInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kUserInfoCreateInfoOperator];
[aCoder encodeDouble:_time forKey:kUserInfoCreateInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoCreateInfo *copy = [[UserInfoCreateInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// UserInfoLastModifyInfo.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoLastModifyInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) id operator;
@property (nonatomic, assign) double time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoLastModifyInfo.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoLastModifyInfo.h"
NSString *const kUserInfoLastModifyInfoOperator = @"operator";
NSString *const kUserInfoLastModifyInfoTime = @"time";
@interface UserInfoLastModifyInfo ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoLastModifyInfo
@synthesize operator = _operator;
@synthesize time = _time;
+ (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.operator = [self objectOrNilForKey:kUserInfoLastModifyInfoOperator fromDictionary:dict];
self.time = [[self objectOrNilForKey:kUserInfoLastModifyInfoTime fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.operator forKey:kUserInfoLastModifyInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kUserInfoLastModifyInfoTime];
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.operator = [aDecoder decodeObjectForKey:kUserInfoLastModifyInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kUserInfoLastModifyInfoTime];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_operator forKey:kUserInfoLastModifyInfoOperator];
[aCoder encodeDouble:_time forKey:kUserInfoLastModifyInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoLastModifyInfo *copy = [[UserInfoLastModifyInfo alloc] init];
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
}
return copy;
}
@end
//
// UserInfoLoginControl.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoLoginControl : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *loginIp;
@property (nonatomic, assign) double loginTime;
@property (nonatomic, assign) double failedTimes;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoLoginControl.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoLoginControl.h"
NSString *const kUserInfoLoginControlLoginIp = @"loginIp";
NSString *const kUserInfoLoginControlLoginTime = @"loginTime";
NSString *const kUserInfoLoginControlFailedTimes = @"failedTimes";
@interface UserInfoLoginControl ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoLoginControl
@synthesize loginIp = _loginIp;
@synthesize loginTime = _loginTime;
@synthesize failedTimes = _failedTimes;
+ (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.loginIp = [self objectOrNilForKey:kUserInfoLoginControlLoginIp fromDictionary:dict];
self.loginTime = [[self objectOrNilForKey:kUserInfoLoginControlLoginTime fromDictionary:dict] doubleValue];
self.failedTimes = [[self objectOrNilForKey:kUserInfoLoginControlFailedTimes fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.loginIp forKey:kUserInfoLoginControlLoginIp];
[mutableDict setValue:[NSNumber numberWithDouble:self.loginTime] forKey:kUserInfoLoginControlLoginTime];
[mutableDict setValue:[NSNumber numberWithDouble:self.failedTimes] forKey:kUserInfoLoginControlFailedTimes];
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.loginIp = [aDecoder decodeObjectForKey:kUserInfoLoginControlLoginIp];
self.loginTime = [aDecoder decodeDoubleForKey:kUserInfoLoginControlLoginTime];
self.failedTimes = [aDecoder decodeDoubleForKey:kUserInfoLoginControlFailedTimes];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_loginIp forKey:kUserInfoLoginControlLoginIp];
[aCoder encodeDouble:_loginTime forKey:kUserInfoLoginControlLoginTime];
[aCoder encodeDouble:_failedTimes forKey:kUserInfoLoginControlFailedTimes];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoLoginControl *copy = [[UserInfoLoginControl alloc] init];
if (copy) {
copy.loginIp = [self.loginIp copyWithZone:zone];
copy.loginTime = self.loginTime;
copy.failedTimes = self.failedTimes;
}
return copy;
}
@end
//
// UserInfoOwnerOrg.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoOwnerOrg : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoOwnerOrg.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoOwnerOrg.h"
NSString *const kUserInfoOwnerOrgName = @"name";
NSString *const kUserInfoOwnerOrgUuid = @"uuid";
NSString *const kUserInfoOwnerOrgCode = @"code";
@interface UserInfoOwnerOrg ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoOwnerOrg
@synthesize name = _name;
@synthesize uuid = _uuid;
@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.name = [self objectOrNilForKey:kUserInfoOwnerOrgName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kUserInfoOwnerOrgUuid fromDictionary:dict];
self.code = [self objectOrNilForKey:kUserInfoOwnerOrgCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kUserInfoOwnerOrgName];
[mutableDict setValue:self.uuid forKey:kUserInfoOwnerOrgUuid];
[mutableDict setValue:self.code forKey:kUserInfoOwnerOrgCode];
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.name = [aDecoder decodeObjectForKey:kUserInfoOwnerOrgName];
self.uuid = [aDecoder decodeObjectForKey:kUserInfoOwnerOrgUuid];
self.code = [aDecoder decodeObjectForKey:kUserInfoOwnerOrgCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kUserInfoOwnerOrgName];
[aCoder encodeObject:_uuid forKey:kUserInfoOwnerOrgUuid];
[aCoder encodeObject:_code forKey:kUserInfoOwnerOrgCode];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoOwnerOrg *copy = [[UserInfoOwnerOrg alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
}
return copy;
}
@end
//
// UserInfoPasswordControl.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoPasswordControl : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double created;
@property (nonatomic, assign) id initPassword;
@property (nonatomic, assign) double expiry;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoPasswordControl.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoPasswordControl.h"
NSString *const kUserInfoPasswordControlCreated = @"created";
NSString *const kUserInfoPasswordControlInitPassword = @"initPassword";
NSString *const kUserInfoPasswordControlExpiry = @"expiry";
@interface UserInfoPasswordControl ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoPasswordControl
@synthesize created = _created;
@synthesize initPassword = _initPassword;
@synthesize expiry = _expiry;
+ (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.created = [[self objectOrNilForKey:kUserInfoPasswordControlCreated fromDictionary:dict] doubleValue];
self.initPassword = [self objectOrNilForKey:kUserInfoPasswordControlInitPassword fromDictionary:dict];
self.expiry = [[self objectOrNilForKey:kUserInfoPasswordControlExpiry fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.created] forKey:kUserInfoPasswordControlCreated];
[mutableDict setValue:self.initPassword forKey:kUserInfoPasswordControlInitPassword];
[mutableDict setValue:[NSNumber numberWithDouble:self.expiry] forKey:kUserInfoPasswordControlExpiry];
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.created = [aDecoder decodeDoubleForKey:kUserInfoPasswordControlCreated];
self.initPassword = [aDecoder decodeObjectForKey:kUserInfoPasswordControlInitPassword];
self.expiry = [aDecoder decodeDoubleForKey:kUserInfoPasswordControlExpiry];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_created forKey:kUserInfoPasswordControlCreated];
[aCoder encodeObject:_initPassword forKey:kUserInfoPasswordControlInitPassword];
[aCoder encodeDouble:_expiry forKey:kUserInfoPasswordControlExpiry];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoPasswordControl *copy = [[UserInfoPasswordControl alloc] init];
if (copy) {
copy.created = self.created;
copy.initPassword = [self.initPassword copyWithZone:zone];
copy.expiry = self.expiry;
}
return copy;
}
@end
//
// UserInfoShop.h
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UserInfoShop : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// UserInfoShop.m
//
// Created by Z on 16/4/11
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "UserInfoShop.h"
NSString *const kUserInfoShopName = @"name";
NSString *const kUserInfoShopUuid = @"uuid";
NSString *const kUserInfoShopCode = @"code";
@interface UserInfoShop ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation UserInfoShop
@synthesize name = _name;
@synthesize uuid = _uuid;
@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.name = [self objectOrNilForKey:kUserInfoShopName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kUserInfoShopUuid fromDictionary:dict];
self.code = [self objectOrNilForKey:kUserInfoShopCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kUserInfoShopName];
[mutableDict setValue:self.uuid forKey:kUserInfoShopUuid];
[mutableDict setValue:self.code forKey:kUserInfoShopCode];
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.name = [aDecoder decodeObjectForKey:kUserInfoShopName];
self.uuid = [aDecoder decodeObjectForKey:kUserInfoShopUuid];
self.code = [aDecoder decodeObjectForKey:kUserInfoShopCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kUserInfoShopName];
[aCoder encodeObject:_uuid forKey:kUserInfoShopUuid];
[aCoder encodeObject:_code forKey:kUserInfoShopCode];
}
- (id)copyWithZone:(NSZone *)zone
{
UserInfoShop *copy = [[UserInfoShop alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
}
return copy;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment