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

1.修改Apex Mobile首页数据加载。
2.修改Apex Mobile,增加数据为空的提示和数据加载指示器。
3.修改Apex Mobile登陆数据库死锁。
4.修改Apex Mobile上行参数删除Session Id。

Pen Li пре 8 година
родитељ
комит
7489f70320

+ 4 - 3
Apex Mobile/Apex Mobile/ApexMobileDB.m

@@ -300,7 +300,7 @@
             
             sqlite3_finalize(statement);
         } else {
-            DebugLog(@"excute sql:%@ error",sql);
+            DebugLog(@"excute sql:%@ error: %s",sql,sqlite3_errmsg(db));
             if (failure) {
                 failure(@"error");
             }
@@ -320,12 +320,13 @@
     dispatch_async(dispatch_get_main_queue(), ^{
         
         sqlite3 *db = [self get_db];
-        if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, NULL) == SQLITE_OK) {
+        char *err;
+        if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) == SQLITE_OK) {
             if (completion) {
                 completion(YES);
             }
         } else {
-            DebugLog(@"excute sql:%@ error",sql);
+            DebugLog(@"excute sql:%@ error: %s",sql,sqlite3_errmsg(db));
             if (completion) {
                 completion(NO);
             }

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

@@ -13,7 +13,7 @@
 @property (strong, nonatomic) UIWindow *window;
 @property (strong,nonatomic) NSString* user;
 @property (strong,nonatomic) NSString * password;
-@property (strong,nonatomic) NSString * sessionid;
+//@property (strong,nonatomic) NSString * sessionid;
 @property (strong,nonatomic) NSString * duid;
 
 

+ 1 - 1
Apex Mobile/Apex Mobile/AppDelegate.m

@@ -161,7 +161,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 {
     self.user = nil;
     self.password=nil;
-    self.sessionid=nil;
+//    self.sessionid=nil;
     [RANetwork Logout];
     NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
     [defaults setBool:false forKey:@"autologin"];

+ 58 - 8
Apex Mobile/Apex Mobile/HomeViewController.m

@@ -11,6 +11,7 @@
 #import "ShipSearchController.h"
 #import "ApexMobileDB.h"
 #import "DetailTabBarController.h"
+#import "RAUtils.h"
 
 #define SHIP_CELL_IDENTIFIER @"ShippingStatusCell"
 
@@ -19,6 +20,9 @@
 @property (strong, nonatomic) IBOutlet UITableView *shipTableView;
 @property (strong, nonatomic) IBOutlet UISearchBar *shipSearchBar;
 @property (nonatomic,strong) NSMutableArray *shipArray;
+@property (strong, nonatomic) IBOutlet UIButton *emptyBtn;
+@property (nonatomic,strong) UIRefreshControl *refreshControl;
+@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *loadIndicator;
 
 @end
 
@@ -33,6 +37,13 @@
         self.automaticallyAdjustsScrollViewInsets = NO;
     }
     
+    self.emptyBtn.layer.borderColor = [UIColor darkGrayColor].CGColor;
+    self.emptyBtn.layer.borderWidth = 1.0f;
+    self.emptyBtn.layer.cornerRadius = 10.0f;
+    self.emptyBtn.layer.masksToBounds = YES;
+    self.emptyBtn.hidden = YES;
+    
+    [self.loadIndicator stopAnimating];
     
     [self configureTableView];
     self.shipSearchBar.delegate =self;
@@ -84,8 +95,10 @@
     [self.shipTableView registerNib:[UINib nibWithNibName:@"ShippingStatusCell" bundle:nil] forCellReuseIdentifier:SHIP_CELL_IDENTIFIER];
     
     UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
+    refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"loading data..."];
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [self.shipTableView addSubview:refresh];
+    self.refreshControl = refresh;
 }
 
 #pragma mark - Load Data
@@ -98,21 +111,53 @@
 }
 
 - (void)loadData {
-    NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_container_list.json" ofType:nil];
-    NSData *data = [[NSData alloc] initWithContentsOfFile:path];
+//    NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_container_list.json" ofType:nil];
+//    NSData *data = [[NSData alloc] initWithContentsOfFile:path];
+//
+//    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+    
+    if (!self.refreshControl.isRefreshing) {
+        [self.loadIndicator startAnimating];
+    }
+    
+    __weak typeof(self) weakSelf = self;
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+       
+        NSDictionary *json = [RANetwork requestHome];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            if (self.refreshControl.isRefreshing) {
+                [self.refreshControl endRefreshing];
+            }
+            
+            if (self.loadIndicator.isAnimating) {
+                [self.loadIndicator stopAnimating];
+            }
+            
+            int result = [[json objectForKey:@"result"] intValue];
+            if (result == RESULT_TRUE) {
+                [self.shipArray removeAllObjects];
+                [self.shipArray addObjectsFromArray:[json objectForKey:@"container_list"]];
+                [self.shipTableView reloadData];
+                
+            } else {
+                NSString *msg = [json objectForKey:@"err_msg"];
+                [RAUtils message_alert:msg title:@"Warning" controller:weakSelf];
+            }
+            self.emptyBtn.hidden = self.shipArray.count > 0;
+            
+        });
+        
+    });
     
-    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
-    [self.shipArray removeAllObjects];
-    [self.shipArray addObjectsFromArray:[json objectForKey:@"container_list"]];
     
-    [self.shipTableView reloadData];
 }
 
-#pragma mark - Actino
+#pragma mark - Actinon
 
 - (void)refreshControlValueChanged:(UIRefreshControl *)refresh {
     [self loadData];
-    [refresh endRefreshing];
 }
 
 - (void)searchItemClick:(id)sender {
@@ -123,6 +168,11 @@
     
 }
 
+- (IBAction)emptyBtnClick:(id)sender {
+    self.emptyBtn.hidden = YES;
+    [self loadData];
+}
+
 #pragma mark - TableView DataSource && Delegate
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

+ 69 - 6
Apex Mobile/Apex Mobile/Main.storyboard

@@ -105,18 +105,49 @@
                                     <outlet property="delegate" destination="XAM-wb-CvU" id="PnA-NI-Z60"/>
                                 </connections>
                             </tableView>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cGF-KW-91T">
+                                <rect key="frame" x="127" y="303" width="120" height="60"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="120" id="hot-i8-EWa"/>
+                                    <constraint firstAttribute="height" constant="60" id="xbF-Jt-INS"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="20"/>
+                                <state key="normal" title="No Record">
+                                    <color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                                <state key="highlighted">
+                                    <color key="titleColor" red="0.075363273059999999" green="0.47113890539999997" blue="0.99917410539999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </state>
+                                <connections>
+                                    <action selector="emptyBtnClick:" destination="XAM-wb-CvU" eventType="touchUpInside" id="n4w-62-XR9"/>
+                                </connections>
+                            </button>
+                            <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="lwb-OB-0ec">
+                                <rect key="frame" x="163" y="308.5" width="50" height="50"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="50" id="0Je-vB-BLA"/>
+                                    <constraint firstAttribute="height" constant="50" id="kQF-ER-vE6"/>
+                                </constraints>
+                                <color key="color" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            </activityIndicatorView>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstAttribute="trailing" secondItem="Vjd-jz-qR0" secondAttribute="trailing" id="Hxm-ei-DV8"/>
                             <constraint firstItem="Vjd-jz-qR0" firstAttribute="top" secondItem="87u-Wv-7wA" secondAttribute="bottom" id="K9u-F5-9rH"/>
+                            <constraint firstItem="lwb-OB-0ec" firstAttribute="centerX" secondItem="QxY-X5-VD0" secondAttribute="centerX" id="MX3-fu-dD9"/>
+                            <constraint firstItem="cGF-KW-91T" firstAttribute="centerY" secondItem="QxY-X5-VD0" secondAttribute="centerY" id="T4N-PA-dEf"/>
                             <constraint firstItem="Vjd-jz-qR0" firstAttribute="leading" secondItem="QxY-X5-VD0" secondAttribute="leading" id="WDl-k5-IvU"/>
+                            <constraint firstItem="cGF-KW-91T" firstAttribute="centerX" secondItem="QxY-X5-VD0" secondAttribute="centerX" id="cla-bf-9sH"/>
                             <constraint firstItem="3Te-oX-ftj" firstAttribute="top" secondItem="Vjd-jz-qR0" secondAttribute="bottom" id="iTX-qv-NhV"/>
+                            <constraint firstItem="lwb-OB-0ec" firstAttribute="centerY" secondItem="QxY-X5-VD0" secondAttribute="centerY" id="zDT-XE-JLs"/>
                         </constraints>
                     </view>
                     <tabBarItem key="tabBarItem" title="History" image="tab_history" id="TGe-qX-0UY"/>
                     <simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
                     <connections>
+                        <outlet property="emptyBtn" destination="cGF-KW-91T" id="8HC-5j-Xqb"/>
+                        <outlet property="loadIndicator" destination="lwb-OB-0ec" id="NXL-R8-ltN"/>
                         <outlet property="shipTableView" destination="Vjd-jz-qR0" id="fxU-pP-YLW"/>
                     </connections>
                 </viewController>
@@ -260,11 +291,28 @@
                                     <outlet property="delegate" destination="ucJ-C2-JJ8" id="qcO-e8-lls"/>
                                 </connections>
                             </tableView>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RDS-rb-8d8">
+                                <rect key="frame" x="64.5" y="304" width="245" height="60"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="60" id="71k-hL-Hln"/>
+                                    <constraint firstAttribute="width" constant="245" id="I9Y-XO-Wcn"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="20"/>
+                                <state key="normal" title="No Recent Tracking Record">
+                                    <color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                                <state key="highlighted">
+                                    <color key="titleColor" red="0.075363273055734453" green="0.4711389054307723" blue="0.99917410537986562" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </state>
+                                <connections>
+                                    <action selector="emptyBtnClick:" destination="ucJ-C2-JJ8" eventType="touchUpInside" id="hUc-FI-y19"/>
+                                </connections>
+                            </button>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3xo-DP-qWN">
                                 <rect key="frame" x="0.0" y="20" width="375" height="30"/>
                                 <subviews>
-                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recently" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ouQ-Yg-iZI">
-                                        <rect key="frame" x="10" y="5" width="66.5" height="21"/>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recent" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ouQ-Yg-iZI">
+                                        <rect key="frame" x="10" y="5" width="54" height="21"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                         <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <nil key="highlightedColor"/>
@@ -277,21 +325,36 @@
                                     <constraint firstAttribute="height" constant="30" id="bFZ-hk-yg5"/>
                                 </constraints>
                             </view>
+                            <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="WyF-Pl-7ix">
+                                <rect key="frame" x="162" y="309" width="50" height="50"/>
+                                <color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="50" id="0Us-Fh-cOj"/>
+                                    <constraint firstAttribute="width" constant="50" id="6oj-Jm-fcK"/>
+                                </constraints>
+                                <color key="color" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            </activityIndicatorView>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
+                            <constraint firstItem="WyF-Pl-7ix" firstAttribute="centerX" secondItem="ifC-vl-u6I" secondAttribute="centerX" id="0Dt-hM-q3g"/>
                             <constraint firstItem="3xo-DP-qWN" firstAttribute="top" secondItem="70L-ql-L3f" secondAttribute="bottom" id="7dN-EO-3Yh"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="trailing" secondItem="ifC-vl-u6I" secondAttribute="trailing" id="9jR-8W-zYM"/>
                             <constraint firstAttribute="trailing" secondItem="3xo-DP-qWN" secondAttribute="trailing" id="Gvc-tU-QdZ"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="top" secondItem="3xo-DP-qWN" secondAttribute="bottom" id="JZI-44-qDk"/>
+                            <constraint firstItem="RDS-rb-8d8" firstAttribute="centerX" secondItem="iIl-j9-7oa" secondAttribute="centerX" id="Ta8-8u-MVg"/>
+                            <constraint firstItem="WyF-Pl-7ix" firstAttribute="centerY" secondItem="ifC-vl-u6I" secondAttribute="centerY" id="ga0-M2-tYJ"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="lPc-7m-bBJ"/>
                             <constraint firstItem="3xo-DP-qWN" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="mui-fH-ZHN"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="bottom" secondItem="6yV-PD-KCp" secondAttribute="top" id="nZz-HM-ESm"/>
+                            <constraint firstItem="RDS-rb-8d8" firstAttribute="centerY" secondItem="iIl-j9-7oa" secondAttribute="centerY" id="sSc-MF-J2F"/>
                         </constraints>
                     </view>
                     <tabBarItem key="tabBarItem" title="Home" image="tab_home" id="OC9-MV-8nf"/>
                     <simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
                     <connections>
+                        <outlet property="emptyBtn" destination="RDS-rb-8d8" id="Hvx-vb-hoW"/>
+                        <outlet property="loadIndicator" destination="WyF-Pl-7ix" id="smN-0v-oSv"/>
                         <outlet property="shipTableView" destination="iIl-j9-7oa" id="vsk-WU-ScI"/>
                     </connections>
                 </viewController>
@@ -491,7 +554,7 @@
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="65" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="RHV-m7-JCn">
-                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <rect key="frame" x="0.0" y="20" width="375" height="647"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <prototypes>
                                     <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="newsitem" rowHeight="65" id="65E-n4-LH6" customClass="NewsTableViewCell">
@@ -547,7 +610,7 @@
                                 </connections>
                             </tableView>
                             <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="Kgw-c0-JVW">
-                                <rect key="frame" x="169" y="315" width="37" height="37"/>
+                                <rect key="frame" x="169" y="325" width="37" height="37"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="37" id="BfA-aP-CFD"/>
                                     <constraint firstAttribute="height" constant="37" id="fGF-V4-WML"/>
@@ -558,8 +621,8 @@
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
                             <constraint firstAttribute="trailing" secondItem="RHV-m7-JCn" secondAttribute="trailing" id="3FN-UB-gQf"/>
+                            <constraint firstItem="RHV-m7-JCn" firstAttribute="top" secondItem="dOx-gi-yfY" secondAttribute="bottom" id="Hzj-gI-A96"/>
                             <constraint firstItem="Kgw-c0-JVW" firstAttribute="centerX" secondItem="RHV-m7-JCn" secondAttribute="centerX" id="Kbx-zg-bVy"/>
-                            <constraint firstItem="RHV-m7-JCn" firstAttribute="top" secondItem="uxr-eR-WO2" secondAttribute="top" id="Ki8-6B-1yl"/>
                             <constraint firstItem="RHV-m7-JCn" firstAttribute="leading" secondItem="uxr-eR-WO2" secondAttribute="leading" id="deJ-X7-w6r"/>
                             <constraint firstItem="Kgw-c0-JVW" firstAttribute="centerY" secondItem="RHV-m7-JCn" secondAttribute="centerY" id="p67-L8-zdC"/>
                             <constraint firstItem="2sz-FS-Gr9" firstAttribute="top" secondItem="RHV-m7-JCn" secondAttribute="bottom" id="wd8-1o-5zj"/>
@@ -1585,7 +1648,7 @@
         <image name="ic_pdf128" width="64" height="64"/>
         <image name="map (1)" width="32" height="32"/>
         <image name="rect_announcements" width="64" height="64"/>
-        <image name="rect_market_news" width="64" height="64"/>
+        <image name="rect_market_news" width="48" height="48"/>
         <image name="tab_history" width="30" height="30"/>
         <image name="tab_home" width="30" height="30"/>
         <image name="tab_login" width="30" height="30"/>

+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/rect_market_news.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "rect_market_news.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "rect_market_news@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "rect_market_news@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/rect_market_news.imageset/rect_market_news.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/rect_market_news.imageset/rect_market_news@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/rect_market_news.imageset/rect_market_news@3x.png


+ 16 - 3
Apex Mobile/Apex Mobile/OrderHistoryViewController.m

@@ -23,6 +23,8 @@ static const int history_delta = 7;
 @property (nonatomic,strong) NSMutableArray *shipArray;
 @property (nonatomic,strong) JLRefreshHeader *refreshHeader;
 @property (nonatomic,strong) JLRefreshFooter *refreshFooter;
+@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *loadIndicator;
+@property (strong, nonatomic) IBOutlet UIButton *emptyBtn;
 
 @end
 
@@ -38,7 +40,13 @@ static const int history_delta = 7;
         self.automaticallyAdjustsScrollViewInsets = NO;
     }
 
+    self.emptyBtn.layer.borderColor = [UIColor darkGrayColor].CGColor;
+    self.emptyBtn.layer.borderWidth = 1.0f;
+    self.emptyBtn.layer.cornerRadius = 10.0f;
+    self.emptyBtn.layer.masksToBounds = YES;
+    self.emptyBtn.hidden = YES;
     
+    [self.loadIndicator stopAnimating];
     [self configureTableView];
     [self loadData];
 }
@@ -122,6 +130,7 @@ static const int history_delta = 7;
     if (option == 2) {
         offset = self.shipArray.count;
     }
+    [self.loadIndicator startAnimating];
     
     __weak typeof(self) weakSelf = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
@@ -132,6 +141,7 @@ static const int history_delta = 7;
         
         dispatch_async(dispatch_get_main_queue(), ^{
             
+            [weakSelf.loadIndicator stopAnimating];
             int result = [[json objectForKey:@"result"] intValue];
             
             result = 2;
@@ -164,7 +174,7 @@ static const int history_delta = 7;
                 }
                 
             }
-            
+            self.emptyBtn.hidden = self.shipArray.count > 0;
             if (finish) {
                 finish(result,count);
             }
@@ -178,9 +188,12 @@ static const int history_delta = 7;
     
 }
 
-#pragma mark - Actino
-
+#pragma mark - Actinon
 
+- (IBAction)emptyBtnClick:(id)sender {
+    self.emptyBtn.hidden = YES;
+    [self loadData];
+}
 
 #pragma mark - TableView DataSource && Delegate
 

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

@@ -37,5 +37,5 @@
 +(int) ChangePassword : (NSString*) newpass user:(NSString*) user oldpass:(NSString*) oldpass;
 +(bool) UpdateServiceLocation;
 + (NSDictionary *)collectErrMsg:(NSString *)errMsg DeviceInfo:(NSString *)deviceInfo Time:(NSString *)time;
-
++ (NSDictionary *)requestHome;
 @end

+ 46 - 23
Apex Mobile/Apex Mobile/RANetwork.m

@@ -76,10 +76,10 @@
 +(NSMutableDictionary*) prepare_addtional_params:(NSMutableDictionary* ) params
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user!=nil && params[@"user"] == nil)
-        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"Usai2010"] forKey:@"user"];
-    if(appDelegate.password!=nil&& params[@"pwd"] == nil)
-        [params setValue:[AESCrypt AES128Encrypt:appDelegate.password key:@"Usai2010"] forKey:@"pwd"];
+//    if(appDelegate.user!=nil && params[@"user"] == nil)
+//        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"Usai2010"] forKey:@"user"];
+//    if(appDelegate.password!=nil&& params[@"pwd"] == nil)
+//        [params setValue:[AESCrypt AES128Encrypt:appDelegate.password key:@"Usai2010"] forKey:@"pwd"];
     
     if(appDelegate.user!=nil && params[@"user"] == nil)
         [params setValue:appDelegate.user  forKey:@"user"];
@@ -120,7 +120,7 @@
     [params setValue:newpass forKey:@"newpass"];
     [params setValue:@"Change Password" forKey:@"module_name"];
     [params setValue:@"handset_search" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     NSData* json=[self get_json:URL_RETRIEVE_PASS parameters:params file:nil];
     
     
@@ -240,10 +240,10 @@
         BOOL bigger = [versionNum compare:required_ver] ;
         if(!bigger)
             return RESULT_VER_LOW;
-        appDelegate.sessionid = [objheader valueForKey:@"sessionid"];
+//        appDelegate.sessionid = [objheader valueForKey:@"sessionid"];
         appDelegate.user = user;
         appDelegate.password = password;
-        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);
+//        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);
         if ([[objheader valueForKey:@"update"] boolValue]==false)
         {
             // no update on the server;
@@ -254,8 +254,8 @@
 //        [defaults removeObjectForKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
 //        [defaults setInteger:Auth_InfoVer forKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
         
-        [ApexMobileDB jk_excute:@"delete from auth_ver;" completion:nil];
-        [ApexMobileDB jk_excute:[NSString stringWithFormat:@"insert into auth_ver (ver) values (%d);",Auth_InfoVer] completion:nil];
+        [ApexMobileDB execSql:@"delete from auth_ver;" db:db];
+        [ApexMobileDB execSql:[NSString stringWithFormat:@"insert into auth_ver (ver) values (%d);",Auth_InfoVer] db:db];
         
         //        [defaults synchronize];
         
@@ -422,8 +422,8 @@
         return detailContent;
     }
     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
-    //    [params setValue:@"handset_search" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+        [params setValue:@"handset_search" forKey:@"action"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
     if (json==nil)
     {
@@ -460,13 +460,13 @@
         }
         
         
-        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;
-        }
+//        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];
         detailContent.result_code = RESULT_TRUE;
@@ -515,7 +515,7 @@
         return nil;
     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
     [params setValue:@"handset_search" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params  file:nil];
     if (json==nil)
     {
@@ -564,7 +564,7 @@
         return RESULT_NET_NOTAVAILABLE;
     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
     [params setValue:@"handset_search_count" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     
     NSData* json=[self get_json:URL_REQUEST_COUNT parameters:params file:nil];
     if (json==nil)
@@ -645,7 +645,7 @@
     //     [params setValue:@"handset_login" forKey:@"action"];
     //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
     
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     //   [params setValue:password forKey:@"password"];
     //    [params setValue:[NSString stringWithFormat:@"%d",ver]  forKey:@"auth_ver"];
     
@@ -754,7 +754,7 @@
     [params setValue:eid forKey:@"e_id"];
     [params setValue:@"detail" forKey:@"action_type"];
     [params setValue:@"handset_search" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     [params setValue:appDelegate.duid forKey:@"uuid"];
     
     
@@ -851,7 +851,7 @@
     [params setValue:@"Pull Message" forKey:@"module_name"];
     [params setValue:@"ios_list" forKey:@"action_type"];
     [params setValue:@"handset_search" forKey:@"action"];
-    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+//    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
     [params setValue:appDelegate.duid forKey:@"uuid"];
     [params setValue:[NSString stringWithFormat:@"%d",offset] forKey:@"offset"];
     [params setValue:@"20" forKey:@"limit"];
@@ -1206,4 +1206,27 @@
     return resultDic;
 }
 
++ (NSDictionary *)requestHome {
+    
+    NSMutableDictionary *params = [NSMutableDictionary dictionary];
+    
+//    action=hand_new_home_list
+    [params setObject:@"hand_new_home_list" forKey:@"action"];
+    
+    NSData* json=[self get_json:URL_HOME 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;
+    
+}
+
 @end

+ 32 - 20
Apex Mobile/Apex Mobile/config.h

@@ -8,33 +8,45 @@
 
 #ifndef config_h
 #define config_h
+
+
 # ifdef DEBUG
 
 #define test_server
+
 # endif
 
 
 #ifdef test_server
-#define  URL_UPDATE_AUTH  @"https://ra.apexshipping.com/login.php"
-#define URL_REQUEST_COUNT @"https://ra.apexshipping.com/main.php"
-#define URL_REQUEST_RECORDS @"https://ra.apexshipping.com/main.php"
-#define URL_RETRIEVE_PASS @"https://ra.apexshipping.com/main.php"
-#define URL_REQUEST_DETAIL @"https://ra.apexshipping.com/main.php"
-#define URL_ANNOUNCEMENTS @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_NEWS    @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_LOCATIONS @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_PUSH @"https://ra.apexshipping.com/main.php"
-#define  URL_ERR_LOG  @""
+
+
+#define URL_HOME                @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_UPDATE_AUTH         @"http://192.168.0.155/Online/Online/login_new.php"
+#define URL_REQUEST_COUNT       @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_REQUEST_RECORDS     @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_RETRIEVE_PASS       @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_REQUEST_DETAIL      @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_ANNOUNCEMENTS       @"http://192.168.0.155/Online/Online/mobile_news.php"
+#define URL_NEWS                @"http://192.168.0.155/Online/Online/mobile_news.php"
+#define URL_LOCATIONS           @"http://192.168.0.155/Online/Online/mobile_news.php"
+#define URL_PUSH                @"http://192.168.0.155/Online/Online/main_new.php"
+#define URL_ERR_LOG             @""
+
+
 #else
-#define  URL_UPDATE_AUTH  @"https://ra.apexshipping.com/login.php"
-#define URL_REQUEST_COUNT @"https://ra.apexshipping.com/main.php"
-#define URL_REQUEST_RECORDS @"https://ra.apexshipping.com/main.php"
-#define URL_RETRIEVE_PASS @"https://ra.apexshipping.com/main.php"
-#define URL_REQUEST_DETAIL @"https://ra.apexshipping.com/main.php"
-#define URL_ANNOUNCEMENTS @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_NEWS    @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_LOCATIONS @"https://ra.apexshipping.com/mobile_news.php"
-#define URL_PUSH @"https://ra.apexshipping.com/main.php"
-#define  URL_ERR_LOG  @""
+
+
+#define URL_UPDATE_AUTH         @"https://ra.apexshipping.com/login_new.php"
+#define URL_REQUEST_COUNT       @"https://ra.apexshipping.com/main_new.php"
+#define URL_REQUEST_RECORDS     @"https://ra.apexshipping.com/main_new.php"
+#define URL_RETRIEVE_PASS       @"https://ra.apexshipping.com/main_new.php"
+#define URL_REQUEST_DETAIL      @"https://ra.apexshipping.com/main_new.php"
+#define URL_ANNOUNCEMENTS       @"https://ra.apexshipping.com/mobile_news.php"
+#define URL_NEWS                @"https://ra.apexshipping.com/mobile_news.php"
+#define URL_LOCATIONS           @"https://ra.apexshipping.com/mobile_news.php"
+#define URL_PUSH                @"https://ra.apexshipping.com/main_new.php"
+#define URL_ERR_LOG             @""
+
 #endif
+
 #endif /* config_h */