public OperResultObject Login(string clientIP, string userLoginName, string password) { OperResultObject resultObj = new OperResultObject(); string token = ""; PlayerInfo player = null; try { player = PlayerController.Instance.GetPlayerInfoByUserLoginName(userLoginName); if (player == null) { resultObj.OperResultCode = OperResult.RESULTCODE_USERNAME_PASSWORD_ERROR; return(resultObj); } token = WebClientManager.GetToken(player.SimpleInfo.UserName); if (!string.IsNullOrEmpty(token)) { WebClientManager.RemoveClient(token); } if (password != player.SimpleInfo.Password) { resultObj.OperResultCode = OperResult.RESULTCODE_USERNAME_PASSWORD_ERROR; return(resultObj); } resultObj = PlayerController.Instance.CheckPlayerIsLocked(player.SimpleInfo.UserID, player.SimpleInfo.UserName); if (resultObj.OperResultCode != OperResult.RESULTCODE_TRUE) { return(resultObj); } token = Guid.NewGuid().ToString(); WebClientManager.AddClient(player.SimpleInfo.UserName, token, clientIP); LogHelper.Instance.AddInfoLog("WEB 玩家登录名 [" + userLoginName + "] 登录矿场, IP=" + clientIP); resultObj.OperResultCode = OperResult.RESULTCODE_TRUE; resultObj.Message = token; return(resultObj); } catch (Exception exc) { LogHelper.Instance.AddErrorLog("WEB 玩家登录名 [" + userLoginName + "] 登录矿场失败, IP=" + clientIP, exc); resultObj.OperResultCode = OperResult.RESULTCODE_EXCEPTION; return(resultObj); } }