1
This commit is contained in:
@@ -30,19 +30,19 @@
|
|||||||
[[KBNetworkManager shared] GET:KB_API_CHARACTER_LIST
|
[[KBNetworkManager shared] GET:KB_API_CHARACTER_LIST
|
||||||
parameters:params
|
parameters:params
|
||||||
headers:nil
|
headers:nil
|
||||||
autoShowBusinessError:NO
|
autoShowBusinessError:true
|
||||||
completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||||
if (needShow) {
|
if (needShow) {
|
||||||
[KBHUD dismiss];
|
// [KBHUD dismiss];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
// 若是业务错误,优先展示服务端 message
|
// 若是业务错误,优先展示服务端 message
|
||||||
NSString *msg = KBBizMessageFromJSONObject(json) ?: error.localizedDescription ?: KBLocalized(@"Network error");
|
// NSString *msg = KBBizMessageFromJSONObject(json) ?: error.localizedDescription ?: KBLocalized(@"Network error");
|
||||||
[KBHUD showInfo:msg];
|
// [KBHUD showInfo:msg];
|
||||||
if (completion) {
|
// if (completion) {
|
||||||
completion(nil, error);
|
// completion(nil, error);
|
||||||
}
|
// }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ autoShowBusinessError:YES
|
|||||||
// 非成功业务 code:执行通用处理(如 token 失效)并通过 error 方式回调
|
// 非成功业务 code:执行通用处理(如 token 失效)并通过 error 方式回调
|
||||||
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
|
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
|
||||||
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
|
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
|
||||||
if (autoShowBusinessError && !handledByAuth) {
|
if (autoShowBusinessError) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[KBHUD showInfo:msg];
|
[KBHUD showInfo:msg];
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user