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

1.修改iOS RA Image,增加通过Model Name获取Manufacture。

Pen Li 8 лет назад
Родитель
Сommit
05f6b9e976

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 18 - 0
RA Image/RA Image.xcodeproj/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,4 +2,22 @@
 <Bucket
    type = "1"
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "../common/upload/RANetworkTaskDelegate.m"
+            timestampString = "522915141.493607"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "81"
+            endingLineNumber = "81"
+            landmarkName = "-URLSession:task:didCompleteWithError:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>

+ 27 - 0
RA Image/RA Image/ModelModeViewController.m

@@ -226,6 +226,33 @@
         barcode = @"";
     }
     self.barcodeLabel.text = [NSString stringWithFormat:@"%@:%@",self.barcodeTitle,barcode];
+    
+    // 从服务器取Manufacture
+    if (barcode.length > 0) {
+        UIAlertView *alert = [RAUtils waiting_alert:@"Loading model's manufactures" title:@"Waiting"];
+        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+            NSDictionary *modelManufacturs = [RAINetwork getModelManufacture:barcode];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [alert dismissWithClickedButtonIndex:0 animated:YES];
+                int result = [[modelManufacturs objectForKey:@"result"] intValue];
+                if (result == 2) {
+                    NSArray *manufacturs = [modelManufacturs objectForKey:@"manufacturer"];
+                    if (manufacturs.count > 0) {
+                        self.manufacturerList = manufacturs;
+                        NSString *manufacter = nil;
+                        if (manufacturs.count == 1) {
+                            manufacter = [manufacturs objectAtIndex:0];
+                        } else {
+                            manufacter = nil;
+                        }
+                        self.manufacturer = manufacter;
+                    }
+                }
+            });
+
+            
+        });
+    }
 }
 
 - (void)setPhotoCount:(NSUInteger)photoCount {

+ 1 - 0
RA Image/RA Image/RAINetwork.h

@@ -13,4 +13,5 @@
 +(NSDictionary*)Login : (NSString*) user password:(NSString*) password;
 +(NSDictionary*)logout;
 +(NSDictionary*)Verify : (NSMutableDictionary*) params;
++ (NSDictionary *)getModelManufacture:(NSString *)model;
 @end

+ 19 - 0
RA Image/RA Image/RAINetwork.m

@@ -148,4 +148,23 @@
     return @{@"result" : @"2"};
 }
 
++ (NSDictionary *)getModelManufacture:(NSString *)model {
+    
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+
+    NSString* encryptu=[AESCrypt AES128Encrypt:appDelegate.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:appDelegate.password key:@"usai"];
+    NSMutableDictionary *params = @{
+                                    @"user":encryptu,
+                                    @"password":encryptp,
+                                    @"_operate":@"handset_get_manufacturer",
+                                    @"barcode":model
+                                    }.mutableCopy;
+    
+    NSData *data = [self get_json:appDelegate.address parameters:params file:nil];
+    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+    return resultDic;
+
+}
+
 @end