private void RefreshWechatBindResult() { if (!_getAuthCode) { return; } if (_wechatBindResultRefreshTime >= _wechatBindResult.Timestamp) { return; } _wechatBindResultRefreshTime = _wechatBindResult.Timestamp; var res = _wechatBindResult.Read(); if (res.res == null) { return; } var dialogManager = GetDialogManager(); dialogManager.ShowWaitingDialog(false); if (res.res.code == ResultCode.OK) { // 转正成功。 GetAppController().ClearAppStateData(); dialogManager.ShowConfirmBox( "恭喜您绑定微信成功!", true, "马上登陆", () => { LoginRecord.LastLoginType = LoginRecord.Wechat; LoginRecord.SaveOpenId(res.open_id); LoginRecord.SaveAll(); GetNetworkManager().InitLogin(); }, false, null, null, true, false, false); GetRemoteAPI().RequestUserInfo(); } else { var msg = res.res.msg; if (!string.IsNullOrEmpty(msg)) { dialogManager.ShowConfirmBox(msg); } else { dialogManager.ShowToast("绑定微信失败!", 2, true); } } Exit(); }
private void RefreshWechatAuthResult(IAppContext context) { var dialogManager = _context.GetDialogManager(); if (_wechatAuthResultRefreshTime >= _wechatAuthResultContainer.Timestamp) { return; } _wechatAuthResultRefreshTime = _wechatAuthResultContainer.Timestamp; var res = _wechatAuthResultContainer.Read(); if (res.res.code != ResultCode.OK) { MyLog.ErrorWithFrame(Tag, "WechatAuthResult res.res.code =" + res.res.code); var msg = res.res.msg; if (!string.IsNullOrEmpty(msg)) { dialogManager.ShowToast(msg, 2, true); } else { dialogManager.ShowToast("登陆失败,请重新登录!", 2, true); } ChangeAccount(); } else { var openId = res.open_id; LoginRecord.SaveOpenId(openId); MyLog.InfoWithFrame(Tag, "WechatAuthResult SaveOpenId openId = " + openId); DoWechatLogin(context, openId); } }