Пример #1
0
        /// <summary>
        /// 获取二维码图片
        /// </summary>
        /// <returns></returns>
        public static async Task GetQRCodeAsync()
        {
            PostMessage postMessage = new PostMessage()
            {
                ContentType = "application/x-www-form-urlencoded",
                RequestUri  = CreateQrcodeUrl,
                Content     = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("appid", "otn")
                }
            };

            await postMessage.Post <CreateQRCodeResult>(result =>
            {
                if (result.result_code == "0")
                {
                    QRCodeResult = result;
                }
            });
        }
Пример #2
0
        /// <summary>
        /// 检查二维码扫码状态
        /// </summary>
        /// <returns></returns>
        public static async Task CheckQRCodeAsync()
        {
            PostMessage postMessage = new PostMessage()
            {
                ContentType = "application/x-www-form-urlencoded",
                RequestUri  = CheckQrcodeUrl,
                Content     = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("appid", "otn"),
                    new KeyValuePair <string, string>("uuid", QRCodeResult.uuid),
                    new KeyValuePair <string, string>("RAIL_DEVICEID", GetDeviceID()),
                    new KeyValuePair <string, string>("RAIL_EXPIRATION", GetExpiration()),
                }
            };

            await postMessage.Post <CheckQRCodeResult>(result =>
            {
                CheckQRCodeResult = result;
            });
        }
Пример #3
0
        /// <summary>
        /// 第二次检测用户状态
        /// </summary>
        /// <returns></returns>
        public static async Task ClientAuthAsync()
        {
            PostMessage postMessage = new PostMessage()
            {
                ContentType = "application/x-www-form-urlencoded",
                RequestUri  = ClientAuthUrl,
                Content     = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("tk", AuthResult.newapptk)
                }
            };

            await postMessage.Post <ClientAuthResult>(result =>
            {
                if (result.result_code == "0")
                {
                    ClientAuthResult = result;
                }
            });
        }
Пример #4
0
        /// <summary>
        /// 第一次检测用户状态
        /// </summary>
        /// <returns></returns>
        public static async Task AuthAsync()
        {
            PostMessage postMessage = new PostMessage()
            {
                ContentType = "application/x-www-form-urlencoded",
                RequestUri  = AuthUrl,
                Content     = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("appid", "otn")
                }
            };

            postMessage.CustomHeaders.Add("Referer", ConfigurationManager.AppSettings["Referer"]);
            postMessage.CustomHeaders.Add("Origin", ConfigurationManager.AppSettings["Origin"]);

            await postMessage.Post <AuthResult>(result =>
            {
                if (result.result_code == "0")
                {
                    AuthResult = result;
                }
            });
        }