FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Models/CodingTips.m at master · Jerrywx/Coding-iOS · GitHub
Jerrywx
/
Coding-iOS
Public
forked from
coding/Coding-iOS
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Models
/
CodingTips.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
99 lines (92 loc) · 2.88 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Models
/
CodingTips.m
Copy path
File metadata and controls
executable file
·
99 lines (92 loc) · 2.88 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"
: [
NSNumber
numberWithInteger:
0
],
@"
page
"
: _willLoadMore? [
NSNumber
numberWithInteger:
_page.integerValue +
1
]: [
NSNumber
numberWithInteger:
1
],
@"
pageSize
"
: _pageSize};
}
else
if
(_type ==
1
){
params = @{
@"
type
"
: [
NSArray
arrayWithObjects:
[
NSNumber
numberWithInteger:
1
], [
NSNumber
numberWithInteger:
2
],
nil
],
@"
page
"
: _willLoadMore? [
NSNumber
numberWithInteger:
_page.integerValue +
1
]: [
NSNumber
numberWithInteger:
1
],
@"
pageSize
"
: _pageSize};
}
else
if
(_type ==
2
){
params = @{
@"
type
"
: [
NSNumber
numberWithInteger:
4
],
@"
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
Back
|
FazBrowse Home
|
New Git URL