Prechádzať zdrojové kódy

修改 Apex Mobile announcement,market news 接口,增加网络请求失败后的提示消息。
修改 Apex Mobile change password 接口,增加网络请求失败,密码验证失败后的提示消息。
修改 Apex Mobile service location 接口,增加网络请求失败后的提示消息。
修改部分Apex Mobile 提示信息。
修改底层网络接口,增加对服务端验证失败的提示处理。

Ray Zhang 6 rokov pred
rodič
commit
e495b467ff

+ 1 - 1
Apex Mobile/Apex Mobile/Base.lproj/Localizable.strings

@@ -44,7 +44,7 @@
 "close"="Close";
 "alert_msg_failed_change_password"="Failed to change password code %d";
 "alert_title_success"="Success!";
-"alert_msg_change_success"="Change success.";
+"alert_msg_change_success"="Change password successful.";
 "alert_msg_password_notequal"="New password not equal confirm password!";
 "ask_click"="\nClick for more detail";
 "fields setting"="Setting";

+ 13 - 2
Apex Mobile/Apex Mobile/ChangePasswordViewController.m

@@ -91,6 +91,11 @@
     
     [RANetwork request_changepassword:newpass user:user oldpass:oldpass completionHandler:^(NSMutableDictionary *result) {
         int result_code= [[result valueForKey:@"result"] intValue];
+//        if(result_code==RESULT_NET_NOTAVAILABLE||result_code==RESULT_NET_ERROR)
+//        {
+//            
+//        }
+            
         int ret;
         if(result_code!=AP_USER_AUTH)
             ret=RESULT_FALSE;
@@ -122,8 +127,14 @@
         else
         {
             
-            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"alert_title_error", nil) message:NSLocalizedString(@"alert_msg_failed_change_password", nil) preferredStyle:UIAlertControllerStyleAlert];
-            UIAlertAction *action = [UIAlertAction actionWithTitle:NSLocalizedString(@"ok", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            NSString* msg = result[@"err_msg"];
+            if(msg.length==0)
+            {
+                msg=@"Can not change password, please check your old password or contact admin.";
+            }
+            
+            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"alert_title_error", nil) message:msg preferredStyle:UIAlertControllerStyleAlert];
+            UIAlertAction *action = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                 
             }];
             

+ 14 - 1
Apex Mobile/Apex Mobile/LocationViewController.m

@@ -509,7 +509,20 @@
                     }
                     else
                     {
-
+                        
+                        if(self.locationjson==nil)
+                        {
+                            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                                          message: result[@"err_msg"]
+                                                                                                   preferredStyle: UIAlertControllerStyleAlert];
+                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"Back" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+                                        [self.navigationController popViewControllerAnimated:false];
+                            }];
+
+                            [alertVC addAction:action];
+                            [self presentViewController:alertVC animated:YES completion:nil];
+
+                        }
                     }
 
 

+ 26 - 0
Apex Mobile/Apex Mobile/NewsViewController.m

@@ -64,6 +64,20 @@
                 {
                     [self.data append_jsondata: result];
                     self.lastid = self.data._id;
+
+                    if([result[@"result"] intValue]!=RESULT_TRUE)
+                    {
+                        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                                      message: result[@"err_msg"]
+                                                                                               preferredStyle: UIAlertControllerStyleAlert];
+                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"Back" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+                                    [self.navigationController popViewControllerAnimated:false];
+                        }];
+
+                        [alertVC addAction:action];
+                        [self presentViewController:alertVC animated:YES completion:nil];
+                    }
+                    
                     self.btnrefresh.hidden = false;
                     if(self.data.finishload==true)
                     {
@@ -108,6 +122,18 @@
                             [self.data append_jsondata: result];
                             self.lastid = self.data._id;
                             self.btnrefresh.hidden = false;
+                            if([result[@"result"] intValue]!=RESULT_TRUE)
+                            {
+                                UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                                              message: result[@"err_msg"]
+                                                                                                       preferredStyle: UIAlertControllerStyleAlert];
+                                UIAlertAction *action = [UIAlertAction actionWithTitle:@"Back" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+                                    [self.navigationController popViewControllerAnimated:false];
+                                }];
+
+                                [alertVC addAction:action];
+                                [self presentViewController:alertVC animated:YES completion:nil];
+                            }
                             if(self.data.finishload==true)
                             {
                                 

+ 10 - 2
common/NetworkUtils.m

@@ -1149,10 +1149,18 @@ repeat:
                         }
                         else
                         {
-                            NSDictionary* dict =[RAConvertor data2dict:responseData];
+                            NSMutableDictionary* dict =[[RAConvertor data2dict:responseData] mutableCopy];
+                            if([dict[@"result"] intValue]==RESULT_USERAUTH_ERROR)
+                            {
+                                dict[@"err_msg"]=@"Authorization failed.";
+                            }
+//                            if([dict[@"result"] intValue]==RESULT_ERROR)
+//                            {
+////                                RESULT_ERROR
+//                            }
                             dispatch_async(dispatch_get_main_queue(), ^{
                                 if(result)
-                                    return result([[RAConvertor data2dict:responseData] mutableCopy]);
+                                    return result(dict);
                             });
                             
                         }