GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coding-iOS/Coding_iOS/Models/CodingTips.m at master · EADINGSmart/Coding-iOS Expand file tree/ Copy pathCodingTips.mMore file actions executable file ·99 lines (92 loc) · 2.75 KB / Copy pathCodingTips.mFile metadata and controlsexecutable file ·99 lines (92 loc) · 2.75 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 // // CodingTips.m // Coding_iOS // // Created by 王 原闯 on 14-9-2. // Copyright (c) 2014年 Coding. All rights reserved. // #import "CodingTips.h" @implementation CodingTips - (instancetype)init { self = [super init]; if (self) { _propertyArrayMap = [NSDictionary dictionaryWithObjectsAndKeys: @"CodingTip", @"list", nil]; _canLoadMore = YES; _isLoading = _willLoadMore = NO; _page = [NSNumber numberWithInteger:1]; _pageSize = [NSNumber numberWithInteger:20]; _type = 0; } return self; } - (void)setOnlyUnread:(BOOL)onlyUnread{ if (_onlyUnread != onlyUnread) { _onlyUnread = onlyUnread; //初始化数据 _page = [NSNumber numberWithInteger:1]; _pageSize = [NSNumber numberWithInteger:20]; _canLoadMore = YES; if (_list) { [_list removeAllObjects]; } } } +(CodingTips *)codingTipsWithType:(NSInteger)type{ CodingTips *tips = [[CodingTips alloc] init]; tips.type = type; return tips; } - (void)configWithObj:(CodingTips *)tips{ self.page = tips.page; self.pageSize = tips.pageSize; self.totalPage = tips.totalPage; if (_willLoadMore) { [self.list addObjectsFromArray:tips.list]; }else{ self.list = [NSMutableArray arrayWithArray:tips.list]; } _canLoadMore = _page.intValue < _totalPage.intValue; } - (NSString *)toTipsPath{ NSString *path; if (_onlyUnread) { path = @"api/notification/unread-list"; }else{ path = @"api/notification"; } return path; } - (NSDictionary *)toTipsParams{ NSDictionary *params; if (_type == 0) { params = @{@"type" : @(0), @"page" : _willLoadMore? [NSNumber numberWithInteger:_page.integerValue +1]: [NSNumber numberWithInteger:1], @"pageSize" : _pageSize}; }else if (_type == 1){ params = @{@"type" : @[@(1), @(2)], @"page" : _willLoadMore? [NSNumber numberWithInteger:_page.integerValue +1]: [NSNumber numberWithInteger:1], @"pageSize" : _pageSize}; }else if (_type == 2){ params = @{@"type" : @[@(4), @(6)], @"page" : _willLoadMore? [NSNumber numberWithInteger:_page.integerValue +1]: [NSNumber numberWithInteger:1], @"pageSize" : _pageSize}; } return params; } - (NSDictionary *)toMarkReadParams{ NSDictionary *params; if (_type == 0) { params = @{@"type" : @(0), @"all" : @(1)}; }else if (_type == 1){ params = @{@"type" : @[@(1), @(2)], @"all" : @(1)}; }else if (_type == 2){ params = @{@"type" : @(4), @"all" : @(1)}; } return params; } @end |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |