Beispiel #1
0
        public WebPlayerInfo GetPlayerInfo(string token, string userLoginName, string clientIP)
        {
            try
            {
                string userName = WebClientManager.GetClientUserName(token);
                if (string.IsNullOrEmpty(userName))
                {
                    return(null);
                }

                var playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                if (playerInfo.SimpleInfo.UserLoginName != userLoginName)
                {
                    return(null);
                }

                WebPlayerInfo webPlayerInfo = new WebPlayerInfo()
                {
                    Token           = token,
                    UserName        = playerInfo.SimpleInfo.UserName,
                    UserLoginName   = playerInfo.SimpleInfo.UserLoginName,
                    ShoppingCredits = playerInfo.FortuneInfo.ShoppingCreditsEnabled
                };
                if (playerInfo.FortuneInfo.UserRemoteServerValidStopTime != null)
                {
                    DateTime stopTime = playerInfo.FortuneInfo.UserRemoteServerValidStopTime.ToDateTime();
                    if (stopTime >= DateTime.Now)
                    {
                        webPlayerInfo.UserRemoteServerValidStopTime = playerInfo.FortuneInfo.UserRemoteServerValidStopTime;
                    }
                }
                webPlayerInfo.IsLongTermRemoteServiceUser = playerInfo.FortuneInfo.IsLongTermRemoteServiceUser;
                webPlayerInfo.UserRemoteServiceValidTimes = playerInfo.FortuneInfo.UserRemoteServiceValidTimes;

                return(webPlayerInfo);
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("WEB 玩家登录名 [" + userLoginName + "] 登录矿场失败, IP=" + clientIP, exc);
                return(null);
            }
        }