绑定手机相关报错修改
This commit is contained in:
@@ -7,7 +7,7 @@ import com.idlefish.flutterboost.FlutterBoost;
|
||||
import com.idlefish.flutterboost.FlutterBoostDelegate;
|
||||
import com.idlefish.flutterboost.containers.FlutterBoostActivity;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.ui.login.BinderPhoneActivity;
|
||||
import com.yizhuan.erban.ui.login.BindPhoneActivity;
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
@@ -39,7 +39,7 @@ public class XplanFlutterBoostDelegate implements FlutterBoostDelegate {
|
||||
if (UserModel.get().getCacheLoginUserInfo().isBindPhone()) {
|
||||
ModifyPwdActivity.start(context, ModifyPwdActivity.PAY_PWD);
|
||||
} else {
|
||||
context.startActivity(new Intent(context, BinderPhoneActivity.class));
|
||||
BindPhoneActivity.start(context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class XplanFlutterBoostDelegate implements FlutterBoostDelegate {
|
||||
Intent intent = new Intent(context, BinderAlipayActivity.class);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
context.startActivity(new Intent(context, BinderPhoneActivity.class));
|
||||
BindPhoneActivity.start(context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.HallInfo;
|
||||
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
@@ -50,6 +51,7 @@ import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_core.withdraw.WithdrawModel;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
@@ -57,6 +59,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 08/06/2018.
|
||||
|
@@ -515,158 +515,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ登录-给耳伴老用户进行使用 QQ 登录用的,使老用可以继续使用以前的账号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> qqLoginForErbanOldMember(String yiDunToken, String shuMeiDeviceId) {
|
||||
final String[] openid = new String[1];
|
||||
final String[] unionid = new String[1];
|
||||
return Single.create(new SingleOnSubscribe<Platform>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
||||
qq = ShareSDK.getPlatform(QQ.NAME);
|
||||
if (qq == null || !qq.isClientValid()) {
|
||||
e.onError(new Throwable("未安装腾讯QQ或TIM"));
|
||||
return;
|
||||
}
|
||||
if (qq.isAuthValid()) {
|
||||
qq.removeAccount(true);
|
||||
}
|
||||
qq.setPlatformActionListener(new PlatformActionListener() {
|
||||
@Override
|
||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||
if (i == Platform.ACTION_USER_INFOR) {
|
||||
String openid = platform.getDb().getUserId();
|
||||
String unionid = platform.getDb().get("unionid");
|
||||
Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
||||
|
||||
thirdUserInfo = new ThirdUserInfo();
|
||||
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||
DemoCache.saveThirdUserInfo(thirdUserInfo);
|
||||
e.onSuccess(platform);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Platform platform, int i, Throwable throwable) {
|
||||
e.onError(new Throwable("获取QQ登录信息错误"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Platform platform, int i) {
|
||||
e.onError(new Throwable("QQ登录取消"));
|
||||
}
|
||||
});
|
||||
qq.SSOSetting(false);
|
||||
qq.showUser(null);
|
||||
|
||||
}
|
||||
})
|
||||
.flatMap(platform -> {
|
||||
openid[0] = platform.getDb().getUserId();
|
||||
unionid[0] = platform.getDb().get("unionid");
|
||||
return isExistsQQAccount(openid[0]);
|
||||
})
|
||||
.flatMap(stringServiceResult -> {
|
||||
if (stringServiceResult.isSuccess()) {
|
||||
return thirdLogin(openid[0], unionid[0], TYPE_QQ_LOGIN, yiDunToken, shuMeiDeviceId)
|
||||
.flatMap(s -> imLogin(currentAccountInfo));
|
||||
} else {
|
||||
throw new OldMemberException(stringServiceResult, openid[0]);
|
||||
}
|
||||
})
|
||||
.subscribeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnSuccess(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) throws Exception {
|
||||
//登录成功
|
||||
EventBus.getDefault().post(new LoginEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号密码登录(耳伴老用户绑定 QQ 号登录音游)
|
||||
*
|
||||
* @param account
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> loginForOldMember(String account, String password, String openid) {
|
||||
return Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
//获取登录信息
|
||||
try {
|
||||
LoginResult loginResult = api.loginForOldMember(
|
||||
account,
|
||||
VersionUtil.getLocalName(BasicConfig.INSTANCE.getAppContext()),
|
||||
"erban-client",
|
||||
account,
|
||||
DESAndBase64(password),
|
||||
"password",
|
||||
"uyzjdhds",
|
||||
TYPE_LOGIN_BIND_QQ,
|
||||
openid
|
||||
).blockingGet();
|
||||
if (!loginResult.isSuccess()) {
|
||||
if (loginResult.getCode() == CODE_BAN_ACCOUNT || loginResult.getCode() == CODE_BAN_DEVICE) {
|
||||
emitter.onError(new BanAccountException(loginResult.getReason(), loginResult.getDate()));
|
||||
} else {
|
||||
emitter.onError(new Throwable(loginResult.getMessage()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
currentAccountInfo = loginResult.getData();
|
||||
DemoCache.saveCurrentAccountInfo(currentAccountInfo);
|
||||
//成功获取到uid后,就通知首页刷新审核中状态的数据
|
||||
EventBus.getDefault().post(new GetCurrentUidEvent(true));
|
||||
} catch (Exception e) {
|
||||
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
|
||||
return;
|
||||
}
|
||||
//获取tick
|
||||
try {
|
||||
TicketResult ticketResult = requestTicket().blockingGet();
|
||||
if (!ticketResult.isSuccess()) {
|
||||
emitter.onError(new Throwable(ticketResult.getMessage()));
|
||||
return;
|
||||
}
|
||||
ticketInfo = ticketResult.getData();
|
||||
DemoCache.saveTicketInfo(ticketInfo);
|
||||
|
||||
} catch (Exception e) {
|
||||
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
|
||||
return;
|
||||
}
|
||||
emitter.onSuccess("登录成功!");
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<String, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(String s) throws Exception {
|
||||
return imLogin(currentAccountInfo);
|
||||
}
|
||||
})
|
||||
.doOnSuccess(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) throws Exception {
|
||||
//登录成功后发出登录事件
|
||||
EventBus.getDefault().post(new LoginEvent());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方信息登录
|
||||
*
|
||||
|
@@ -50,20 +50,10 @@ public interface IAuthModel extends IModel{
|
||||
*/
|
||||
Single<String> login(String account, String password, String code, String yiDunToken, String shuMeiDeviceId);
|
||||
|
||||
/**
|
||||
* 账号密码登录(耳伴老用户绑定 QQ 时的登录)
|
||||
* @param account
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
Single<String> loginForOldMember(String account, String password, String openid);
|
||||
|
||||
Single<String> wxLogin(String yiDunToken, String shuMeiDeviceId);
|
||||
|
||||
Single<String> qqLogin(String yiDunToken, String shuMeiDeviceId);
|
||||
|
||||
Single<String> qqLoginForErbanOldMember(String yiDunToken, String shuMeiDeviceId);
|
||||
|
||||
Single<ServiceResult<String>> isExistsQQAccount(String qqOpenid);
|
||||
|
||||
/**
|
||||
|
@@ -212,6 +212,11 @@ public final class UserModel extends BaseModel implements IUserModel {
|
||||
if (null == userInfo) {
|
||||
return Single.error(new Exception("服务器返回的userInfo字段为空"));
|
||||
}
|
||||
//需要完善用户信息,网络不好的时候onLogin之前有可能调用到,所以这里也需要判断
|
||||
if (TextUtils.isEmpty(userInfo.getNick()) || TextUtils.isEmpty(userInfo.getAvatar())) {
|
||||
EventBus.getDefault().post(new NeedCompleteInfoEvent());
|
||||
return Single.error(new Throwable("need nick and avatar"));
|
||||
}
|
||||
userInfo = NobleUtil.setCompletedNobleInfo(userInfo);
|
||||
currentUserInfo = userInfo;
|
||||
cache.put(cUid, userInfo);
|
||||
|
Reference in New Issue
Block a user