12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // YOUPAIHRsendRankModel.m
- // VQU
- //
- // Created by xiaohaoran on 2021/10/21.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIHRsendRankModel.h"
- @implementation YOUPAIHRsendRankModel
- - (instancetype)init
- {
- self = [super init];
- if (self) {
-
- }
- return self;
- }
- - (id) initWithCoder: (NSCoder *)decoder
- {
- if (self = [super init]) {
- unsigned int count = 0;
- //获取类中所有成员变量名
- Ivar *ivar = class_copyIvarList([YOUPAILCBaseInfo class], &count);
- for (int i = 0; i<count; i++) {
- Ivar iva = ivar[i];
- const char *name = ivar_getName(iva);
- NSString *strName = [NSString stringWithUTF8String:name];
- //进行解档取值
- id value = [decoder decodeObjectForKey:strName];
- //利用KVC对属性赋值
- if(value){
- [self setValue:value forKey:strName];
- }
- }
- free(ivar);
- }
- return self;
- }
- - (void) encodeWithCoder: (NSCoder *)encoder
- {
- unsigned int count;
- Ivar *ivar = class_copyIvarList([YOUPAILCBaseInfo class], &count);
- for (int i=0; i<count; i++) {
- Ivar iv = ivar[i];
- const char *name = ivar_getName(iv);
- NSString *strName = [NSString stringWithUTF8String:name];
- //利用KVC取值
- id value = [self valueForKey:strName];
- [encoder encodeObject:value forKey:strName];
- }
- free(ivar);
- }
- + (NSDictionary *)mj_replacedKeyFromPropertyName
- {
- return @{
- @"youpaipgrade":@"grade",
- @"youpaiprankInfo":@"rankInfo",
- @"youpaipavatar":@"avatar",
- @"youpaipavatar_frame":@"avatar_frame",
- @"youpaipcreatetime":@"createtime",
- @"youpaipexprise_in":@"exprise_in",
- @"youpaipexprisetime":@"exprisetime",
- @"youpaiptoken":@"token",
- @"youpaipid":@"id",
- @"youpaipnickname":@"nickname",
- @"youpaipis_follow":@"is_follow",
- @"youpaipremark_name":@"remark_name",
- @"youpaipgender":@"gender",
- @"youpaipis_anchor":@"is_anchor",
- @"youpaipamount":@"amount",
- @"youpaipvip":@"vip",
- @"youpaipvip_icon":@"vip_icon",
- @"youpaipvip_expire":@"vip_expire",
- @"youpaipvip_des":@"vip_des",
- @"youpaipis_msg_refuse":@"is_msg_refuse",
- @"youpaipis_live":@"is_live",
- @"youpaipsign":@"sign",
- @"youpaipbadge_info":@"badge_info",
- @"youpaipmsg":@"msg",
- };
- }
- @end
|