BaseResponse.h 1.3 KB
//
//  BaseResponse.h
//  IM_ios_client
//
//  Created by 赵世强 on 16/1/4.
//  Copyright © 2016年 xiniu. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface BaseResponse : NSObject

@property(retain) NSMutableDictionary *fields;

// 业务错误字段
@property(nonatomic,readonly) NSArray *errors;

@property(nonatomic,readonly) NSString *code;

@property(nonatomic,readonly) NSString *message;

@property(nonatomic,readonly) NSString *solution;

@property(nonatomic,readonly) NSString *type;

// 总条数
//@property(nonatomic,readonly) long totalCount;

- (instancetype)init;

-(BaseResponse *)analyzeJson:(NSString *)responseString;

#pragma mark - 共同的设置Response元素的方法
/*
 itemObj:元素值
 itemKey:元素的值在元素所属Domain的字典中对应的Key
 selfFields:元素所属Domain的字典
 selfKey:元素所属Domain的字典在WKBaseDomain中的Key
 */
-(void)setItemObj:(id)itemObj itemKey:(id<NSCopying>)itemKey selfFields:(NSMutableDictionary *)selfFields selfKey:(id<NSCopying>)selfKey;

#pragma mark - 根据Domain的字典在WKBaseDomain中的Key获得Domain的字典
-(NSMutableDictionary *)getDomainDicByKey:(NSString *)domainKey;

#pragma mark - 判读字典中是否存在某个key
-(BOOL)keyExistInDictionary:(NSMutableDictionary *)dic key:(NSString *)key;

@end