知乎日报-Model

1、HomePage 数据

{
  "date":"20140621",
  "stories":[{
    "title":"眼花缭乱的时装周上,眼睛不能只盯着模特",
    "share_url":"http://daily.zhihu.com/story/3980042",
    "ga_prefix":"062120",
    "images":["
        http://p3.zhimg.com/24/7b/247bcebba402d03c48a036f97f65c7de.jpg"],
    "type":0,
    "id":3980042
  },, ... ], 

  "top_stories":[{
    "title":"为什么今天很多人照相喜欢摆 V 手势?",
    "image":"http://p2.zhimg.com/55/c3/55c3296b5fb9bcc68c938242e4da8994.jpg",
    "share_url":"http://daily.zhihu.com/story/3983436",
    "ga_prefix":"062118",
    "type":0,
    "id":3983436},, ... ]
}

date : 日期
stories : 当日新闻
title : 新闻标题
image : 图像地址
share_ur: 供在线查看内容与分享至 SNS 用的 URL
ga_prefix : 供 Google Analytics 使用
内容获取

(数据转模型)StoryModel

@property(copy,nonatomic)NSString *title;   //日报标题
@property(copy,nonatomic)NSNumber *storyID; //日报id
@property(strong,nonatomic)NSArray *images; //图片url数组
@property(assign,nonatomic)BOOL isMultipic; //是否多图
@property(strong,nonatomic)NSNumber *type;  //日报类型
@property(copy,nonatomic)NSString *image;   //图片

2、DailyNewsContent 数据

{
    "body": ...,
    "image_source": "SIGitas MATulis / CC BY-SA",
    "title": "为什么今天很多人照相喜欢摆 V 手势?",
    "image": "http://p2.zhimg.com/55/c3/55c3296b5fb9bcc68c938242e4da8994.jpg",
    "share_url": "http://daily.zhihu.com/story/3983436",
    "js": 
    [
      "http://news-at.zhihu.com/js/story.js?v=97942"
    ],
    "ga_prefix": "062118",
    "type": ​0,
    "id": ​3983436,
    "css": 
    [
        "http://news-at.zhihu.com/css/news_qa.auto.css?v=77778"
    ]
}

(数据转模型)StoryContentModel

  • 其中ID转为storyID
  • recommenders没有
@property(copy,nonatomic)NSString *body;
@property(copy,nonatomic)NSString *image_source;
@property(copy,nonatomic)NSString *title;
@property(copy,nonatomic)NSString *image;
@property(copy,nonatomic)NSNumber *storyID;//ID->storyID
@property(copy,nonatomic)NSArray *css;
@property(copy,nonatomic)NSString *share_url;
@property(strong,nonatomic)NSArray *recommenders;//这个数据没有
@property(strong,nonatomic)NSNumber *type;

(更高级数据封装)StoryContentViewModel

@property(copy,nonatomic)NSNumber *loadedStoryID;
@property(strong,nonatomic)NSMutableArray *storiesID;
@property(strong,nonatomic)StoryContentModel *storyModel;
@property(copy,nonatomic)NSString *imageURLString;
@property(copy,nonatomic)NSAttributedString *titleAttText;
@property(copy,nonatomic)NSString *imaSourceText;
@property(copy,nonatomic)NSString *htmlStr;
@property(copy,nonatomic)NSString *share_URL;
@property(copy,nonatomic)NSNumber *storyType;
@property(strong,nonatomic)NSArray *recommenders;

3、LeftMenu 数据

{

    "limit": ​1000,
    "subscribed": [ ],
    "others": [
      {
        "color": ​15007,
        "thumbnail": "http://pic3.zhimg.com/0e71e90fd6be47630399d63c58beebfc.jpg",
        "description": "了解自己和别人,了解彼此的欲望和局限。",
        "id": ​13,
        "name": "日常心理学"
},...]

(数据转模型)ThemeItemModel

  • limit数据忽略
  • subscribed 和 oterhs 数据模型都使用下面的数据模型
  • 其中color, thumbnail,description忽略
  • ID->themeID
@interface ThemeItemModel : NSObject

@property(copy,nonatomic) NSString *name;
@property(copy,nonatomic) NSNumber *themeID;

- (instancetype)initWithDictionary:(NSDictionary *)dic;
@end

4、ThemePage 数据

{
    "stories": [
    {
        "images": 
        [
            "http://pic2.zhimg.com/878b8960b617bfb4721a103e24a0509d.jpg"
        ],
        "type": ​0,
        "id": ​7785695,
        "title": "Necromanov:分裂红海:辐射4的喧嚣和争议"
    }, ...],
    "description": "如果你喜欢游戏,就从这里开始",
    "background": "http://p2.zhimg.com/55/e0/55e06f8fe322fd87b3261b204bae4786.jpg",
    "color": ​59647,
    "name": "开始游戏",
    "image": "http://p3.zhimg.com/64/5c/645cde143c9a371005f3f749366cffad.jpg",
    editors": [
    {
        "url": "http://www.zhihu.com/people/necromanov",
        "bio": "战略航空军旗舰的元帅",
        "id": ​3,
        "avatar": "http://pic4.zhimg.com/3553d57db_m.jpg",
        "name": "Necromanov"
    }, ...]
    "image_source": ""
}

(数据转模型)DailyThemesViewModel

@property (strong,nonatomic) NSMutableArray *stories;
@property (strong,nonatomic) NSString *imageURLStr;
@property (strong,nonatomic) NSString *name;
@property (strong,nonatomic) NSArray *editors;
Copyright © 翻这个墙 2016 all right reserved,powered by Gitbook该文件修订时间: 2016-04-06 21:28:43