wangmeng 1 рік тому
батько
коміт
34fedadf4e

+ 3 - 2
Asteria/AppDelegate.m

@@ -27,7 +27,8 @@
         // Fallback on earlier versions
     }
     
-    [self xxx_ytkNetConfig];
+//    [self xxx_ytkNetConfig];
+    [PPNetworkHelper openLog];
     self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
     AS_TabBarViewController *tab = [[AS_TabBarViewController alloc] init];
     tab.selectedIndex = 0;
@@ -43,7 +44,7 @@
     YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
     config.securityPolicy.allowInvalidCertificates = YES;
     config.securityPolicy.validatesDomainName = NO;
-    config.baseUrl = [NSString stringWithFormat:@"%@",Formal_Server];
+    config.baseUrl = [NSString stringWithFormat:@"%@",AS_Server];
     NSLog(@"baseUrl-----%@",config.baseUrl)
 }
 

+ 14 - 10
Asteria/Fuction/Login/V/LoginSignUpV.m

@@ -93,18 +93,22 @@
         return;
     }
     
+    NSMutableDictionary *customer = [NSMutableDictionary dictionary];
+    [customer setObject:self.xxx_firstName.text forKey:@"firstname"];
+    [customer setObject:self.xxx_lasetName.text forKey:@"lastname"];
+    [customer setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"];
     NSMutableDictionary *tempDic = [NSMutableDictionary dictionary];
-    [tempDic setObject:self.xxx_firstName.text forKey:@"firstName"];
-    [tempDic setObject:self.xxx_lasetName.text forKey:@"lastName"];
-    [tempDic setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"];
+    [tempDic setObject:customer forKey:@"customer"];
     [tempDic setObject:self.xxx_regPassWord.xxx_passwordTF.text forKey:@"password"];
-    BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected;
-    [tempDic setObject:[NSString stringWithFormat:@"%d",isSubscribedSelect] forKey:@"is_subscribed"];
-    if ([self.xxx_dateLab.text isEqualToString:@"Date Of Birth"]) {
-        [tempDic setObject:@"" forKey:@"birthday"];
-    }else{
-        [tempDic setObject:self.xxx_dateLab.text forKey:@"birthday"];
-    }
+    
+//    BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected;
+//    [tempDic setObject:[NSString stringWithFormat:@"%d",isSubscribedSelect] forKey:@"is_subscribed"];
+//    if ([self.xxx_dateLab.text isEqualToString:@"Date Of Birth"]) {
+//        [tempDic setObject:@"" forKey:@"birthday"];
+//    }else{
+//        [tempDic setObject:self.xxx_dateLab.text forKey:@"birthday"];
+//    }
+    
     [self generaltriggermethodType:1 data:tempDic];
 }
 -(void)action_xxx_subscribedBtnClick:(UIButton *)btn{

+ 1 - 1
Asteria/Fuction/Login/VC/AS_ForgotC.m

@@ -71,7 +71,7 @@
 
 
 -(void)reqNet_forgotPassWord{
-    NSString *url = [NSString stringWithFormat:@"%@%@",Formal_Server,@"login/forgotPassword"];
+    NSString *url = [NSString stringWithFormat:@"%@%@",AS_Server,@"login/forgotPassword"];
     NSMutableDictionary *paraDic = [NSMutableDictionary dictionary];
     [paraDic setObject:self.xxx_emailTFV.xxx_emailTF.text forKey:@"email"];
     [MBProgressHUD showHUDAddedTo:self.view animated:YES];

+ 22 - 25
Asteria/Fuction/Login/VC/AS_LoginC.m

@@ -68,7 +68,7 @@
 -(void)handle_closeEvent:(UIButton *)btn{
     [self.navigationController dismissViewControllerAnimated:YES completion:nil];
 }
--(void)handle_xxx_logInBtnEvent:(UIButton *)btn{//进行登录操
+-(void)handle_xxx_logInBtnEvent:(UIButton *)btn{//进行登录操
     ///登录的跳转
     if (self.xxx_emailTFV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_emailTFV.xxx_emailTF.text]) {
         [self.view makeToast:@"* Please prvide an email address." duration:2 position:CSToastPositionCenter];
@@ -81,32 +81,29 @@
     NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
     params[@"username"] = self.xxx_emailTFV.xxx_emailTF.text;
     params[@"password"] = self.xxx_passwordV.xxx_passwordTF.text;
-//    NSString *josnStr = [Current_normalTool jsonStringFromDictionary:params];
-//    [PPNetworkHelper POST:urlStr parameters:params success:^(id responseObject) {
-//        NSDictionary *tmpDic= responseObject;
-//
-//    } failure:^(NSError *error) {
-//        [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
-//    }];
-    
-    AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
-    
-    manager.requestSerializer = [AFJSONRequestSerializer serializer];
-    
-    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
-    
-    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json", @"text/plain", @"text/html", nil];
-
-    [manager POST:urlStr parameters:params headers:nil progress:^(NSProgress * _Nonnull uploadProgress) {
-        
-    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
-        NSString * jsonStr = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
-        NSDictionary *temDic = [Current_normalTool dicFromjsonStr:jsonStr];
-        NSLog(@"%@",temDic);
-    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
-         
+    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+    [PPNetworkHelper POST:urlStr parameters:params success:^(id responseObject) {
+        [MBProgressHUD hideHUDForView :self.view animated:YES];
+        NSDictionary *tmpDic= responseObject;
+        if([tmpDic[@"status"] intValue] ==1){
+            NSString *token = MM_str(tmpDic[@"data"]);
+            //保存 token
+            [DataUtil setLoginToken:token];
+            @weakify(self)
+            [self.view makeToast:@"Login Suecess" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
+                @strongify(self)
+                [self handle_closeEvent:nil];
+            }];
+        }else{
+            [self.view makeToast:MM_str(tmpDic[@"msg"]) duration:2 position:CSToastPositionCenter];
+        }
+    } failure:^(NSError *error) {
+        [MBProgressHUD hideHUDForView :self.view animated:YES];
+        [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
     }];
 }
+
+
 //注册页面
 -(void)handle_signUpEvent:(UIButton *)btn{
     AS_SignUpC *upVC = [[AS_SignUpC alloc]init];

+ 18 - 1
Asteria/Fuction/Login/VC/AS_SignUpC.m

@@ -48,7 +48,24 @@
 }
 //wm_todo 注册请求
 -(void)reqNet_singup:(NSDictionary *)dic{
-    
+    NSString *urlStr = [NSString stringWithFormat:@"%@V1/customers",AS_Server];
+    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+    [PPNetworkHelper POST:urlStr parameters:@{} success:^(id responseObject) {
+        [MBProgressHUD hideHUDForView:self.view animated:YES];
+        NSDictionary *tmpDic = responseObject;
+        @weakify(self)
+        if([tmpDic[@"status"] intValue] ==1){
+            [self.view makeToast:@"Register Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
+                @strongify(self)
+                [self handle_closeEvent:nil];
+            }];
+        }else{
+            [self.view makeToast:MM_str(tmpDic[@"msg"]) duration:2 position:CSToastPositionCenter];
+        }
+    } failure:^(NSError *error) {
+        [MBProgressHUD hideHUDForView:self.view animated:YES];
+       [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
+    }];
 }
 
 

+ 3 - 6
Asteria/Product/Config/ProjectConfigDefine.h

@@ -9,14 +9,11 @@
 #define ProjectConfigDefine_h
 
 ///wm_tips 所有的pod模块的特定化依赖,每个Project修改,额、
-///
-///////正式服务器
-#define WebBase_Server @"https://app.westkiss.com/"
-#define Formal_Server @"https://app.westkiss.com/app-api/"
 
 ///AS 服务器
-#define AS_WebSever @"http://zyp.hnwmzp.cn/"
-#define AS_Server @"http://zyp.hnwmzp.cn/rest/"
+#define AS_WebSever @"https://pc.bilisar.com"
+#define AS_Server @"https://pc.bilisar.com/rest/"
+
 
 
 ///开发服务器