Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.Login360_V2"/> class.
        /// </summary>
        /// <param name="retailID">Retail I.</param>
        /// <param name="retailUser">Retail user.</param>
        /// <param name="pid">Pid.</param>
        /// <param name="code">Code.</param>
        public Login360_V2(string retailID, string retailUser, string pid, string code)
        {
            this._retailID   = retailID;
            this._pid        = pid;
            this._retailUser = retailUser;
            this._code       = code;
            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channel360);

            if (gameChannel != null)
            {
                Url             = gameChannel.Url;
                _aceessTokenUrl = gameChannel.TokenUrl;
                GameSdkSetting setting = gameChannel.GetSetting(retailID);
                if (setting != null)
                {
                    AppId      = setting.AppId;
                    AppKey     = setting.AppKey;
                    _appSecret = setting.AppSecret;
                }
                else
                {
                    TraceLog.ReleaseWrite("The sdkChannel section channel360:{0} is null.", retailID);
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannel 360 section is null.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.Login91sdk"/> class.
        /// </summary>
        /// <param name="retailID">Retail I.</param>
        /// <param name="retailUser">Retail user.</param>
        /// <param name="sessionID">Session I.</param>
        public Login91sdk(string retailID, string retailUser, string sessionID)
        {
            this._retailID = retailID;
            SessionID      = sessionID;
            Uin            = retailUser;
            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channel91);

            if (gameChannel != null)
            {
                Url = gameChannel.Url;
                GameSdkSetting setting = gameChannel.GetSetting(retailID);
                if (setting != null)
                {
                    AppId  = setting.AppId;
                    AppKey = setting.AppKey;
                }
                else
                {
                    TraceLog.ReleaseWrite("The sdkChannel section channel91:{0} is null.", retailID);
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannel 91 section is null.");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.LoginMIUI"/> class.
        /// </summary>
        /// <param name="retailID">Retail I.</param>
        /// <param name="retailUser">Retail user.</param>
        /// <param name="sid">Sid.</param>
        public LoginMIUI(string retailID, string retailUser, string sid)
        {
            this._retailID   = retailID;
            this._retailUser = retailUser;
            this._sid        = sid;
            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelMIUI);

            if (gameChannel != null)
            {
                Url = gameChannel.Url;
                GameSdkSetting sdkSetting = gameChannel.GetSetting(retailID);
                if (sdkSetting != null)
                {
                    AppId  = sdkSetting.AppId;
                    AppKey = sdkSetting.AppKey;
                }
                else
                {
                    TraceLog.ReleaseWrite("The sdkChannel section channelMIUI:{0} is null.", retailID);
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannel MIUI section is null.");
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string url          = "";
            string AppKey       = "";
            string AppId        = "";
            bool   isOldVersion = false;

            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelDanle);

            if (gameChannel != null)
            {
                url          = gameChannel.Url;
                isOldVersion = "0.1".Equals(gameChannel.Version);
                GameSdkSetting setting = gameChannel.GetSetting(_retailID);
                if (setting != null)
                {
                    AppKey = setting.AppKey;
                    AppId  = setting.AppId;
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannelV2 Danle section is null.");
            }
            string sig    = AMD5(_token + "|" + AppKey);
            string Url    = Url = string.Format("{0}?app_id={1}&mid={2}&token={3}&sig={4}", url, AppId, _mid, _token, sig);
            string result = HttpRequestManager.GetStringData(Url, "GET");

            DanleSDK sdk = null;

            try
            {
                sdk = JsonUtils.Deserialize <DanleSDK>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (sdk == null || sdk.error_code != 0)
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1}", result, Url);
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, sdk.memberId);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// 子类实现Action处理
        /// </summary>
        /// <returns></returns>
        public override bool TakeAction()
        {
            var user = Current.User;

            if (user != null)
            {
                AccessToken360 = user.Token ?? AccessToken360;
            }
            string appKey    = "";
            string appSecret = "";
            string url       = "{0}?grant_type=refresh_token&refresh_token={1}&client_id={2}&client_secret={3}&scope={4}";

            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channel360);

            if (gameChannel != null)
            {
                GameSdkSetting setting = gameChannel.GetSetting(RetailID);
                if (setting != null)
                {
                    appKey    = setting.AppKey;
                    appSecret = setting.AppSecret;
                    url       = string.Format(url, gameChannel.TokenUrl, RefeshToken, appKey, appSecret, Scope);
                }
            }
            string result   = HttpRequestManager.GetStringData(url, "GET");
            var    getToken = JsonUtils.Deserialize <Login360_V2.SDK360GetTokenError>(result);

            if (getToken != null && !string.IsNullOrEmpty(getToken.error_code))
            {
                ErrorCode = Language.Instance.ErrorCode;
                ErrorInfo = Language.Instance.GetAccessFailure;
                TraceLog.WriteError("获取360 access_token 失败:url={0},result={1},error_code={2},error={3}", url, result,
                                    getToken.error_code, getToken.error);
                return(false);
            }
            if (getToken != null)
            {
                AccessToken360 = getToken.access_token;
                user.Token     = AccessToken360;
            }
            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.LoginTencent"/> class.
        /// </summary>
        public LoginMeiZu(string retailID, string retailUser, string token)
        {
            _retailID   = retailID;
            _retailUser = retailUser;
            _token      = token;


            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelMeiZu);

            if (gameChannel != null)
            {
                GameSdkSetting setting = gameChannel.GetSetting(_retailID);
                if (setting != null)
                {
                    AppKey = setting.AppKey;
                    AppId  = setting.AppId;
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannelV2 Danle section is null.");
            }
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            if (string.IsNullOrEmpty(_sessionID))
            {
                return(false);
            }
            string      key         = _mobileType == MobileType.ptAndroid ? "android" : "ios";
            GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelUC);

            if (gameChannel == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section is null.");
                return(false);
            }
            GameSdkSetting setting = gameChannel.GetSetting(key);

            if (setting == null)
            {
                TraceLog.ReleaseWrite("The sdkChannel UC section channelUC:{0} is null.", key);
                return(false);
            }

            string        id      = ((DateTime.Now - Convert.ToDateTime("1970-1-1")).TotalMilliseconds).ToString().Substring(0, 13);
            string        signSrc = setting.AppId + "sid=" + _sessionID + setting.AppKey;
            string        sign    = AMD5(signSrc);
            StringBuilder sb      = new StringBuilder();

            sb.Append("{");
            sb.Append("\"service\":\"").Append(gameChannel.Service).Append("\",");
            sb.Append("\"id\":\"").Append(id).Append("\",");
            sb.Append("\"game\":{");
            sb.Append("\"cpId\":\"").Append(setting.AppId).Append("\",");
            sb.Append("\"gameId\":\"").Append(setting.GameId).Append("\",");
            sb.Append("\"channelId\":\"").Append(gameChannel.ChannelId).Append("\",");
            sb.Append("\"serverId\":\"").Append(setting.ServerId).Append("\"},");
            sb.Append("\"data\":{");
            sb.Append("\"sid\":\"").Append(_sessionID).Append("\"},");
            sb.Append("\"encrypt\":\"").Append(encrypt).Append("\",");
            sb.Append("\"sign\":\"").Append(sign).Append("\"}");

            string result = httpPost(gameChannel.Url, sb.ToString(), Encoding.UTF8);
            UCInfo ucinfo = null;

            try
            {
                ucinfo = JsonUtils.Deserialize <UCInfo>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (ucinfo == null || ucinfo.state.code != "1")
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1},param:{2},signsrc:{3}", result, gameChannel.Url, sb.ToString(), signSrc);
                return(false);
            }

            _retailUser = ucinfo.data.ucid;

            string[] arr = SnsManager.LoginByRetail(_retailID, _retailUser);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            return(true);
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool CheckLogin()
        {
            string      url          = "";
            string      AppKey       = "";
            string      AppId        = "";
            bool        isOldVersion = false;
            GameChannel gameChannel  = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channelDanle);

            if (gameChannel != null)
            {
                url          = gameChannel.Url;
                isOldVersion = "0.1".Equals(gameChannel.Version);
                GameSdkSetting setting = gameChannel.GetSetting(_retailID);
                if (setting != null)
                {
                    AppKey = setting.AppKey;
                    AppId  = setting.AppId;
                }
            }
            else
            {
                TraceLog.ReleaseWrite("The sdkChannel Danle section is null.");
            }
            string Url = "";

            if (isOldVersion)
            {
                string sig = AMD5(string.Format("api_key={0}&mid={1}&username={2}&sha256_pwd={3}&secret_key={4}", AppId, _mid, username, SHA256(Password), AppKey));
                string vc  = AMD5(string.Format("api_key={0}&mid={1}&username={2}&sig={3}", AppId, PassportID, username, sig));
                Url = string.Format("http://connect.d.cn/connect/json/member/login?api_key={0}&mid={1}&username={2}&vc={3}&sig={4}", AppId, _mid, username, vc, sig);
            }
            else
            {
                string sig = AMD5(string.Format("{0}|{1}", _token, AppKey));
                Url = string.Format("{0}?app_id={1}&mid={2}&token={3}&sig={4}", url, AppId, _mid, _token, sig);
            }
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);

            req.Method = "Get";
            WebResponse resp   = req.GetResponse();
            Stream      stream = resp.GetResponseStream();

            StreamReader reader = new StreamReader(stream);
            string       result = reader.ReadToEnd();

            DanleSDK sdk = null;

            try
            {
                sdk = JsonUtils.Deserialize <DanleSDK>(result);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
                return(false);
            }
            if (sdk == null || sdk.error_code != 0)
            {
                TraceLog.ReleaseWrite("Danlesdk login fail:{0},request url:{1}", result, Url);
                return(false);
            }

            string[] arr = SnsManager.LoginByRetail(_retailID, sdk.memberId);
            this.UserID     = arr[0];
            this.PassportID = arr[1];
            SessionID       = GetSessionId();
            return(true);
        }
Esempio n. 9
0
        private void Check10086Payment(OrderInfo orderInfo)
        {
            try
            {
                string      url         = "http://ospd.mmarket.com:8089/trust";
                string      appId       = "";
                string      version     = "1.0.0";
                int         orderType   = 1;
                GameChannel gameChannel = ZyGameBaseConfigManager.GameSetting.GetChannelSetting(ChannelType.channel10086);
                if (gameChannel != null)
                {
                    url       = gameChannel.Url;
                    version   = gameChannel.Version;
                    orderType = gameChannel.CType.ToInt();
                    GameSdkSetting setting = gameChannel.GetSetting(orderInfo.PayType);
                    if (setting != null)
                    {
                        appId = setting.AppId;
                    }
                    else
                    {
                        return;
                    }
                }
                StringBuilder paramData = new StringBuilder();
                paramData.Append("<?xml version=\"1.0\"?>");
                paramData.AppendFormat("<Trusted2ServQueryReq>");
                paramData.AppendFormat("<MsgType>{0}</MsgType>", "Trusted2ServQueryReq");
                paramData.AppendFormat("<Version>{0}</Version>", version);
                paramData.AppendFormat("<AppID>{0}</AppID>", appId);
                paramData.AppendFormat("<OrderID>{0}</OrderID>", orderInfo.OrderNO);
                paramData.AppendFormat("<OrderType>{0}</OrderType>", orderType);
                paramData.AppendFormat("</Trusted2ServQueryReq>");

                var         stream = HttpUtils.Post(url, paramData.ToString(), Encoding.UTF8, HttpUtils.XmlContentType);
                XmlDocument doc    = new XmlDocument();
                doc.Load(stream);
                TraceLog.ReleaseWriteFatal("10068 order:{0} response:{1}", orderInfo.OrderNO, doc.InnerXml);
                var returnCode = doc.SelectSingleNode("Trusted2ServQueryResp/ReturnCode");
                if (returnCode != null && !string.IsNullOrEmpty(returnCode.InnerText))
                {
                    int code = returnCode.InnerText.ToInt();
                    if (code == 0)
                    {
                        string orderNo     = "";
                        var    orderIDNode = doc.SelectSingleNode("Trusted2ServQueryResp/OrderID");
                        if (orderIDNode != null)
                        {
                            orderNo = orderIDNode.InnerText;
                        }
                        var priceNode = doc.SelectSingleNode("Trusted2ServQueryResp/TotalPrice");
                        if (priceNode != null)
                        {
                            decimal amount = priceNode.InnerText.ToDecimal();
                            orderInfo.Amount    = amount;
                            orderInfo.GameCoins = (int)amount * 10;
                        }
                        PayManager.PaySuccess(orderNo, orderInfo);
                    }
                    TraceLog.ReleaseWriteFatal("10086 payment order:{0} fail code:{1}", orderInfo.OrderNO, code);
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("10086 payment error:", ex);
            }
        }