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

Redant Mobile
Active 接口和后台挂接
Login 接口和后台挂接,并修改无法登陆,无法保存账号密码的问题
增加 order detail 假数据

Ray Zhang 8 лет назад
Родитель
Сommit
118ceeff31

BIN
Ants Contract/AntsContract.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


BIN
Apex Mobile/Apex Mobile.xcodeproj/project.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 4 - 0
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.pbxproj

@@ -44,6 +44,7 @@
 		7197D41A1FBC1BE80063EFBB /* Detail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7197D4191FBC1BE80063EFBB /* Detail.storyboard */; };
 		7197D41A1FBC1BE80063EFBB /* Detail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7197D4191FBC1BE80063EFBB /* Detail.storyboard */; };
 		7197D41C1FBD1CD60063EFBB /* kv.json in Resources */ = {isa = PBXBuildFile; fileRef = 7197D41B1FBD1CD60063EFBB /* kv.json */; };
 		7197D41C1FBD1CD60063EFBB /* kv.json in Resources */ = {isa = PBXBuildFile; fileRef = 7197D41B1FBD1CD60063EFBB /* kv.json */; };
 		7197D41F1FBD2EA60063EFBB /* LineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7197D41E1FBD2EA60063EFBB /* LineView.m */; };
 		7197D41F1FBD2EA60063EFBB /* LineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7197D41E1FBD2EA60063EFBB /* LineView.m */; };
+		7197D4211FBEADCB0063EFBB /* orderdetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 7197D4201FBEADCB0063EFBB /* orderdetail.json */; };
 		71CB70B41FA1CCDB009FDCB7 /* server.json in Resources */ = {isa = PBXBuildFile; fileRef = 71CB70B31FA1CCDB009FDCB7 /* server.json */; };
 		71CB70B41FA1CCDB009FDCB7 /* server.json in Resources */ = {isa = PBXBuildFile; fileRef = 71CB70B31FA1CCDB009FDCB7 /* server.json */; };
 		71E9F6C81F8C5CCB0052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6C61F8C5CCA0052C78E /* NetworkUtils.m */; };
 		71E9F6C81F8C5CCB0052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6C61F8C5CCA0052C78E /* NetworkUtils.m */; };
 		71F3A9A21F5F8E22001036C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F3A9A11F5F8E22001036C8 /* main.m */; };
 		71F3A9A21F5F8E22001036C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F3A9A11F5F8E22001036C8 /* main.m */; };
@@ -179,6 +180,7 @@
 		7197D41B1FBD1CD60063EFBB /* kv.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = kv.json; sourceTree = "<group>"; };
 		7197D41B1FBD1CD60063EFBB /* kv.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = kv.json; sourceTree = "<group>"; };
 		7197D41D1FBD2EA60063EFBB /* LineView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LineView.h; path = ../../../common/detail/LineView.h; sourceTree = "<group>"; };
 		7197D41D1FBD2EA60063EFBB /* LineView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LineView.h; path = ../../../common/detail/LineView.h; sourceTree = "<group>"; };
 		7197D41E1FBD2EA60063EFBB /* LineView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = LineView.m; path = ../../../common/detail/LineView.m; sourceTree = "<group>"; };
 		7197D41E1FBD2EA60063EFBB /* LineView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = LineView.m; path = ../../../common/detail/LineView.m; sourceTree = "<group>"; };
+		7197D4201FBEADCB0063EFBB /* orderdetail.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = orderdetail.json; sourceTree = "<group>"; };
 		71CB70B01FA1BA5E009FDCB7 /* data.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = data.json; sourceTree = "<group>"; };
 		71CB70B01FA1BA5E009FDCB7 /* data.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = data.json; sourceTree = "<group>"; };
 		71CB70B11FA1BA5E009FDCB7 /* layout.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = layout.json; sourceTree = "<group>"; };
 		71CB70B11FA1BA5E009FDCB7 /* layout.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = layout.json; sourceTree = "<group>"; };
 		71CB70B31FA1CCDB009FDCB7 /* server.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = server.json; sourceTree = "<group>"; };
 		71CB70B31FA1CCDB009FDCB7 /* server.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = server.json; sourceTree = "<group>"; };
@@ -566,6 +568,7 @@
 				71FF602E1FA8449C00C5523A /* predef_query.json */,
 				71FF602E1FA8449C00C5523A /* predef_query.json */,
 				7197D4091FB58E530063EFBB /* search_ui.json */,
 				7197D4091FB58E530063EFBB /* search_ui.json */,
 				7197D41B1FBD1CD60063EFBB /* kv.json */,
 				7197D41B1FBD1CD60063EFBB /* kv.json */,
+				7197D4201FBEADCB0063EFBB /* orderdetail.json */,
 			);
 			);
 			name = "fake data";
 			name = "fake data";
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -928,6 +931,7 @@
 				42DFAE7B1F9B2CE6009AFCCC /* Phone_Switch_Cell.xib in Resources */,
 				42DFAE7B1F9B2CE6009AFCCC /* Phone_Switch_Cell.xib in Resources */,
 				71F3A9AB1F5F8E22001036C8 /* Main.storyboard in Resources */,
 				71F3A9AB1F5F8E22001036C8 /* Main.storyboard in Resources */,
 				71F3A9C91F5FA11F001036C8 /* login.json in Resources */,
 				71F3A9C91F5FA11F001036C8 /* login.json in Resources */,
+				7197D4211FBEADCB0063EFBB /* orderdetail.json in Resources */,
 				71F3AA361F612369001036C8 /* CommonEditor.storyboard in Resources */,
 				71F3AA361F612369001036C8 /* CommonEditor.storyboard in Resources */,
 				71FF602F1FA8449C00C5523A /* predef_query.json in Resources */,
 				71FF602F1FA8449C00C5523A /* predef_query.json in Resources */,
 				71F3AA081F5FDDFE001036C8 /* LICENSE in Resources */,
 				71F3AA081F5FDDFE001036C8 /* LICENSE in Resources */,

+ 6 - 0
RedAnt Mobile/RedAnt Mobile/AppDelegate.m

@@ -21,6 +21,12 @@
     // Override point for customization after application launch.
     // Override point for customization after application launch.
     
     
     self.bEnable_Cache = true;
     self.bEnable_Cache = true;
+    
+    
+    NSDictionary* jsonserver=[[NSUserDefaults standardUserDefaults] valueForKey:@"ServerSetting"];
+    
+    self.server = jsonserver[@"serverAddress"];
+    
     return YES;
     return YES;
 }
 }
 
 

+ 5 - 1
RedAnt Mobile/RedAnt Mobile/LoginSettingViewController.m

@@ -61,7 +61,7 @@ if (password.length==0)
         [RAUtils message_alert:@"Company ID can not be empty" title:@"Server setting" controller:self];
         [RAUtils message_alert:@"Company ID can not be empty" title:@"Server setting" controller:self];
         return;
         return;
     }
     }
-    NSMutableDictionary* params = [@{@"company_id":company,@"password":password} mutableCopy];
+    NSMutableDictionary* params =[NSMutableDictionary new];//[@{@"company_id":company,@"password":password} mutableCopy];
     
     
     [params setValue:[AESCrypt AES128Encrypt:company  key:@"Usai2010"] forKey:@"company_id"];
     [params setValue:[AESCrypt AES128Encrypt:company  key:@"Usai2010"] forKey:@"company_id"];
     [params setValue:[AESCrypt AES128Encrypt:password  key:@"Usai2010"] forKey:@"pwd"];
     [params setValue:[AESCrypt AES128Encrypt:password  key:@"Usai2010"] forKey:@"pwd"];
@@ -123,6 +123,10 @@ if (password.length==0)
                         [self dismissViewControllerAnimated:false completion:nil];
                         [self dismissViewControllerAnimated:false completion:nil];
                     break;
                     break;
                 }
                 }
+                case RESULT_NO_RESPONSE:
+                {
+                    [RAUtils message_alert:result_json[@"msg"] title:title controller:weakself];
+                }
                 case RESULT_NET_ERROR:
                 case RESULT_NET_ERROR:
                 {
                 {
                     [RAUtils message_alert:@"Can not connect to server" title:title controller:weakself];
                     [RAUtils message_alert:@"Can not connect to server" title:title controller:weakself];

+ 16 - 16
RedAnt Mobile/RedAnt Mobile/LoginViewController.m

@@ -194,21 +194,21 @@ static NSString *kLoginUserInfo = @"UserInfo";
 #pragma mark - Button Click
 #pragma mark - Button Click
 
 
 - (IBAction)loginBtnClick:(UIButton *)sender {
 - (IBAction)loginBtnClick:(UIButton *)sender {
-//    [self prepareUserData];
+    [self prepareUserData];
 //    if (!self.ServerName.length) {
 //    if (!self.ServerName.length) {
 //        [RAUtils message_alert:@"Please choose an address in setting" title:@"Warning" controller:self];
 //        [RAUtils message_alert:@"Please choose an address in setting" title:@"Warning" controller:self];
 //        return;
 //        return;
 //    }
 //    }
 //
 //
-//    if (!self.user.length) {
-//        [RAUtils message_alert:@"User name cann't be blank" title:@"Warning" controller:self];
-//        return;
-//    }
-//
-//    if (!self.pwd.length) {
-//        [RAUtils message_alert:@"Password cann't be blank" title:@"Warning" controller:self];
-//        return;
-//    }
+    if (!self.user.length) {
+        [RAUtils message_alert:@"User name cann't be blank" title:@"Warning" controller:self];
+        return;
+    }
+
+    if (!self.pwd.length) {
+        [RAUtils message_alert:@"Password cann't be blank" title:@"Warning" controller:self];
+        return;
+    }
    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
 //    appDelegate.address = self.address;
 //    appDelegate.address = self.address;
     __weak typeof(self) weakself = self;
     __weak typeof(self) weakself = self;
@@ -223,7 +223,7 @@ static NSString *kLoginUserInfo = @"UserInfo";
             dispatch_async(dispatch_get_main_queue(), ^{
             dispatch_async(dispatch_get_main_queue(), ^{
                 [alert dismissWithClickedButtonIndex:0 animated:YES];
                 [alert dismissWithClickedButtonIndex:0 animated:YES];
                 int result = [[loginDic objectForKey:@"result"] intValue];
                 int result = [[loginDic objectForKey:@"result"] intValue];
-//                BOOL rememberLogin = [[strongself userDefaultsValue:kRememberLogin] boolValue];
+                BOOL rememberLogin = [[strongself userDefaultsValue:kRememberLogin] boolValue];
                 if (result == RESULT_TRUE) {
                 if (result == RESULT_TRUE) {
                     NSArray *modeList = [loginDic objectForKey:@"mode_list"];
                     NSArray *modeList = [loginDic objectForKey:@"mode_list"];
                     if (modeList != nil) {
                     if (modeList != nil) {
@@ -232,11 +232,11 @@ static NSString *kLoginUserInfo = @"UserInfo";
                         [RAUtils message_alert:@"Something error" title:@"Warning" controller:strongself];
                         [RAUtils message_alert:@"Something error" title:@"Warning" controller:strongself];
                     }
                     }
                     
                     
-//                    if (!rememberLogin) {
-//                        [self setUserDefaultsValue:nil forKey:kLoginUserInfo];
-//                    } else {
-//                        [strongself setUserDefaultsValue:@{@"address" : strongself.address,@"user" : strongself.user,@"pwd" : strongself.pwd} forKey:kLoginUserInfo];
-//                    }
+                    if (!rememberLogin) {
+                        [self setUserDefaultsValue:nil forKey:kLoginUserInfo];
+                    } else {
+                        [strongself setUserDefaultsValue:@{@"user" : strongself.user,@"pwd" : strongself.pwd} forKey:kLoginUserInfo];
+                    }
 //                    appDelegate.bLogin = YES;
 //                    appDelegate.bLogin = YES;
 //                    appDelegate.user = strongself.user;
 //                    appDelegate.user = strongself.user;
 //                    appDelegate.password = strongself.pwd;
 //                    appDelegate.password = strongself.pwd;

+ 15 - 4
RedAnt Mobile/RedAnt Mobile/RANetwork.m

@@ -16,8 +16,14 @@
 +(NSString*) get_url:(NSString*) interface
 +(NSString*) get_url:(NSString*) interface
 {
 {
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
+    return appDelegate.server;
+    
     if(appDelegate.server==nil)
     if(appDelegate.server==nil)
         return nil;
         return nil;
+    
+    
+    
     return [appDelegate.server stringByAppendingPathComponent:interface];
     return [appDelegate.server stringByAppendingPathComponent:interface];
 //    return [NSString stringWithFormat:@"%@%@",appDelegate.server,interface];
 //    return [NSString stringWithFormat:@"%@%@",appDelegate.server,interface];
 }
 }
@@ -386,20 +392,25 @@
 
 
 + (NSDictionary *)Login:(NSString *)user password:(NSString *)password {
 + (NSDictionary *)Login:(NSString *)user password:(NSString *)password {
     
     
+    
+#ifdef FAKE_DATA
     NSString *Path = [[NSBundle mainBundle] pathForResource:@"login.json" ofType:nil];
     NSString *Path = [[NSBundle mainBundle] pathForResource:@"login.json" ofType:nil];
     
     
     NSData* data1 = [NSData dataWithContentsOfFile:Path];
     NSData* data1 = [NSData dataWithContentsOfFile:Path];
     return [[NSJSONSerialization JSONObjectWithData:data1 options:NSJSONReadingMutableContainers error:nil] mutableCopy];
     return [[NSJSONSerialization JSONObjectWithData:data1 options:NSJSONReadingMutableContainers error:nil] mutableCopy];
     
     
+#endif
+    
     
     
+    NSString* encryptu=[AESCrypt AES128Encrypt:user key:@"Usai2010"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:password key:@"Usai2010"];
     
     
     
     
-    NSString* encryptu=[AESCrypt AES128Encrypt:user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:password key:@"usai"];
     
     
     NSMutableDictionary *params = @{@"user":encryptu,
     NSMutableDictionary *params = @{@"user":encryptu,
-                                    @"password":encryptp,
-                                    @"_operate":@"handset_login"
+                                    @"pwd":encryptp,
+                                    @"_operate":@"login",
+                                    @"_action":@"ant_mobile"
                                     }.mutableCopy;
                                     }.mutableCopy;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     

+ 1 - 1
RedAnt Mobile/RedAnt Mobile/config.h

@@ -35,7 +35,7 @@
 
 
 #ifdef test_server
 #ifdef test_server
 #define URL_CUSTOMER_ADV_SEARCH @""
 #define URL_CUSTOMER_ADV_SEARCH @""
-#define URL_LOGIN @""
+#define URL_LOGIN @"wm_postgresql/index.php"
 #define URL_QUERY @""
 #define URL_QUERY @""
 #define  URL_REQUIRE_SERVER  @"http://192.168.0.155/wm_postgresql/ant_mobile_company_valid.php"
 #define  URL_REQUIRE_SERVER  @"http://192.168.0.155/wm_postgresql/ant_mobile_company_valid.php"
 #define URL_KV_DETAIL @""
 #define URL_KV_DETAIL @""

+ 1 - 0
RedAnt Mobile/RedAnt Mobile/const.h

@@ -50,6 +50,7 @@
 
 
 
 
 #define RESULT_FALSE 0
 #define RESULT_FALSE 0
+#define RESULT_NO_RESPONSE 1
 #define RESULT_TRUE         2
 #define RESULT_TRUE         2
 #define RESULT_NO_EMAIL_ADDRESS      3
 #define RESULT_NO_EMAIL_ADDRESS      3
 #define RESULT_NET_SERVER_ERR         -1
 #define RESULT_NET_SERVER_ERR         -1

Разница между файлами не показана из-за своего большого размера
+ 12 - 0
RedAnt Mobile/RedAnt Mobile/orderdetail.json


Некоторые файлы не были показаны из-за большого количества измененных файлов