Просмотр исходного кода

1.修改iOS Apex Drivers Submit和Upload。
2.修改iOS Apex Drivers Submit成功后Crash。

Pen Li 7 лет назад
Родитель
Сommit
e6619907a8

+ 1 - 0
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m

@@ -236,6 +236,7 @@
     vc.orderID = self.orderID;
     vc.actionID = model.actionID;
     vc.actionTitle = model.actionTitle;
+    vc.orderType2 = self.orderType2;
     [self.navigationController pushViewController:vc animated:YES];
 
 }

+ 17 - 17
Redant Drivers/Apex And Drivers/RADataProvider.m

@@ -259,18 +259,18 @@
 
 + (NSDictionary *)submitEditOrder:(NSMutableDictionary *)params {
     
-    sleep(3);
-    
-    return [self fakeError];
-    
-    NSMutableDictionary *result = [NSMutableDictionary dictionary];
-    [result setObject:@(2) forKey:@"result"];
-    for (NSString *key in params.allKeys) {
-        if ([key hasPrefix:@"container_photo"]) {
-            [result setObject:[NSUUID UUID].UUIDString forKey:key];
-        }
-    }
-    return result;
+//    sleep(3);
+//
+//    return [self fakeError];
+//
+//    NSMutableDictionary *result = [NSMutableDictionary dictionary];
+//    [result setObject:@(2) forKey:@"result"];
+//    for (NSString *key in params.allKeys) {
+//        if ([key hasPrefix:@"container_photo"]) {
+//            [result setObject:[NSUUID UUID].UUIDString forKey:key];
+//        }
+//    }
+//    return result;
     
     // ============
     
@@ -278,7 +278,7 @@
         params = [params mutableCopy];
     }
     
-    NSData* json=[self get_json:URL_HOST parameters:params  file:nil];
+    NSData* json=[self get_json:URL_SUBMIT parameters:params  file:nil];
     
     return [self handleJsonData:json];
 }
@@ -296,16 +296,16 @@
 
 + (NSDictionary *)uploadFile:(NSString *)filePath parameters:(NSMutableDictionary *)params {
     
-    sleep(3.0f);
+//    sleep(3.0f);
     
 //    int i = arc4random_uniform(100);
 //    if (i % 2 == 0) {
 //        return @{@"result" : @2};
 //    } else {
-        return @{@"result" : @1};
+//        return @{@"result" : @1};
 //    }
     
-    return [self upload:URL_HOST parameters:params file:filePath];
+    return [self upload:URL_UPLOAD parameters:params file:filePath];
 }
 
 + (NSDictionary *)reportCurrentLocation:(NSString *)location {
@@ -335,7 +335,7 @@
     
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
     
-    NSData* json=[self get_json:URL_HOST parameters:params  file:nil];
+    NSData* json=[self get_json:URL_LOGOUT parameters:params  file:nil];
     
     return [self handleJsonData:json];
 }

+ 1 - 0
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.h

@@ -14,6 +14,7 @@
 @property (nonatomic,copy) NSString *orderID;
 @property (nonatomic,assign) NSInteger actionID;
 @property (nonatomic,copy) NSString *actionTitle;
+@property (nonatomic,copy) NSString *orderType2;
 
 @property (nonatomic,strong) NSIndexPath *editingIndexPath;
 

+ 17 - 6
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -264,6 +264,9 @@
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
+    if (self.orderType2) {
+        [params setObject:self.orderType2 forKey:@"orderType2"];
+    }
     NSMutableArray <RAEditPhotoModel *> *photoArr = [self prepareParams:params];
     
     __weak typeof(self) weakSelf = self;
@@ -280,14 +283,15 @@
                 dispatch_async(dispatch_get_main_queue(), ^{
                     BOOL requiredLocation = [[json objectForKey:@"requiredLocation"] boolValue];
                     [RASingleton sharedInstance].requiredLocation = requiredLocation;
+                    
+                    
+                    if (photoArr.count > 0) {
+                        [strongSelf syncUploadPhotos:photoArr Json:json HUD:hud];
+                    } else {
+                        [self gobackHome];
+                    }
                 });
                 
-                if (photoArr.count > 0) {
-                    [strongSelf syncUploadPhotos:photoArr Json:json HUD:hud];
-                } else {
-                    [self gobackHome];
-                }
-                
             } else {
                 // process error
                 dispatch_async(dispatch_get_main_queue(), ^{
@@ -324,6 +328,9 @@
             
             NSMutableDictionary *params = [NSMutableDictionary dictionary];
             [params setObject:serial forKey:@"serial"];
+            if (self.orderType2) {
+                [params setObject:self.orderType2 forKey:@"orderType2"];
+            }
             [params setObject:@"iOS" forKey:@"platform"];
             NSString *photoPath = [self.photoDir.lastPathComponent stringByAppendingPathComponent:model.photoName];
             
@@ -363,6 +370,10 @@
                     
                     NSMutableDictionary *fileParams = [NSMutableDictionary dictionary];
                     [fileParams setObject:serial forKey:@"serial"];
+                    if (self.orderType2) {
+                        [fileParams setObject:self.orderType2 forKey:@"orderType2"];
+                    }
+                    
                     NSString *photoPath = [self.photoDir stringByAppendingPathComponent:model.photoName];
                     NSDictionary *uploadJson = [RADataProvider uploadFile:photoPath parameters:fileParams];
                     int uploadResult = [[uploadJson objectForKey:@"result"] intValue];

+ 3 - 0
Redant Drivers/Apex And Drivers/config.h

@@ -18,6 +18,9 @@
 #define URL_MORE_ORDER          APPENDING_STR(@"/j/mobile/morePickupOrders.mo/")
 #define URL_DETAIL              APPENDING_STR(@"/j/mobile/orderDetails.mo/")
 #define URL_UPDATE              APPENDING_STR(@"/j/mobile/actionDetails.mo/")
+#define URL_SUBMIT              APPENDING_STR(@"/j/mobile/updateContainerData.mo/")
+#define URL_UPLOAD              APPENDING_STR(@"/j/mobile/uploadContainerFiles.mo/")
+#define URL_LOGOUT              APPENDING_STR(@"/j/mobile/loginOut.mo/")
 
 //#define URL_HOME                @"http://192.168.0.130:8080/MyWeb/Test"
 //#define URL_LOGIN               @"http://192.168.0.130:8080/MyWeb/Test"