Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f49b35f

Browse files
频繁关注,弹验证码
1 parent 97e671f commit f49b35f

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

‎Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5646,7 +5646,6 @@
56465646
ORGANIZATIONNAME = Coding;
56475647
TargetAttributes = {
56485648
8E47700F198770E700997D05 = {
5649-
DevelopmentTeam = QN5Z87S3LH;
56505649
SystemCapabilities = {
56515650
com.apple.BackgroundModes = {
56525651
enabled = 0;

‎Coding_iOS/Controllers/MeSetting/SettingViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
128128
}
129129
}] showInView:self.view];
130130
}else{
131-
if (indexPath.row == 0) {
131+
if (indexPath.row == 0) {//帮助中心
132132
WebViewController *webVc = [WebViewController webVCWithUrlStr:@"/help/doc/mobile/index.html"];
133133
[self.navigationController pushViewController:webVc animated:YES];
134134
}else{//关于

‎Coding_iOS/Util/OC_Category/NSObject+Common.m

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,11 @@ -(id)handleResponse:(id)responseJSON{
323323
-(id)handleResponse:(id)responseJSON autoShowError:(BOOL)autoShowError{
324324
NSError *error = nil;
325325
//code为非0值时,表示有错
326-
NSNumber *resultCode = [responseJSON valueForKeyPath:@"code"];
326+
NSInteger errorCode = [(NSNumber *)[responseJSON valueForKeyPath:@"code"] integerValue];
327327

328-
if (resultCode.intValue != 0) {
329-
error = [NSError errorWithDomain:[NSObject baseURLStr] code:resultCode.intValue userInfo:responseJSON];
330-
331-
if (resultCode.intValue == 1000 || resultCode.intValue == 3207) {//用户未登录
328+
if (errorCode != 0) {
329+
error = [NSError errorWithDomain:[NSObject baseURLStr] code:errorCode userInfo:responseJSON];
330+
if (errorCode == 1000 || errorCode == 3207) {//用户未登录
332331
if ([Login isLogin]) {
333332
[Login doLogout];//已登录的状态要抹掉
334333
//更新 UI 要延迟 >1.0 秒,否则屏幕可能会不响应触摸事件。。暂不知为何
@@ -338,16 +337,17 @@ -(id)handleResponse:(id)responseJSON autoShowError:(BOOL)autoShowError{
338337
});
339338
}
340339
}else{
341-
NSDictionary *msgDict = [responseJSON valueForKey:@"msg"];
342-
__block BOOL need_captcha = NO;
343-
[[msgDict allKeys] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
344-
if ([obj rangeOfString:@"need_captcha"].location != NSNotFound) {
345-
need_captcha = YES;
346-
}
347-
}];
348-
if (need_captcha) {
349-
[NSObject showCaptchaViewParams:nil];
340+
//验证码弹窗
341+
NSMutableDictionary *params = nil;
342+
if (errorCode == 907) {//operation_need_captcha 比如:每日新增关注用户超过 20 个
343+
params = @{@"type": @3}.mutableCopy;
344+
}else if (errorCode == 1018){//user_not_get_request_too_many
345+
params = @{@"type": @1}.mutableCopy;
350346
}
347+
if (params) {
348+
[NSObject showCaptchaViewParams:params];
349+
}
350+
//错误提示
351351
if (autoShowError) {
352352
[NSObject showError:error];
353353
}
@@ -412,6 +412,8 @@ + (void)showCaptchaViewParams:(NSMutableDictionary *)params{
412412
[weakAlertV dismissWithCompletion:^{
413413
[NSObject showHudTipStr:@"验证码正确"];
414414
}];
415+
}else{
416+
[weakImageV sd_setImageWithURL:imageURL placeholderImage:nil options:(SDWebImageRetryFailed | SDWebImageRefreshCached | SDWebImageHandleCookies)];
415417
}
416418
}];
417419
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /