Esempio n. 1
0
        /// <summary>
        /// 轮询二维码扫描信息
        /// </summary>
        /// <returns></returns>
        public async Task <LoginCallbackModel> PollQRAuthInfo(string auth_code)
        {
            try
            {
                var result = await loginAPI.QRLoginPoll(auth_code, guid).Request();

                if (result.status)
                {
                    var data = await result.GetData <Token_info>();

                    if (data.success)
                    {
                        SettingHelper.Set_Access_key(data.data.access_token);
                        SettingHelper.Set_Refresh_Token(data.data.refresh_token);
                        SettingHelper.Set_LoginExpires(DateTime.Now.AddSeconds(data.data.expires_in));
                        SettingHelper.Set_UserID(data.data.mid);
                        await SSO(data.data.access_token);

                        MessageCenter.SendLogined();
                        return(new LoginCallbackModel()
                        {
                            status = LoginStatus.Success,
                            message = ""
                        });
                    }
                    else
                    {
                        return(new LoginCallbackModel()
                        {
                            status = LoginStatus.Fail,
                            message = data.message
                        });
                    }
                }
                else
                {
                    return(new LoginCallbackModel()
                    {
                        status = LoginStatus.Fail,
                        message = result.message
                    });
                }
            }
            catch (Exception ex)
            {
                return(new LoginCallbackModel()
                {
                    status = LoginStatus.Fail,
                    message = ex.Message
                });
            }
        }