@implementation ResponseState
+ (ResponseState*)responseWithDic:(NSDictionary *)dic
{
ResponseState* response = [[ResponseStatealloc] init];
response.status = [[dic valueForKeyNullReplace:@"status"] intValue];
response.message = [dic valueForKeyNullReplace:@"message"];
response.remainTime = [[dic valueForKeyNullReplace:@"remainTime"] intValue];
id number = [dic valueForKeyNullReplace:@"hasmore"];
if (![number isKindOfClass:[NSNull class]]) {
response.hasMore = [[dic valueForKeyNullReplace:@"hasmore"] boolValue];
}
return response;
}
@end
@implementation ResponseState
+ (ResponseState*)responseStateWithJson:(NSDictionary*)json
{
ResponseState* state = [[ResponseStatealloc] init];
state.flag = [[json objectForKey:@"flag"] intValue];
state.message = [json objectForKey:@"msg"];
state.total = [[json objectForKey:@"total"] intValue];
state.current = [[json objectForKey:@"this"] intValue];
return state;
}
@end