Эх сурвалжийг харах

1.修改iOS Apex Mobile Result请求。

Pen Li 7 жил өмнө
parent
commit
08fb222976

+ 44 - 31
Apex Mobile/Apex Mobile/RANetwork.m

@@ -1390,22 +1390,10 @@
     return resultDic;
 }
 
-+ (NSDictionary *)fetchResultParameters:(NSMutableDictionary *)params {
++ (NSDictionary *)mockResult:(NSDictionary *)params {
     
-//    NSData* json=[self get_json:URL_UPLOAD_SQL parameters:params  file:nil];
-//
-//    if (json==nil)
-//    {
-//        return @{
-//                 @"result" : @RESULT_NET_ERROR,
-//                 @"err_msg" : MSG_NET_ERROR
-//                 };
-//    }
-//
-//    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil];
-
     sleep(2);
-    
+
     // Booking : module_name = Ocean Booking
     NSDictionary *item_booking = @{
                                    @"type": @0,
@@ -1434,7 +1422,7 @@
                                            @"27d620831e3f458643c8046305e2cd13"
                                            ]
                                    };
-    
+
     // B/L Info : module_name = Ocean B/L info.
     NSDictionary *item_BL = @{
                                @"type": @0,
@@ -1449,7 +1437,7 @@
                                        @"27d620831e3f458643c8046305e2cd13"
                                        ]
                                };
-    
+
     // Container : module_name = Container detail
     NSDictionary *item_container = @{
                                       @"type": @0,
@@ -1465,7 +1453,7 @@
                                               @"27d620831e3f458643c8046305e2cd13"
                                               ]
                                       };
-    
+
     // Document : module_name = Download Document
     NSDictionary *item_doc = @{
                                 @"type": @1,
@@ -1482,7 +1470,7 @@
                                                          @""
                                                          ]
                                 };
-    
+
     NSString *module_name = [params objectForKey:@"module_name"];
     NSMutableArray *arr = [NSMutableArray array];
     for (int i = 0; i < 20; i++) {
@@ -1496,25 +1484,25 @@
             [arr addObject:item_doc.copy];
         }
     }
-    
+
     NSString *title = @"";
     if ([module_name isEqualToString:@"Ocean Booking"]) {
-        
+
         title = @"Ocean Booking";
     } else if ([module_name isEqualToString:@"Ocean B/L info."]) {
-        
+
         title = @"Ocean B/L info";
     } else if ([module_name isEqualToString:@"Container detail"]) {
-        
+
         title = @"Container detail";
     } else if ([module_name isEqualToString:@"Download Document"]) {
-        
+
         title = @"Download Document";
     }
-    
+
     NSArray *row_actions;
     if ([module_name isEqualToString:@"Download Document"]) {
-        
+
         row_actions = @[@{
                             @"title": @"Download Document",
                             @"module": @"quick_look",
@@ -1530,7 +1518,7 @@
                                     }
                             }];
     } else {
-        
+
         row_actions = @[@{
                             @"title": @"Ocean B/L info Detail",
                             @"module": @"detail",
@@ -1540,14 +1528,14 @@
                                     }
                             }];
     }
-    
+
     NSDictionary *resultDic = @{
                                 @"result" : @RESULT_TRUE,
                                 @"title" : title,
                                 @"row_actions" : row_actions,
                                 @"items" : arr
                                 };
-    
+
     // for detail
 //    NSArray *actions = @[
 //                         @"Detail",
@@ -1559,16 +1547,41 @@
 
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     NSArray *actions = [ApexMobileDB getActionsForFunction:module_name withUser:appDelegate.user];
-    
+
     NSMutableDictionary *json = [resultDic mutableCopy];
     [json setValue:actions forKey:@"actions"];
-    
+
     NSLog(@"%@",[RAConvertor dict2string:json]);
-    
+
     return json;
     
 }
 
++ (NSDictionary *)fetchResultParameters:(NSMutableDictionary *)params {
+    
+//    return [self mockResult:params];
+    
+    NSData* json=[self get_json:URL_SEARCH_RESULT parameters:params  file:nil];
+
+    if (json==nil)
+    {
+        return @{
+                 @"result" : @RESULT_NET_ERROR,
+                 @"err_msg" : MSG_NET_ERROR
+                 };
+    }
+
+    NSMutableDictionary *resultDic = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
+    
+    // detail data in local database
+    NSString *module_name = [params objectForKey:@"module_name"];
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    NSArray *actions = [ApexMobileDB getActionsForFunction:module_name withUser:appDelegate.user];
+    [resultDic setValue:actions forKey:@"actions"];
+    
+    return resultDic;
+}
+
 + (NSDictionary *)saveSearchParameters:(NSString *)paramStr forModule:(NSString *)module withName:(NSString *)name {
     if (!paramStr || !module) {
         return @{

+ 2 - 0
Apex Mobile/Apex Mobile/config.h

@@ -39,6 +39,7 @@
 // 2019.1.4
 #define URL_UPLOAD_SQL     @"http://192.168.2.138/Online/Online/main_new.php"
 #define URL_SAVE_RESULT     @"http://192.168.2.138/Online/Online/main_new.php"
+#define URL_SEARCH_RESULT     @"http://192.168.2.138/Online/Online/main_new.php"
 
 #else
 
@@ -60,6 +61,7 @@
 // 2019.1.4
 #define URL_UPLOAD_SQL     @"https://ra.apexshipping.com/main_new.php"
 #define URL_SAVE_RESULT     @"https://ra.apexshipping.com/main_new.php"
+#define URL_SEARCH_RESULT    @"https://ra.apexshipping.com/main_new.php"
 
 #endif