微信登陆,bug修改
This commit is contained in:
@@ -108,6 +108,7 @@ Assign BOOL isPush;
|
||||
[self creatReatRefreshView];//上拉加载更多
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateUserInfobyValidation) name:@"updateUserInfobyValidation" object:nil];
|
||||
}
|
||||
|
||||
-(void)updateDevice{
|
||||
@@ -117,8 +118,45 @@ Assign BOOL isPush;
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"DeleteCurDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateUserInfobyValidation" object:nil];
|
||||
}
|
||||
-(void)updateUserInfobyValidation
|
||||
{
|
||||
[self addDataRequestQueue];
|
||||
UserModel*model=[dataContorl getUserInfo];
|
||||
if (model.unionId)
|
||||
{
|
||||
[AFHttpTool requestWihtMethod:RequestMethodTypePost
|
||||
url:kUserWechatValidation
|
||||
params:@{@"unionId":[CommonUtils getNotNilStr:model.unionId]}
|
||||
success:^(id response) {
|
||||
if (!response) {
|
||||
return ;
|
||||
}
|
||||
NSDictionary*dict=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *result=dict[@"result"];
|
||||
|
||||
if ([result isEqualToString:@"100"]) {
|
||||
|
||||
// 登录成功
|
||||
NSDictionary*dataDic=dict[@"data"];
|
||||
|
||||
NSDictionary *userDic=dataDic[@"userInfo"];
|
||||
UserModel *model=[[UserModel alloc] initWithDict:userDic];
|
||||
[[DataCenter defaultDtacenter]setValue:model forKey:@"UserLogIn"];
|
||||
NSDictionary *userAssetDic=dataDic[@"userAsset"];
|
||||
IfishUserAsset *userAsset =[[IfishUserAsset alloc] initWithDict:userAssetDic];
|
||||
[[DataCenter defaultDtacenter]setValue:userAsset forKey:@"IfishUserAsset"];
|
||||
[self getUsernameAddImg];
|
||||
}
|
||||
|
||||
} failure:^(NSError *err) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)addDataRequestQueue
|
||||
{
|
||||
//创建异步任务队列 避免UI更新受影响
|
||||
@@ -518,11 +556,12 @@ Assign BOOL isPush;
|
||||
}
|
||||
|
||||
-(void)getUsernameAddImg{
|
||||
|
||||
IfishUserAsset *userAsset = [dataContorl getAllIfishUserAsset];
|
||||
UserModel*umodel=[dataContorl getUserInfo];
|
||||
NSString*wechatImgUrl=[[NSUserDefaults standardUserDefaults] stringForKey:@"wechatImgUrl"];
|
||||
_userNameLabel.text = umodel.nickName;
|
||||
[_userNameLabel sizeToFit];
|
||||
|
||||
CGFloat btnH = 40*KWidth_Scale;
|
||||
CGFloat btnW =100*KWidth_Scale;
|
||||
_levelBtn.frame = CGRectMake(CGRectGetMaxX(_userNameLabel.frame) + 2, CGRectGetMaxY(_userNameLabel.frame) - btnH,btnW, btnH);
|
||||
@@ -545,7 +584,13 @@ Assign BOOL isPush;
|
||||
|
||||
[_userImgView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"userIcon%d.png",i]]];
|
||||
|
||||
}else{
|
||||
}else if (wechatImgUrl.length){
|
||||
|
||||
|
||||
[_userImgView sd_setImageWithURL:[NSURL URLWithString:wechatImgUrl]];
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
NSLog(@"%@",[NSString stringWithFormat:@"%@%@",kGetIconUrl,umodel.userImg]);
|
||||
[_userImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetIconUrl,umodel.userImg]]];
|
||||
|
||||
Reference in New Issue
Block a user