|
//
// readHistoryViewModel.m
// ThePaperBase
//
// Created by Huixin on 15/9/29.
// Copyright © 2015年 scar1900. All rights reserved.
//
#import "readHistoryViewModel.h"
@interface readHistoryViewModel()<RemoteDelegate>
@end
@implementation readHistoryViewModel
- (void)getReadHistoryWithURL:(NSString *)url {
__weak typeof(self) Self = self;
if (isBlankString(url)) {
url = myReadHistoryURL;
}
[Remote doJsonActionWithBlock:0 requestUrl:url parameter:nil withWaitCursor:YES completion:^(BOOL success, NSString *message, id responseData) {
if (success) {
NSMutableArray *dataList = responseData[@"dataList"];
NSMutableArray *readHistoryList = [NSMutableArray array];
[dataList enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
listContObjectVO *listBo = setJsonDicToDataModel(obj, [listContObjectVO class]);
[readHistoryList addObject:listBo];
}];
NSString *url = responseData[@"nextUrl"];
if ([Self.delegate respondsToSelector:@selector(returnReadHistoryList:nextUrl:)]) {
[Self.delegate returnReadHistoryList:readHistoryList nextUrl:url];
}
}else {
// ShowTextMessage(message);
if ([Self.delegate respondsToSelector:@selector(returnErrorMessage:)]) {
[Self.delegate returnErrorMessage:message];
}
}
}];
}
@end
|