淘先锋技术网

首页 1 2 3 4 5 6 7

- (IBAction)btnWeiXinLoginPressed:(id)sender {
    
    //
    //    [UMSocialWechatHandler setWXAppId:@"wxe703a7f636765bb5" appSecret:@"146f0853232d25435e5d97a87ecd138d" url:appUrl];
    
    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession];
    
    snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){
        
        if (response.responseCode == UMSResponseCodeSuccess) {
            
            NSDictionary *dict = [UMSocialAccountManager socialAccountDictionary];
            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:snsPlatform.platformName];
            NSLog(@"\nusername = %@,\n usid = %@,\n token = %@ iconUrl = %@,\n unionId = %@,\n thirdPlatformUserProfile = %@,\n thirdPlatformResponse = %@ \n, message = %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL, snsAccount.unionId, response.thirdPlatformUserProfile, response.thirdPlatformResponse, response.message);
            
            NSDictionary *dic = @{@"uid":snsAccount.usid};
            [RequestEngine postRequestHttp:@"/user/uidLogin.do" paramDic:dic blockObject:^(NSDictionary *dic) {
                if (dic) {
                    id dict = [dic objectForKey:@"data"];
                    NSString *userName = @"";
                    if ([dict isKindOfClass:[NSDictionary class]]) {
                        userName = [NSString stringWithFormat:@"%@",[(NSDictionary *)dict objectForKey:@"userinfo_id"]];
                    }else{
                        userName = [NSString stringWithFormat:@"%@",[dic objectForKey:@"data"]];
                    }
                    NSString *pwd = [NSString stringWithFormat:@"%i1",[userName intValue]];
                    [self hxLoginWithUserName:userName WithPassword:pwd];//从第三方获取数据后,在当前app用获取到的数据注册,注册是后台写好的接口;
                    
                }
            }];


        }
        
    });
    
}