public override async Task ExecuteAsync()
        {
            //获取要执行操作的数据库collection
            var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

            var collection = dataBase.GetCollection <GameServerDBarrierRecord>(SampleGameServerDBItemDefine.COLLECTION_BARRIERRECORD);//获取Players集合

            await collection.InsertOneAsync(m_data);



            Log.Info("插入战绩成功");
            return;
        }
        public override Task ExecuteAsync()
        {
            var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

            var collection = dataBase.GetCollection <GameServerDBarrierRecord>(SampleGameServerDBItemDefine.COLLECTION_BARRIERRECORD);//获取Players集合

            var datas = collection.Find(new BsonDocument()).ToList();

            foreach (var item in datas)
            {
                Log.Info(item.Tojson());
            }

            return(base.ExecuteAsync());
        }
        public override async Task ExecuteAsync()
        {
            try
            {
                //获取要执行操作的数据库collection
                var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

                var collection = dataBase.GetCollection <GameServerDBPlayer>(SampleGameServerDBItemDefine.COLLECTION_PLAYERS);//获取Players集合

                var filterBuilder = Builders <GameServerDBPlayer> .Filter;

                var filter = filterBuilder.Eq(SampleGameServerDBItemDefine.PLAYER_USERNAME, m_username);// & filterBuilder.Eq("password", m_password);


                var result = (await(collection.FindAsync(filter))).ToList();

                if (result != null && result.Count > 0)
                {
                    m_state      = false;
                    m_errorInfo += "已经存在用户了\n";
                }
                else
                {
                    var player = new GameServerDBPlayer();

                    player.userName = m_username;

                    player.passWord = m_password;

                    player.createTime = DateTime.UtcNow;

                    player.playerShip = new GameServerDBPlayerShip();

                    await collection.InsertOneAsync(player);//插入

                    m_errorInfo += "插入成功\n";
                    m_state      = true;
                }
            } catch (Exception e)
            {
                m_errorInfo += e.ToString();
                m_state      = false;
            }
            finally
            {
                Log.Info(m_errorInfo);
            }
        }
        /// <summary>
        /// 数据库验证登陆信息的有效性
        /// 目前通过昵称和密码进行登陆
        /// </summary>
        /// <param name="account"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        private async Task <bool> ValidateAuthLogin(string account, string password)
        {
            //获取要执行操作的数据库collection
            var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

            var collection = dataBase.GetCollection <GameServerDBPlayer>(SampleGameServerDBItemDefine.COLLECTION_PLAYERS);//获取Players集合

            var filterBuilder = Builders <GameServerDBPlayer> .Filter;

            var filter = filterBuilder.Eq(SampleGameServerDBItemDefine.PLAYER_USERNAME, account) & filterBuilder.Eq(SampleGameServerDBItemDefine.PLAYER_PASSWORD, password);

            var result = (await(collection.FindAsync(filter))).ToList();

            if (result != null && result.Count > 0)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// 根据昵称获取数据库player的实体
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        private async Task <GameServerDBPlayer> GetPlayerFromDBAsync(string account)
        {
            //获取要执行操作的数据库collection
            var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

            var collection = dataBase.GetCollection <GameServerDBPlayer>(SampleGameServerDBItemDefine.COLLECTION_PLAYERS);//获取Players集合

            var filterBuilder = Builders <GameServerDBPlayer> .Filter;

            var filter = filterBuilder.Eq(SampleGameServerDBItemDefine.PLAYER_USERNAME, account);

            var result = (await(collection.FindAsync(filter))).ToList();

            if (result != null && result.Count > 0)
            {
                return(result[0]);
            }

            return(null);
        }
        private async Task <bool> UpdatePlayerShipInfo(GameServerDBPlayerShip shipInfo)
        {
            //获取要执行操作的数据库collection
            var dataBase = MongoDBHelper.GetDataBaseEntity(SampleGameServerDBItemDefine.DATABASE);

            var collection = dataBase.GetCollection <GameServerDBPlayer>(SampleGameServerDBItemDefine.COLLECTION_PLAYERS);//获取Players集合

            var filterBuilder = Builders <GameServerDBPlayer> .Filter;

            var filter = filterBuilder.Eq(SampleGameServerDBItemDefine.PLAYER_USERNAME, m_gameUserId);

            shipInfo.modifyTime = DateTime.Now;//获取当前时间

            var update = Builders <GameServerDBPlayer> .Update.Set(SampleGameServerDBItemDefine.PLAYER_SHIPINFO, shipInfo);

            var result = await collection.UpdateOneAsync(filter, update);

            if (result.ModifiedCount > 0)
            {
                return(true);
            }

            return(true);
        }