Skip to content

Commit 0f62205

Browse files
committed
冒泡 last_id 更改为 last_time
1 parent 7d8e19f commit 0f62205

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

Coding_iOS/Models/Tweet.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@interface Tweet : NSObject
1919
@property (readwrite, nonatomic, strong) NSString *content, *device, *location, *coord, *address;
2020
@property (readwrite, nonatomic, strong) NSNumber *liked, *rewarded, *activity_id, *id, *comments, *likes, *rewards;
21-
@property (readwrite, nonatomic, strong) NSDate *created_at;
21+
@property (readwrite, nonatomic, strong) NSDate *created_at, *sort_time;
2222
@property (readwrite, nonatomic, strong) User *owner;
2323
@property (readwrite, nonatomic, strong) NSMutableArray *comment_list, *like_users, *reward_users;
2424
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;

Coding_iOS/Models/Tweets.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ typedef NS_ENUM(NSInteger, TweetType)
2525

2626

2727
@interface Tweets : NSObject
28-
@property (readwrite, nonatomic, strong) NSNumber *last_id;
28+
@property (strong, nonatomic, readonly) NSDate *last_time;
2929
@property (assign, nonatomic) BOOL canLoadMore, willLoadMore, isLoading;
3030
@property (assign, nonatomic) TweetType tweetType;
3131
@property (readwrite, nonatomic, strong) NSMutableArray *list;
@@ -37,7 +37,6 @@ typedef NS_ENUM(NSInteger, TweetType)
3737

3838
+ (Tweets *)tweetsWithType:(TweetType)tweetType;
3939
+ (Tweets *)tweetsWithUser:(User *)curUser;
40-
- (NSString *)localResponsePath;
4140
- (void)configWithTweets:(NSArray *)responseA;
4241

4342
- (NSString *)toPath;

Coding_iOS/Models/Tweets.m

+4-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ - (instancetype)init
1818
if (self) {
1919
_propertyArrayMap = [NSDictionary dictionaryWithObjectsAndKeys:
2020
@"Tweet", @"list", nil];
21+
_last_time = nil;
2122
}
2223
return self;
2324
}
@@ -26,7 +27,6 @@ - (instancetype)init
2627
+ (Tweets *)tweetsWithType:(TweetType)tweetType{
2728
Tweets *tweets = [[Tweets alloc] init];
2829
tweets.tweetType = tweetType;
29-
tweets.last_id = kDefaultLastId;
3030
tweets.canLoadMore = NO;
3131
tweets.isLoading = NO;
3232
tweets.willLoadMore = NO;
@@ -78,25 +78,16 @@ - (NSDictionary *)toParams{
7878
default:
7979
break;
8080
}
81-
[params setObject:(_willLoadMore? _last_id:kDefaultLastId) forKey:@"last_id"];
82-
// if (kDevice_Is_iPhone6Plus) {
83-
// params[@"default_like_count"] = @12;
84-
// }
81+
params[@"last_time"] = _willLoadMore? @((NSUInteger)([_last_time timeIntervalSince1970] * 1000)): nil;
82+
8583
return params;
8684
}
8785

88-
- (NSString *)localResponsePath{
89-
if ([_last_id isEqualToNumber:kDefaultLastId]) {
90-
return [NSString stringWithFormat:@"ActivieiesWithType_%d", (int)_tweetType];
91-
}else{
92-
return nil;
93-
}
94-
}
9586
- (void)configWithTweets:(NSArray *)responseA{
9687
if (responseA && [responseA count] > 0) {
9788
self.canLoadMore = (_tweetType != TweetTypePublicHot);
9889
Tweet *lastTweet = [responseA lastObject];
99-
self.last_id = lastTweet.id;
90+
_last_time = lastTweet.sort_time;
10091
if (_willLoadMore) {
10192
[_list addObjectsFromArray:responseA];
10293
}else{

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

-2
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,6 @@ - (void)request_Tweets_WithObj:(Tweets *)tweets andBlock:(void (^)(id data, NSEr
16511651

16521652
if (data) {
16531653
[MobClick event:kUmeng_Event_Request_RootList label:@"冒泡_列表"];
1654-
1655-
[NSObject saveResponseData:data toPath:[tweets localResponsePath]];
16561654
id resultData = [data valueForKeyPath:@"data"];
16571655
NSArray *resultA = [NSObject arrayFromJSON:resultData ofObjects:@"Tweet"];
16581656
block(resultA, nil);

0 commit comments

Comments
 (0)