Преглед на файлове

修复Apex Mobile保存查询结果时,线程调度错误的问题。
对Apex Mobile app 运行出错后的部分提示进行了修改。

Ray Zhang преди 6 години
родител
ревизия
61edebd3bb

+ 1 - 1
Apex Mobile/Apex Mobile/RANetwork.h

@@ -47,7 +47,7 @@
 
 + (NSDictionary *)uploadUserSql:(NSString *)sql;
 + (NSDictionary *)fetchResultParameters:(NSMutableDictionary *)params;
-+ (NSDictionary *)saveSearchParameters:(NSString *)paramStr forModule:(NSString *)module withName:(NSString *)name;
++ (NSDictionary *)saveSearchParameters:(NSString *)paramStr forModule:(NSString *)module withName:(NSString *)name user:(NSString *)user;
 
 + (NSString *)getDisplayFieldsForFunction:(NSString *)function limit:(NSUInteger)limit;
 

+ 7 - 6
Apex Mobile/Apex Mobile/RANetwork.m

@@ -1684,15 +1684,16 @@
     return resultDic;
 }
 
-+ (NSDictionary *)saveSearchParameters:(NSString *)paramStr forModule:(NSString *)module withName:(NSString *)name {
++ (NSDictionary *)saveSearchParameters:(NSString *)paramStr forModule:(NSString *)module withName:(NSString *)name user:(NSString *)user
+{
     if (!paramStr || !module) {
         return @{
                  @"result" : @RESULT_FALSE,
-                 @"err_msg" : @"Sorry, something is wrong."
+                 @"err_msg" : @"Sorry, cannot save search, please contact admin."
                  };
     }
-    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-    NSString *sql = [NSString stringWithFormat: @"insert into history(params,name,module_name,user) values('%@','%@','%@','%@')",paramStr,name,module,appDelegate.user];
+    
+    NSString *sql = [NSString stringWithFormat: @"insert into history(params,name,module_name,user) values('%@','%@','%@','%@')",paramStr,name,module,user];
     
     __block BOOL out_success = NO;
     [ApexMobileDB jk_sync_excute:sql completion:^(BOOL success) {
@@ -1709,7 +1710,7 @@
     } else {
         return @{
                  @"result" : @RESULT_FALSE,
-                 @"err_msg" : @"Sorry, something is wrong."
+                 @"err_msg" : @"Sorry, cannot save search, please contact admin."
                  };
 
     }
@@ -2466,7 +2467,7 @@
 //    if(![NetworkUtils IsNetworkAvailable])
 //        return RESULT_NET_NOTAVAILABLE;
     
-    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+//    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
     
     NSMutableDictionary * params = [[NSMutableDictionary alloc] init];

+ 5 - 4
Apex Mobile/Apex Mobile/Result/Presenter/ApexResultPresenter.m

@@ -65,7 +65,7 @@ static const NSInteger detal = 20;
             __strong typeof(weakSelf) strongSelf = weakSelf;
             if (strongSelf.delegate) {
                 [strongSelf.delegate onStopLoading];
-                [strongSelf.delegate onFailed:@"Sorry, something is wrong"];
+                [strongSelf.delegate onFailed:@"Sorry, can not connect to the server, please try again later."];
             }
         }
     });
@@ -320,7 +320,8 @@ static const NSInteger detal = 20;
 #pragma mark - Save Search
 
 - (void)saveSearchParameters:(NSString *)name {
-    
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    NSString* user = appDelegate.user;
     NSString *module_name = [self.params objectForKey:@"module_name"];
     
     NSMutableDictionary *params = [self.params mutableCopy];
@@ -335,7 +336,7 @@ static const NSInteger detal = 20;
     }
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
-        NSDictionary *json = [RANetwork saveSearchParameters:paramStr forModule:module_name withName:name];
+        NSDictionary *json = [RANetwork saveSearchParameters:paramStr forModule:module_name withName:name user:user];
         int result = [[json objectForKey:@"result"] intValue];
         if (result == RESULT_TRUE) {
             
@@ -349,7 +350,7 @@ static const NSInteger detal = 20;
         } else {
             NSString *err_msg = [json objectForKey:@"err_msg"];
             if (err_msg.length == 0) {
-                err_msg = @"Sorry, something is wrong.";
+                err_msg = @"Sorry, can not connect to the server, please try again later.";
             }
             dispatch_async(dispatch_get_main_queue(), ^{
                 

+ 1 - 1
Apex Mobile/Apex Mobile/config.h

@@ -13,7 +13,7 @@
 # ifdef DEBUG
 #define DEBUG_DB
 
-//#define test_server
+#define test_server
 //#define old_server
 
 # endif