12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // PageResponseInfo.m
- // FirstLink
- //
- // Created by unicode on 14-11-10.
- // Copyright (c) 2014年 FirstLink. All rights reserved.
- //
- #import "PageHeader.h"
- @implementation PageHeader
- + (PageHeader*)defaultPageHeader {
- PageHeader *header = [[PageHeader alloc] init];
- header.pageSize = [NSString stringWithFormat:@"%d", PAGE_RECORD_COUNT];
- return header;
- }
- + (PageHeader*)parserHeader:(NSDictionary *)json {
- if (json[@"data"][@"pager"] != [NSNull null]) {
- NSDictionary *pageData = json[@"data"][@"pager"];
- PageHeader *header = [[PageHeader alloc] init];
-
- if (pageData[@"index"] != [NSNull null]) {
- header.index = [NSString stringWithFormat:@"%@", pageData[@"index"]];
- }
- if (pageData[@"anchor_id"] != [NSNull null]) {
- header.anchorID = [NSString stringWithFormat:@"%@", pageData[@"anchor_id"]];
- }
- if (pageData[@"page_size"]) {
- header.pageSize = [NSString stringWithFormat:@"%@", pageData[@"page_size"]];
- }
- if (pageData[@"start_row"] != [NSNull null]) {
- header.startRow = [NSString stringWithFormat:@"%@", pageData[@"start_row"]];
- }
-
- return header;
- }
- return [PageHeader defaultPageHeader];
- }
- @end
|