@@ -28,12 +28,10 @@ + (instancetype)creatRequest:(MY_APIREQUEST_TYPE)requestType urlString:(NSString
28
28
29
29
- (instancetype )initWithRequest : (MY_APIREQUEST_TYPE)requestType urlString : (NSString *)urlString timeout : (NSInteger )timeout requestTag : (NSString *)tag
30
30
{
31
- # ifdef DEBUG
31
+ // requestTag可以不设定,每次均为不同的请求,此时requestTag为当前时间戳
32
32
if (!tag.length ) {
33
- // HudShowMessage(@"tag必须设定",[UIApplication sharedApplication].keyWindow, 2);
34
- return nil ;
33
+ tag = MYGetCurrentTime ();
35
34
}
36
- #endif
37
35
MYApiRequestBaseObject *request = [self init ];
38
36
request.urlString = urlString;
39
37
request.requestType = requestType;
@@ -42,24 +40,15 @@ - (instancetype)initWithRequest:(MY_APIREQUEST_TYPE)requestType urlString:(NSStr
42
40
return request;
43
41
}
44
42
45
- - (instancetype )init
46
- {
47
- if (self = [super init ]) {
48
-
49
- _token = @" 获取的本地token" ;
50
- _machine_type = @" iOS" ;
51
- }
52
- return self;
53
- }
54
43
55
- // 忽略
44
+
56
45
+ (NSArray *)modelPropertyBlacklist {
57
- return @[@" urlString" , @" requestType" ,@" baseUrl" ,@" timeout" ,@" localCache " ,@" task " ];
46
+ return @[@" urlString" , @" requestType" ,@" baseUrl" ,@" timeout" ,@" task " ,@" requestTag " , @" localCache " ];
58
47
}
59
48
60
49
- (NSString *)description
61
50
{
62
- return [NSString stringWithFormat: @" baseUrl ************* %@ \n 请求方式 ************* %ld \n 完整url ************* %@ \n 设置超时时间 ************* %ld " ,self .baseUrl,(long )self .requestType,self .task.originalRequest.URL.absoluteString,(long )self .timeout];
51
+ return [NSString stringWithFormat: @" baseUrl ************* %@ \n 请求方式 ************* %ld \n 完整url ************* %@ \n 设置超时时间 ************* %ld \n 请求参数 ************* %@ " ,self .baseUrl,(long )self .requestType,self .task.originalRequest.URL.absoluteString,(long )self .timeout, self .yy_modelToJSONObject ];
63
52
}
64
53
65
54
- (NSInteger )timeout
@@ -91,4 +80,10 @@ - (NSString *)urlString
91
80
return _urlString;
92
81
}
93
82
83
+ // 获取当前时间戳
84
+ NS_INLINE NSString *MYGetCurrentTime () {
85
+ UInt64 recordTime = [[NSDate date ] timeIntervalSince1970 ];
86
+ return [NSString stringWithFormat: @" %llu " ,recordTime];
87
+ }
88
+
94
89
@end
0 commit comments