微信登陆,bug修改
This commit is contained in:
@@ -117,7 +117,7 @@ typedef NS_ENUM(NSInteger, IfishGoodsListType){
|
||||
longitude:(double)longitude
|
||||
latitude:(double)latitude
|
||||
success:(void (^)(id response))success
|
||||
failure:(void (^)(NSError* err))failure;
|
||||
failure:(void (^)(NSError* err))failure expara:(NSDictionary*)dic;
|
||||
/*
|
||||
*获取更多用户数据 get 请求
|
||||
*/
|
||||
|
||||
@@ -378,20 +378,42 @@ methodType url : (NSString *)url
|
||||
longitude:(double)longitude
|
||||
latitude:(double)latitude
|
||||
success:(void (^)(id))success
|
||||
failure:(void (^)(NSError *))failure
|
||||
failure:(void (^)(NSError *))failure expara:(NSDictionary *)dic
|
||||
{
|
||||
NSDictionary*para=@{@"version":@"1.0",
|
||||
@"phoneNumber":phoneNumber,
|
||||
@"userPassword":userPassword,
|
||||
@"loginType":phoneType,
|
||||
@"address":address,
|
||||
@"longitude":[NSString stringWithFormat:@"%f",longitude],
|
||||
@"latitude":[NSString stringWithFormat:@"%f",latitude]
|
||||
};
|
||||
NSDictionary*para=@{};
|
||||
NSString*url;
|
||||
RequestMethodType type=RequestMethodTypePost;
|
||||
if (dic[@"code"])//微信登登陆授权
|
||||
{
|
||||
para=@{@"code":dic[@"code"]
|
||||
};
|
||||
url=kUserWechatLoginValidation;
|
||||
//type=RequestMethodTypeGet;
|
||||
}
|
||||
else if (dic[@"unionId"])//微信unionId登陆
|
||||
{
|
||||
para=@{@"unionId":dic[@"unionId"]
|
||||
};
|
||||
url=kUserWechatValidation;
|
||||
}
|
||||
else
|
||||
{
|
||||
para=@{@"version":@"1.0",
|
||||
@"phoneNumber":phoneNumber,
|
||||
@"userPassword":userPassword,
|
||||
@"loginType":phoneType,
|
||||
@"address":address,
|
||||
@"longitude":[NSString stringWithFormat:@"%f",longitude],
|
||||
@"latitude":[NSString stringWithFormat:@"%f",latitude]
|
||||
};
|
||||
url=kUserLoginValidation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//kUserSafeLogin
|
||||
[AFHttpTool requestWihtMethod:RequestMethodTypePost
|
||||
url:kUserLoginValidation
|
||||
[AFHttpTool requestWihtMethod:type
|
||||
url:url
|
||||
params:para
|
||||
success:success
|
||||
failure:failure];
|
||||
|
||||
@@ -48,7 +48,12 @@
|
||||
NSString*pasword=[userDefsult objectForKey:@"password"];
|
||||
|
||||
NSString*address=[userDefsult objectForKey:@"address"];
|
||||
|
||||
NSString*unionId=[userDefsult objectForKey:@"unionId"];
|
||||
NSDictionary*para=nil;
|
||||
if (!pasword.length&&unionId.length)
|
||||
{
|
||||
para=@{@"unionId":unionId};
|
||||
}
|
||||
double userlongitude=[userDefsult doubleForKey:@"userlongitude"];
|
||||
double userlatitude=[userDefsult doubleForKey:@"userlatitude"];
|
||||
|
||||
@@ -67,7 +72,12 @@
|
||||
|
||||
[userDefsult setObject:@"0" forKey:@"isExit"];
|
||||
|
||||
NSString*passWordStr=[MyMD5 md5:pasword];
|
||||
NSString*passWordStr;
|
||||
if (pasword.length)
|
||||
{
|
||||
passWordStr=[MyMD5 md5:pasword];
|
||||
}
|
||||
|
||||
//__weak typeof (self) weakSelf=self;
|
||||
[AFHttpTool userLogInWithPhoneNumber:name password:passWordStr phoneType:@"ios" address:address
|
||||
longitude:userlongitude
|
||||
@@ -123,7 +133,7 @@
|
||||
NSString *errstr = [NSString stringWithFormat:@"%@",err];
|
||||
BLYLog(BuglyLogLevelWarn, errstr);
|
||||
|
||||
}];
|
||||
} expara:para];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* 登陆验证成功 返回 自动登录
|
||||
*/
|
||||
-(void)userAutologinSuccsess:(NSDictionary *)dataDic;
|
||||
-(void)setAppTabRoot;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#import "NSObject+LBLaunchImage.h"
|
||||
#import "IfishLoadingWebViewController.h"
|
||||
#import "IfishADTimerViewController.h"
|
||||
#import "RegistViewController.h"
|
||||
@implementation IfishUserDataUnity
|
||||
|
||||
+(IfishUserDataUnity*)shareDataInstance
|
||||
@@ -39,9 +40,21 @@
|
||||
[[DataCenter defaultDtacenter]setValue:userAsset forKey:@"IfishUserAsset"];
|
||||
|
||||
NSUserDefaults*userdefult=[NSUserDefaults standardUserDefaults];
|
||||
if (password.length)
|
||||
{
|
||||
[userdefult setObject:password forKey:@"password"];
|
||||
}
|
||||
if (phoneNumber.length) {
|
||||
[userdefult setObject:phoneNumber forKey:@"name"];
|
||||
}
|
||||
if (model.unionId.length) {
|
||||
[userdefult setObject:model.unionId forKey:@"unionId"];
|
||||
}
|
||||
if (model.wechatImgUrl.length) {
|
||||
[userdefult setObject:model.wechatImgUrl forKey:@"wechatImgUrl"];
|
||||
}
|
||||
|
||||
|
||||
[userdefult setObject:password forKey:@"password"];
|
||||
[userdefult setObject:phoneNumber forKey:@"name"];
|
||||
[userdefult setObject:@"0" forKey:@"isExit"];
|
||||
[userdefult setObject:model.userId forKey:@"userId"];
|
||||
|
||||
@@ -55,7 +68,16 @@
|
||||
|
||||
NSLog(@"userDic:%@",userDic);
|
||||
NSLog(@"登录成功");
|
||||
[self setAppTabRoot];
|
||||
BOOL skiped =[userdefult boolForKey:[CommonUtils getNotNilStr:model.unionId]];
|
||||
if (!skiped&&[CommonUtils getNotNilStr:model.phoneNumber].length==0&&[CommonUtils getNotNilStr:model.unionId].length)
|
||||
{
|
||||
[self bindPhone];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setAppTabRoot];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +88,14 @@
|
||||
NSDictionary *userDic=dataDic[@"userInfo"];
|
||||
UserModel *model=[[UserModel alloc] initWithDict:userDic];
|
||||
[[DataCenter defaultDtacenter]setValue:model forKey:@"UserLogIn"];
|
||||
|
||||
NSUserDefaults*userdefult=[NSUserDefaults standardUserDefaults];
|
||||
if (model.unionId.length) {
|
||||
[userdefult setObject:model.unionId forKey:@"unionId"];
|
||||
}
|
||||
if (model.wechatImgUrl.length) {
|
||||
[userdefult setObject:model.wechatImgUrl forKey:@"wechatImgUrl"];
|
||||
}
|
||||
[userdefult synchronize];
|
||||
//金币任务等级
|
||||
NSDictionary *userAssetDic=dataDic[@"userAsset"];
|
||||
IfishUserAsset *userAsset =[[IfishUserAsset alloc] initWithDict:userAssetDic];
|
||||
@@ -153,5 +182,13 @@
|
||||
[UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
|
||||
|
||||
}
|
||||
-(void)bindPhone
|
||||
{
|
||||
RegistViewController*revv=[[RegistViewController alloc]init];
|
||||
revv.isBind=YES;
|
||||
revv.isFromLogin=YES;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:revv];
|
||||
[UIApplication sharedApplication].delegate.window.rootViewController=nav;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user