20160909 模型对象 的 丰富化。

把 有的数据源有, 有的数据源没有 的 属性, 变成 对象可选 属性,就没问题了。
有的数据源有, 有的数据源没有 的 属性, 作为 基本 属性,就有问题。
模型对象 的 丰富化。



#import <JSONModel/JSONModel.h>

@class InfoModel;
@class UserModel;
@class VideoModel;
@class CommentModel;
@class ImageModel;
@class GifModel;
@protocol ListModel;
@protocol TagModel;
@protocol NSString;
@protocol CommentModel;

@interface EssenceModel : JSONModel

@property (nonatomic, strong)InfoModel<Optional> *info;
@property (nonatomic, strong)NSMutableArray<Optional,ListModel> *list;

@end

@interface InfoModel : JSONModel

@property (nonatomic, assign)NSInteger count;
@property (nonatomic, assign)NSInteger np;

@end

@interface ListModel : JSONModel

@property (nonatomic, assign)NSInteger status;
@property (nonatomic, strong)NSString<Optional> *comment;

@property (nonatomic, strong)NSArray<Optional,CommentModel> *top_comments;//C
//视频

@property (nonatomic, strong)CommentModel<Optional> *top_comment;//C

@property (nonatomic, strong)NSArray<Optional,TagModel> *tags;

@property (nonatomic, strong)NSString<Optional> *bookmark;
@property (nonatomic, strong)NSString<Optional> *text;
@property (nonatomic, strong)NSString<Optional> *up;

@property (nonatomic, strong)NSString<Optional> *share_url;
@property (nonatomic, assign)NSInteger down;
@property (nonatomic, assign)NSInteger forward;

@property (nonatomic, strong)UserModel<Optional> *u;
@property (nonatomic, strong)NSString<Optional> *passtime;
@property (nonatomic, strong)VideoModel<Optional> *video;

@property (nonatomic, strong)NSString<Optional> *type;
@property (nonatomic, strong)NSString<Optional> *listId;

//添加一个cell的高度属性
@property (nonatomic, strong)NSNumber<Optional> *cellHeight;//C
// 传值

//  把 有的数据源有, 有的数据源没有 的 属性, 变成 对象可选 属性,就没问题了。
//  有的数据源有, 有的数据源没有 的 属性, 作为 基本 属性,就有问题。
//  模型对象 的 丰富化。

@property (nonatomic, strong) ImageModel<Optional> * image;//C

@property (nonatomic, strong) GifModel<Optional> * gif;//C

@end

添加一个cell的高度属性
@property (nonatomic, strong)NSNumber<Optional> *cellHeight;//C
传值


@interface ImageModel : JSONModel

@property (nonatomic, strong) NSArray <NSString ,Optional> * medium ;
@property (nonatomic, strong) NSArray <NSString ,Optional> * big ;
@property (nonatomic, strong) NSArray <NSString ,Optional> * download_url ;

@property (nonatomic, strong) NSArray <NSString ,Optional> * small ;
@property (nonatomic, strong) NSArray <NSString ,Optional> * thumbnail_small ;
@property (nonatomic, assign) NSInteger  height ;

@property (nonatomic, assign) NSInteger  width ;

@end

@interface GifModel : JSONModel

@property (nonatomic, strong) NSArray <NSString ,Optional> * images ;
@property (nonatomic, strong) NSArray <NSString ,Optional> * gif_thumbnail ;
@property (nonatomic, strong) NSArray <NSString ,Optional> * download_url ;

@property (nonatomic, assign) NSInteger  height ;

@property (nonatomic, assign) NSInteger  width ;

@end

@interface CommentModel : JSONModel

@property (nonatomic, assign)NSInteger voicetime;
@property (nonatomic, assign)NSInteger precid;
@property (nonatomic, strong)NSString<Optional> * content;

@property (nonatomic, assign)NSInteger like_count;
@property (nonatomic, strong)UserModel<Optional> *u;

@property (nonatomic, assign)NSInteger preuid;
@property (nonatomic, assign)NSInteger commentId;
@property (nonatomic, strong)NSString<Optional> * passtime;

@property (nonatomic, assign)NSInteger voiceuri;
//id
@end

@interface TagModel : JSONModel

@property (nonatomic, assign)NSInteger tagId;
@property (nonatomic, strong)NSString<Optional> *name;

@end

@interface UserModel : JSONModel

@property (nonatomic, strong)NSArray<Optional,NSString> *header;
@property (nonatomic, strong)NSNumber<Optional> *is_v;
@property (nonatomic, strong)NSString<Optional> *uid;

@property (nonatomic, strong)NSNumber<Optional> *is_vip;
@property (nonatomic, strong)NSString<Optional> *name;

@property (nonatomic, strong)NSString<Optional> *sex;

@end

@interface VideoModel : JSONModel

@property (nonatomic, assign)NSInteger playfcount;
@property (nonatomic, assign)NSInteger height;
@property (nonatomic, assign)NSInteger width;

@property (nonatomic, strong)NSArray<Optional,NSString> *video;
@property (nonatomic, strong)NSArray<Optional,NSString> *download;

@property (nonatomic, assign)NSInteger duration;
@property (nonatomic, assign)NSInteger playcount;

@property (nonatomic, strong)NSArray<Optional,NSString> *thumbnail;
@property (nonatomic, strong)NSArray<Optional,NSString> *thumbnail_small;

@end


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容