BaseResponse.h
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// 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