1
This commit is contained in:
@@ -445,11 +445,12 @@ autoShowBusinessError:YES
|
||||
// 非成功业务 code:执行通用处理(如 token 失效)并通过 error 方式回调
|
||||
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
|
||||
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
|
||||
if (autoShowBusinessError) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD dismiss];
|
||||
[KBHUD showInfo:msg];
|
||||
});
|
||||
if (handledByAuth == false) {
|
||||
if (autoShowBusinessError) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD showInfo:msg];
|
||||
});
|
||||
}
|
||||
}
|
||||
NSError *bizErr = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||
code:KBNetworkErrorBusiness
|
||||
@@ -457,7 +458,7 @@ autoShowBusinessError:YES
|
||||
NSLocalizedDescriptionKey : msg,
|
||||
@"code" : @(bizCode)
|
||||
}];
|
||||
if (completion) completion(dict, response, bizErr);
|
||||
// if (completion) completion(dict, response, bizErr);
|
||||
return;
|
||||
}
|
||||
// code 缺失或为成功,按正常成功回调
|
||||
@@ -536,6 +537,7 @@ autoShowBusinessError:YES
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// 清理本地用户会话(Keychain + 用户缓存)
|
||||
[[KBUserSessionManager shared] logout];
|
||||
[[KBUserSessionManager shared] goLoginVC];
|
||||
// 友好提示
|
||||
[KBHUD showInfo:msg];
|
||||
// 广播通知,便于 UI 侧跳转登录页等
|
||||
|
||||
Reference in New Issue
Block a user