Преглед изворни кода

完成Apex Mobile增加新的order history网络请求接口,替换旧接口;
完成Apex Mobile detail网络请求接口,替换旧接口。
修改前两天新增的接口,增加网络联通性检测。
完成Apex Mobile search网络请求接口,替换旧接口。

Ray Zhang пре 6 година
родитељ
комит
9d3742bc6b

+ 80 - 0
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -331,6 +331,86 @@
         [self.params setObject:@(YES) forKey:@"request_communication"];
     }
     
+    
+    [RANetwork request_detail:self.params completionHandler:^(NSMutableDictionary *result) {
+//        ;
+        
+         self.content=[RANetwork json2DetailContent:result];
+        
+        NSTimeInterval animationDuration = 0.30f;
+            [UIView beginAnimations:@"ResizeView" context:nil];
+            [UIView setAnimationDuration:animationDuration];
+            
+            
+            self.mum.hidden = true;
+            if(self.content.result_code!=RESULT_TRUE)
+            {
+                self.table.hidden =false;
+                [self.table reloadData];
+                
+            }
+            else
+            if([self.content get_segmentcount]==0)
+            {
+                
+                
+                self.table.hidden =true;
+                self.norecordLabel.hidden=false;
+                
+                if(self.tabBarController.childViewControllers.count==1)
+                {
+                    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                                  message: @"No Search Result."
+                                                                                           preferredStyle: UIAlertControllerStyleAlert];
+                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"Back" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                        [weakSelf.navigationController popViewControllerAnimated:false];
+                    }];
+                    [alertVC addAction:action];
+                    [weakSelf presentViewController:alertVC animated:YES completion:nil];
+                    
+                }
+
+                
+                
+            }
+            else
+            {
+                self.table.hidden =false;
+                [self.table reloadData];
+                
+                self.email = [self.content.originContent objectForKey:@"email"];
+                self.email_subject = [self.content.originContent objectForKey:@"email_subject"];
+                self.email_content = [self.content.originContent objectForKey:@"email_content"];
+            }
+            [UIView commitAnimations];
+            
+            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+            bool autologin =[defaults boolForKey:@"autologin"];
+            if(!autologin)
+            {
+                TabBarController * viewController =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                [self presentViewController:viewController animated:YES completion:^{
+                    
+                }];
+            }
+            // 设置默认选中第一个Container
+            for (NSInteger i = 0; i < self.content.segments.count; i++) {
+                
+                NSMutableDictionary* segment = [self.content.segments[i] mutableCopy];
+                NSString* type =[segment valueForKey:@"_type"];
+                
+                if([type isEqualToString:@"tracking"]) {
+                    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:i];
+                    [self.table selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
+                    [self tableView:self.table didSelectRowAtIndexPath:indexPath];
+                    break;
+                }
+            }
+    }];
+    
+    
+    
+    return;
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         self.content=[RANetwork get_detailcontent:self.params];

+ 43 - 0
Apex Mobile/Apex Mobile/OrderHistoryViewController.m

@@ -249,6 +249,49 @@ static const int history_delta = 7;
                                     } mutableCopy];
     
     __weak typeof(self) weakSelf = self;
+    
+    
+    [RANetwork request_orderhistory:params completionHandler:^(NSMutableDictionary *result) {
+        NSDictionary *json = result;
+        [weakSelf.loadIndicator stopAnimating];
+                  
+                  [weakSelf dismissProgressDialog];
+                  
+                  int result_code = [[json objectForKey:@"result"] intValue];
+                  
+//                  result_code = 2;
+                  int count = 0;
+                  
+                  if (result_code == 2) {
+                      NSArray *contentArray = [json objectForKey:@"container_list"];
+                      count = (int)contentArray.count;
+                      
+                      switch (option) {
+                          case 0:
+                          case 1: {
+                              [weakSelf.shipArray removeAllObjects];
+                              [weakSelf.shipArray addObjectsFromArray:contentArray];
+                          }
+                              break;
+                          case 2: {
+                              [weakSelf.shipArray addObjectsFromArray:contentArray];
+                          }
+                              break;
+                          default:
+                              break;
+                      }
+                      // refresh UI
+                      [weakSelf.shipTableView reloadData];
+                  }
+                  self.emptyBtn.hidden = self.shipArray.count > 0;
+                  if (finish) {
+                      finish(result_code,count);
+                  }
+                  weakSelf.historyRefresh = NO;
+    }];
+    
+    
+    return;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
 //        NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_container_list.json" ofType:nil];

+ 4 - 0
Apex Mobile/Apex Mobile/RANetwork.h

@@ -59,4 +59,8 @@
 + (void)request_login : (NSString*) user password:(NSString*) password completionHandler:(resultHandler)result;
 + (void)request_home:(resultHandler)result;
 + (void)request_kpi:(resultHandler)result;
++ (void) request_detail: (NSMutableDictionary *) params completionHandler:(resultHandler)result;
++ (DetailContent*) json2DetailContent:(NSMutableDictionary*)jsobj;
++ (void)request_orderhistory:(NSMutableDictionary *)params completionHandler:(resultHandler)result;
++ (void)request_result:(NSMutableDictionary *)params completionHandler:(resultHandler)result;
 @end

+ 286 - 148
Apex Mobile/Apex Mobile/RANetwork.m

@@ -1722,8 +1722,8 @@
 #pragma mark new_interface
 +(void)request_marketnews : (NSString*) lastid limit: (int) limit completionHandler:(resultHandler)result
 {
-    if(![NetworkUtils IsNetworkAvailable])
-        return ;//RESULT_NET_NOTAVAILABLE;
+//    if(![NetworkUtils IsNetworkAvailable])
+//        return ;//RESULT_NET_NOTAVAILABLE;
     
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     [params setValue:@"Market News" forKey:@"module_name"];
@@ -1748,8 +1748,8 @@
 
 +(void)request_announcements : (NSString*) lastid limit: (int) limit completionHandler:(resultHandler)result
 {
-    if(![NetworkUtils IsNetworkAvailable])
-        return ;//RESULT_NET_NOTAVAILABLE;
+//    if(![NetworkUtils IsNetworkAvailable])
+//        return ;//RESULT_NET_NOTAVAILABLE;
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     [params setValue:@"Announcements" forKey:@"module_name"];
     [params setValue:@"search" forKey:@"action_type"];
@@ -1772,8 +1772,8 @@
 
 +(void) request_servicelocatin:(resultHandler)result
 {
-    if(![NetworkUtils IsNetworkAvailable])
-        return ;//RESULT_NET_NOTAVAILABLE;
+//    if(![NetworkUtils IsNetworkAvailable])
+//        return ;//RESULT_NET_NOTAVAILABLE;
     
     NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     [params setValue:@"Location" forKey:@"module_name"];
@@ -1813,8 +1813,8 @@
 +(void)request_login : (NSString*) user password:(NSString*) password completionHandler:(resultHandler)result
 {
     
-    if(![NetworkUtils IsNetworkAvailable])
-        return ;
+//    if(![NetworkUtils IsNetworkAvailable])
+//        return ;
     //    if(![RANetwork IsHostAvailable:URL_UPDATE_AUTH])
     //        return RESULT_NET_ERROR;
     
@@ -2153,169 +2153,307 @@
 
 +(void) request_detail: (NSMutableDictionary *) params completionHandler:(resultHandler)result
 {
-    DebugLog(@"get_detailcontent");
-    DetailContent * detailContent = [[DetailContent alloc] init];
-    NSMutableArray* segments = [[NSMutableArray alloc] init];
-    detailContent.segments = segments;
-    if(![NetworkUtils IsNetworkAvailable])
-    {
-        detailContent.result_code = RESULT_NET_NOTAVAILABLE;
-//        return detailContent;
-        return;
-    }
+    
+//    if(![NetworkUtils IsNetworkAvailable])
+//    {
+//
+//        result([[RAConvertor string2dict:[NSString stringWithFormat:@"{'result':%d}",RESULT_NET_NOTAVAILABLE]] mutableCopy]);
+////        return detailContent;
+//        return;
+//    }
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         [params setValue:@"handset_search" forKey:@"action"];
 //    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     
     
-    [self request_interface:URL_REQUEST_RECORDS parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *chresult) {
-       NSString *str = [RAConvertor dict2string: chresult];
-       
-
-       
-       str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
-       
-       
-           DebugLog(@"hack string: %@",str);
-       //------- hack-----------
-       NSDictionary *retjson=[RAConvertor string2dict:str];
-        
-        result([retjson mutableCopy]);
-        
-        
-    } retry:0];
+    [self request_interface:URL_REQUEST_RECORDS parameters:params err_record_url:nil completionHandler:result retry:0];
     return;
     
-    NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
-    if (json==nil)
-    {
-        DebugLog(@"json is wrong");
-        detailContent.result_code = RESULT_NET_ERROR;
-        //return detailContent;
-        return;
-    }
-    
-    
-    //------------hack detail html 字体大小-----------
-    NSString *str = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
-    
-
-    
-    str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
-    
-    
-        DebugLog(@"hack string: %@",str);
-    //------- hack-----------
-    NSDictionary *jsobj=[RAConvertor string2dict:str];
-    
-    
-    NSError *error=nil;
-//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//    NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
+//    if (json==nil)
+//    {
+//        DebugLog(@"json is wrong");
+//        detailContent.result_code = RESULT_NET_ERROR;
+//        //return detailContent;
+//        return;
+//    }
 //
 //
-    if(jsobj)
-    {
-        int result = [[jsobj valueForKey:@"result"] intValue];
-        if(result== AP_SESSION_EXPIRED)
+//    //------------hack detail html 字体大小-----------
+//    NSString *str = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
+//
+//
+//
+//    str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
+//
+//
+//        DebugLog(@"hack string: %@",str);
+//    //------- hack-----------
+//    NSDictionary *jsobj=[RAConvertor string2dict:str];
+//
+//
+//    NSError *error=nil;
+////    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+////
+////
+//    if(jsobj)
+//    {
+//        int result = [[jsobj valueForKey:@"result"] intValue];
+//        if(result== AP_SESSION_EXPIRED)
+//        {
+//            [self Authorize:appDelegate.user password:appDelegate.password];
+//            json=[self get_json:URL_REQUEST_RECORDS parameters:params  file:nil];
+//            if (json==nil)
+//            {
+//                DebugLog(@"json is wrong");
+//                detailContent.result_code = RESULT_NET_ERROR;
+////                return detailContent;
+//                return;
+//            }
+//            jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//            result = [[jsobj valueForKey:@"result"] intValue];
+//
+//        }
+//        if(result!=AP_USER_AUTH)
+//        {
+//            DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
+//            detailContent.result_code = result;
+////            return detailContent;
+//            return;
+//
+//        }
+//
+//
+////        if([params[@"action_type"] isEqualToString:@"Tracking"])
+////        {
+////            NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_tracking.json" ofType:nil];
+////            NSData *data = [[NSData alloc] initWithContentsOfFile:path];
+////            NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+////            jsobj = json;
+////        }
+//
+//        int count =[[jsobj valueForKey:@"count"] intValue];
+//
+////        if ([[params objectForKey:@"action_type"] isEqualToString:@"Detail"]) {
+////            NSMutableDictionary *mJson = [jsobj mutableCopy];
+////            NSDictionary *comm = @{
+////                                   @"_name": @"Communication",
+////                                   @"_type": @"communication",
+////                                   @"cc": @"",
+////                                   @"receipt": @"",
+////                                   @"count": @2,
+////                                   @"item0": @{
+////                                           @"Sender": @"user name",
+////                                           @"msg": @"content bla bla bla...",
+////                                           @"mst_time": @"04/28/2018 20:15:33",
+////                                           @"email_url": @"https://www.baidu.com"
+////                                           },
+////                                   @"item1": @{
+////                                           @"Sender": @"user name",
+////                                           @"msg": @"content bla bla bla...",
+////                                           @"mst_time": @"04/28/2018 20:15:33"
+////                                           }
+////                                   };
+////            [mJson setObject:comm forKey:[NSString stringWithFormat:@"group%d",count]];
+////
+////            [mJson setObject:@(++count) forKey:@"count"];
+////
+////            jsobj = mJson;
+////        }
+//
+//        detailContent.result_code = RESULT_TRUE;
+//        if(count==0)
+//        {
+//
+////            return detailContent;
+//            return;
+//        }
+//
+//        for(int i=0;i<count;i++)
+//        {
+//
+//            NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
+//            [segments addObject:segment];
+//
+//            /*
+//             JSONObject groupobj = jsonObj.getJSONObject("group" + i);
+//             View v = inflater.inflate(R.layout.group_tag, null);
+//             v.setOnClickListener(this);
+//
+//             TextView tvgroup = (TextView) v.findViewById(R.id.tv_group);
+//             String group_name = groupobj.getString("_name");
+//             tvgroup.setText(group_name);
+//             v.setId(commonUtil.generateViewId());
+//             ll_root.addView(v);
+//             String grouptype = groupobj.getString("_type");
+//
+//             */
+//        }
+//
+//        //   NSDictionary* objrecords = [jsobj objectForKey:@"records"];
+//
+//        detailContent.originContent = jsobj;
+//
+////        return detailContent;
+//        return;
+//
+//    }
+//    return nil;
+    
+}
+
++(DetailContent*) json2DetailContent:(NSMutableDictionary*)jsobj
+{
+
+        DetailContent * detailContent = [[DetailContent alloc] init];
+        NSMutableArray* segments = [[NSMutableArray alloc] init];
+        detailContent.segments = segments;
+        if(![NetworkUtils IsNetworkAvailable])
         {
-            [self Authorize:appDelegate.user password:appDelegate.password];
-            json=[self get_json:URL_REQUEST_RECORDS parameters:params  file:nil];
-            if (json==nil)
-            {
-                DebugLog(@"json is wrong");
-                detailContent.result_code = RESULT_NET_ERROR;
-//                return detailContent;
-                return;
-            }
-            jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-            result = [[jsobj valueForKey:@"result"] intValue];
-            
+            detailContent.result_code = RESULT_NET_NOTAVAILABLE;
+            return detailContent;
         }
-        if(result!=AP_USER_AUTH)
+        if (jsobj==nil)
         {
-            DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
-            detailContent.result_code = result;
-//            return detailContent;
-            return;
-            
+            DebugLog(@"json is wrong");
+            detailContent.result_code = RESULT_NET_ERROR;
+            return detailContent;
         }
         
         
-//        if([params[@"action_type"] isEqualToString:@"Tracking"])
-//        {
-//            NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_tracking.json" ofType:nil];
-//            NSData *data = [[NSData alloc] initWithContentsOfFile:path];
-//            NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
-//            jsobj = json;
-//        }
+        //------------hack detail html 字体大小-----------
+        NSString *str = [RAConvertor dict2string:jsobj];
         
-        int count =[[jsobj valueForKey:@"count"] intValue];
+
         
-//        if ([[params objectForKey:@"action_type"] isEqualToString:@"Detail"]) {
-//            NSMutableDictionary *mJson = [jsobj mutableCopy];
-//            NSDictionary *comm = @{
-//                                   @"_name": @"Communication",
-//                                   @"_type": @"communication",
-//                                   @"cc": @"",
-//                                   @"receipt": @"",
-//                                   @"count": @2,
-//                                   @"item0": @{
-//                                           @"Sender": @"user name",
-//                                           @"msg": @"content bla bla bla...",
-//                                           @"mst_time": @"04/28/2018 20:15:33",
-//                                           @"email_url": @"https://www.baidu.com"
-//                                           },
-//                                   @"item1": @{
-//                                           @"Sender": @"user name",
-//                                           @"msg": @"content bla bla bla...",
-//                                           @"mst_time": @"04/28/2018 20:15:33"
-//                                           }
-//                                   };
-//            [mJson setObject:comm forKey:[NSString stringWithFormat:@"group%d",count]];
-//
-//            [mJson setObject:@(++count) forKey:@"count"];
-//
-//            jsobj = mJson;
-//        }
+        str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
         
-        detailContent.result_code = RESULT_TRUE;
-        if(count==0)
-        {
-            
-//            return detailContent;
-            return;
-        }
         
-        for(int i=0;i<count;i++)
-        {
+            DebugLog(@"hack string: %@",str);
+        //------- hack-----------
+        jsobj=[[RAConvertor string2dict:str] mutableCopy];
+
+            int result = [[jsobj valueForKey:@"result"] intValue];
+//            if(result== AP_SESSION_EXPIRED)
+//            {
+//                [self Authorize:appDelegate.user password:appDelegate.password];
+//                json=[self get_json:URL_REQUEST_RECORDS parameters:params  file:nil];
+//                if (json==nil)
+//                {
+//                    DebugLog(@"json is wrong");
+//                    detailContent.result_code = RESULT_NET_ERROR;
+//                    return detailContent;
+//                }
+//                jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//                result = [[jsobj valueForKey:@"result"] intValue];
+//
+//            }
+            if(result!=AP_USER_AUTH)
+            {
+                DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
+                detailContent.result_code = result;
+                return detailContent;
+                
+            }
             
-            NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
-            [segments addObject:segment];
+
+            
+            int count =[[jsobj valueForKey:@"count"] intValue];
+            
+
+            
+            detailContent.result_code = RESULT_TRUE;
+            if(count==0)
+            {
+                
+                return detailContent;
+            }
+            
+            for(int i=0;i<count;i++)
+            {
+                
+                NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
+                [segments addObject:segment];
+                
+
+            }
+            
+            //   NSDictionary* objrecords = [jsobj objectForKey:@"records"];
+            
+            detailContent.originContent = jsobj;
+            
+            return detailContent;
             
-            /*
-             JSONObject groupobj = jsonObj.getJSONObject("group" + i);
-             View v = inflater.inflate(R.layout.group_tag, null);
-             v.setOnClickListener(this);
-             
-             TextView tvgroup = (TextView) v.findViewById(R.id.tv_group);
-             String group_name = groupobj.getString("_name");
-             tvgroup.setText(group_name);
-             v.setId(commonUtil.generateViewId());
-             ll_root.addView(v);
-             String grouptype = groupobj.getString("_type");
-             
-             */
-        }
-        
-        //   NSDictionary* objrecords = [jsobj objectForKey:@"records"];
-        
-        detailContent.originContent = jsobj;
         
-//        return detailContent;
-        return;
+     
+}
+
+
++ (void)request_orderhistory:(NSMutableDictionary *)params completionHandler:(resultHandler)result
+{
+    
+    [params setObject:@"hand_new_home_list_all" forKey:@"action"];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.personalmode)
+        params[@"personal_mode"] = @"true";
+    else
+        params[@"personal_mode"] = @"false";
+    
+    
+    [self request_interface:URL_HISTORY parameters:params err_record_url:nil completionHandler:result retry:0];
+//
+//    NSData* json=[self get_json:URL_HISTORY 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];
+//
+//    return resultDic;
+}
+
+
++ (void)request_result:(NSMutableDictionary *)params completionHandler:(resultHandler)result
+{
+    
+//    return [self mockResult:params];
+    
+    params[@"action"]=@"handset_search";
+    
+    [self request_interface:URL_SEARCH_RESULT parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *resultjson) {
+            NSMutableDictionary *resultDic = resultjson;
         
-    }
-//    return nil;
+            // 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"];
+        result(resultDic);
+    } retry:0];
     
+//    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;
 }
 @end

+ 86 - 0
Apex Mobile/Apex Mobile/Result/Presenter/ApexResultPresenter.m

@@ -104,6 +104,92 @@ static const NSInteger detal = 20;
     }
     
     __weak typeof(self) weakSelf = self;
+    
+    
+    NSMutableDictionary *params = [self.params mutableCopy];
+    [params setObject:[NSNumber numberWithInteger:offset] forKey:@"offset"];
+    [params setObject:[NSNumber numberWithInteger:detal] forKey:@"limit"];
+    [params setObject:displayFields forKey:@"columns"];
+    
+    
+    [RANetwork request_result:params completionHandler:^(NSMutableDictionary *result) {
+        
+        NSMutableDictionary * json = result;
+            __strong typeof(weakSelf) strongSelf = weakSelf;
+            
+            int resultcode = [[json objectForKey:@"result"] intValue];
+            if (resultcode == RESULT_TRUE) {
+                
+                NSMutableArray *modelsArr = [NSMutableArray array];
+                if (option == ApexResultFetchDataTypeLoadMore && strongSelf.dataArray != nil && strongSelf.dataArray.count > 0) {
+                    [modelsArr addObjectsFromArray:strongSelf.dataArray];
+                }
+                
+                NSArray *items = [json objectForKey:@"items"];
+                for (NSDictionary *item in items) {
+                    
+                    NSInteger type = [[item objectForKey:@"type"] integerValue];
+                    
+                    switch (type) {
+                        case ApexResultTypeBooking: {
+                            ApexResultBookingModel *model = [ApexResultBookingModel new];
+                            [model setValuesForKeysWithDictionary:item];
+                            [modelsArr addObject:model];
+                        }
+                            break;
+                        case ApexResultTypeBLInfo: {
+                            ApexResultBLInfoModel *model = [ApexResultBLInfoModel new];
+                            [model setValuesForKeysWithDictionary:item];
+                            [modelsArr addObject:model];
+                        }
+                            break;
+                        case ApexResultTypeContainer: {
+                            ApexResultContainerModel *model = [ApexResultContainerModel new];
+                            [model setValuesForKeysWithDictionary:item];
+                            [modelsArr addObject:model];
+                        }
+                            break;
+                        case ApexResultTypeDocument: {
+                            ApexResultDocumentModel *model = [ApexResultDocumentModel new];
+                            [model setValuesForKeysWithDictionary:item];
+                            [modelsArr addObject:model];
+                        }
+                            break;
+                        default:
+                            break;
+                    }
+                    
+                } // for
+                strongSelf.offset = modelsArr.count;
+                
+                NSString *title = [json objectForKey:@"title"];
+                strongSelf.rowActions = [json objectForKey:@"row_actions"];
+                strongSelf.actions = [json objectForKey:@"actions"];
+                
+                // menu
+                NSArray *menuArr = [json objectForKey:@"menu"];
+                if (menuArr) {
+                    NSMutableArray *tmpArr = [NSMutableArray array];
+                    for (NSDictionary *item in menuArr) {
+                        
+                        ApexResultMenuItem *menuItem = [ApexResultMenuItem new];
+                        [menuItem setValuesForKeysWithDictionary:item];
+                        [tmpArr addObject:menuItem];
+                    }
+                    strongSelf.menuItems = [tmpArr copy];
+                }
+                
+                // refresh UI
+                [strongSelf loadDataSuccessWithTitle:title itemsArray:modelsArr itemCount:items.count];
+                
+            } else {
+                [strongSelf loadDataFailed];
+            }
+        
+    }];
+    
+    return;
+    
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
         
         NSMutableDictionary *params = [weakSelf.params mutableCopy];