예제 #1
0
파일: LoginMIUI.cs 프로젝트: dongliang/Scut
        public override bool CheckLogin()
        {
            SetParameter("appId", AppId);
            SetParameter("session", _sid);
            SetParameter("uid", _retailUser);
            string sing = GetSign();

            sing = EncryptionManager.HMACSHA1Encrypt(sing, AppKey);
            string urlData = string.Format("appId={0}&session={1}&uid={2}&signature={3}",
                                           AppId,
                                           _sid,
                                           _retailUser,
                                           HttpUtility.UrlEncode(sing)
                                           );

            urlData = Url + "?" + urlData;
            string result = HttpRequestManager.GetStringData(urlData, "GET");

            try
            {
                if (!string.IsNullOrEmpty(result))
                {
                    var sdk = JsonUtils.Deserialize <SDKMIUIError>(result);
                    if (sdk == null || (!string.IsNullOrEmpty(sdk.errcode) && sdk.errcode != "200"))
                    {
                        TraceLog.ReleaseWrite("MIUIsdk login get user info fail:{0},errorCode:{1},request url:{2}", sdk.errMsg,
                                              sdk.errcode, urlData);
                        return(false);
                    }
                    string[] arr = SnsManager.LoginByRetail(_retailID, _sid);
                    this.UserID     = arr[0];
                    this.PassportID = arr[1];
                    QihooUserID     = _sid;
                    SessionID       = GetSessionId();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
        }