Initial commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// GiGaAPIResult.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/8/15.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaAPIResult.h"
|
||||
|
||||
@implementation GiGaAPIResult
|
||||
|
||||
-(BOOL)success{
|
||||
|
||||
return self.status == 0;
|
||||
|
||||
}
|
||||
|
||||
-(id)initWithDictionary:(NSDictionary *)dic
|
||||
{
|
||||
if (self = [super init]) {
|
||||
@try {
|
||||
if (dic && ![dic isKindOfClass:[NSNull class]]) {
|
||||
self.status = [[dic objectForKey:@"errorcode"] intValue];//待定
|
||||
self.message = [dic objectForKey:@""];//待定
|
||||
NSDictionary *data = [[dic objectForKey:@"result"] objectForKey:@"data"];
|
||||
self.dic = data;
|
||||
|
||||
}else{
|
||||
self.message = @"网络错误";
|
||||
self.dic = nil;
|
||||
self.status = 1;
|
||||
}
|
||||
|
||||
}
|
||||
@catch(NSException *exception) {
|
||||
self.dic = dic;
|
||||
self.status = 0;
|
||||
|
||||
}
|
||||
@finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user