123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- //
- // User.m
- // FirstLink
- //
- // Created by unicode on 14-9-30.
- // Copyright (c) 2014年 FirstLink. All rights reserved.
- //
- #import "User.h"
- @implementation User
- @synthesize isNew = _isNew;
- @synthesize headurl = _headurl;
- @synthesize mobile = _mobile;
- @synthesize nickName = _nickName;
- @synthesize status = _status;
- @synthesize level = _level;
- @synthesize token = _token;
- @synthesize userID = _userID;
- + (NSDictionary*)mts_mapping
- {
- return @{
- @"data.user.headurl": mts_key(headurl),
- @"data.user.mobile": mts_key(mobile),
- @"data.user.nickname": mts_key(nickName),
- @"data.user.status": mts_key(status),
- @"data.user.level": mts_key(level),
- @"data.user.token": mts_key(token),
- @"data.user.userid": mts_key(userID),
- @"data.regist_mark": mts_key(markCode),
- };
- }
- + (BOOL)mts_shouldSetUndefinedKeys
- {
- return NO;
- }
- - (void) encodeWithCoder:(NSCoder *)encoder {
- [encoder encodeObject:_isNew forKey:kIsNew];
- [encoder encodeObject:_headurl forKey:kHeadURL];
- [encoder encodeObject:_mobile forKey:kMobile];
- [encoder encodeObject:_nickName forKey:kNickName];
- [encoder encodeObject:_status forKey:kStatus];
- [encoder encodeObject:_level forKey:kLevel];
- [encoder encodeObject:_token forKey:kToken];
- [encoder encodeObject:_userID forKey:kUserID];
- [encoder encodeObject:_introduce forKey:kIntroduce];
- }
- - (id)initWithCoder:(NSCoder *)aDecoder {
- self = [super init];
- if(self) {
- self.isNew = [aDecoder decodeObjectForKey:kIsNew];
- self.headurl = [aDecoder decodeObjectForKey:kHeadURL];
- self.mobile = [aDecoder decodeObjectForKey:kMobile];
- self.nickName = [aDecoder decodeObjectForKey:kNickName];
- self.status = [aDecoder decodeObjectForKey:kStatus];
- self.level = [aDecoder decodeObjectForKey:kLevel];
- self.token = [aDecoder decodeObjectForKey:kToken];
- self.userID = [aDecoder decodeObjectForKey:kUserID];
- self.introduce = [aDecoder decodeObjectForKey:kIntroduce];
- }
- return self;
- }
- - (id)mutableCopyWithZone:(NSZone *)zone {
-
- User *copy = [[User alloc] init];
-
- copy.isNew = [self.isNew mutableCopy];
- copy.headurl = [self.headurl mutableCopy];
- copy.mobile = [self.mobile mutableCopy];
- copy.nickName = [self.nickName mutableCopy];
- copy.status = [self.status mutableCopy];
- copy.level = [self.level mutableCopy];
- copy.token = [self.token mutableCopy];
- copy.umengToken = [self.umengToken mutableCopy];
- copy.userID = [self.userID mutableCopy];
- copy.introduce = [self.introduce mutableCopy];
- copy.lastLoginType = self.lastLoginType;
-
- return copy;
- }
- #pragma mark - Business Method
- - (BOOL)isVIP {
- if (self.level.intValue >= 2) {
- return TRUE;
- }
- return FALSE;
- }
- - (BOOL)isVipWithDiscount {
- if (self.level.intValue == 2) {
- return TRUE;
- }
- return FALSE;
- }
- @end
|