Exemplo n.º 1
0
        protected override async void Run(Session session, C2G_LoginGate message, Action <G2C_LoginGate> reply)
        {
            G2C_LoginGate response = new G2C_LoginGate();

            try
            {
                long userId = Game.Scene.GetComponent <NjmjGateSessionKeyComponent>().Get(message.Key);
                if (userId == 0)
                {
                    response.Error   = ErrorCode.ERR_ConnectGateKeyError;
                    response.Message = "Gate key验证失败!";
                    reply(response);
                    return;
                }

                // 检测是否已存在
                UserComponentSystem.CheckIsExistTheUser(userId);

                //创建User对象
                User user = UserFactory.Create(userId, session);
                await user.AddComponent <MailBoxComponent>().AddLocation();

                //添加心跳包
                session.AddComponent <HeartBeatComponent>().CurrentTime = TimeHelper.ClientNowSeconds();
                //添加User对象关联到Session上
                session.AddComponent <SessionUserComponent>().User = user;

                //添加消息转发组件
                session.AddComponent <MailBoxComponent, string>(ActorType.GateSession);

                response.PlayerId = user.Id;
                response.Uid      = userId;

                ConfigComponent  configCom      = Game.Scene.GetComponent <ConfigComponent>();
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                {
                    //商城
                    if (ShopData.getInstance().getDataList().Count == 0)
                    {
                        List <ShopConfig> shopList = new List <ShopConfig>();
                        for (int i = 1; i < configCom.GetAll(typeof(ShopConfig)).Length + 1; ++i)
                        {
                            int        id     = 1000 + i;
                            ShopConfig config = (ShopConfig)configCom.Get(typeof(ShopConfig), id);
                            shopList.Add(config);
                        }
                        ShopData.getInstance().getDataList().AddRange(shopList);
                    }

                    //#region AddShopInfo
                    List <ShopInfo> shopInfoList = new List <ShopInfo>();
                    for (int i = 0; i < ShopData.getInstance().getDataList().Count; ++i)
                    {
                        ShopConfig config = ShopData.getInstance().getDataList()[i];
                        ShopInfo   info   = new ShopInfo();
                        info.Id           = (int)config.Id;
                        info.Name         = config.Name;
                        info.Price        = config.Price;
                        info.ShopType     = config.shopType;
                        info.Desc         = config.Desc;
                        info.CurrencyType = config.CurrencyType;
                        info.Items        = config.Items;
                        info.Icon         = config.Icon;
                        info.VipPrice     = config.VipPrice;
                        shopInfoList.Add(info);
                    }
                    response.ShopInfoList = shopInfoList;
                }
                {
                    //任务
                    if (TaskData.getInstance().getDataList().Count == 0)
                    {
                        List <TaskConfig> taskList = new List <TaskConfig>();
                        for (int i = 1; i < configCom.GetAll(typeof(TaskConfig)).Length + 1; ++i)
                        {
                            int        id     = 100 + i;
                            TaskConfig config = (TaskConfig)configCom.Get(typeof(TaskConfig), id);
                            taskList.Add(config);
                        }
                        TaskData.getInstance().getDataList().AddRange(taskList);
                    }
                }

                {
                    //成就
                    if (ChengjiuData.getInstance().getDataList().Count == 0)
                    {
                        List <ChengjiuConfig> chengjiuList = new List <ChengjiuConfig>();
                        for (int i = 1; i < configCom.GetAll(typeof(ChengjiuConfig)).Length + 1; ++i)
                        {
                            int            id     = 100 + i;
                            ChengjiuConfig config = (ChengjiuConfig)configCom.Get(typeof(ChengjiuConfig), id);
                            chengjiuList.Add(config);
                        }
                        ChengjiuData.getInstance().getDataList().AddRange(chengjiuList);
                    }
                }

                List <UserBag> bagInfoList = await proxyComponent.QueryJson <UserBag>($"{{UId:{userId}}}");

                response.BagList = new List <Bag>();
                List <Bag> bagList = new List <Bag>();
                for (int i = 0; i < bagInfoList.Count; ++i)
                {
                    Bag bag = new Bag();
                    bag.ItemId = bagInfoList[i].BagId;
                    bag.Count  = bagInfoList[i].Count;
                    bagList.Add(bag);
                }
                response.BagList = bagList;

                PlayerBaseInfo playerBaseInfo = await DBCommonUtil.getPlayerBaseInfo(userId);

                // 老用户检测
                {
                    try
                    {
                        AccountInfo accountInfo = await DBCommonUtil.getAccountInfo(userId);

                        if (accountInfo.OldAccountState == 1)
                        {
                            string url = "http://fksq.hy51v.com:10086/CheckIsOldUser?machine_id=" + accountInfo.MachineId + "&game_id=217";
                            string str = HttpUtil.GetHttp(url);
                            Log.Debug("web地址:" + url);
                            Log.Debug("判断是否是老用户:" + str);

                            JObject result  = JObject.Parse(str);
                            string  old_uid = (string)result.GetValue("old_uid");

                            // 不是老用户
                            if (string.IsNullOrEmpty(old_uid))
                            {
                                accountInfo.OldAccountState = 3;
                                await proxyComponent.Save(accountInfo);
                            }
                            // 是老用户
                            else
                            {
                                List <Log_OldUserBind> log_OldUserBinds = await proxyComponent.QueryJson <Log_OldUserBind>($"{{macId:'{accountInfo.MachineId}'}}");

                                if (log_OldUserBinds.Count > 0)
                                {
                                    accountInfo.OldAccountState = 3;
                                    await proxyComponent.Save(accountInfo);
                                }
                                else
                                {
                                    accountInfo.OldAccountState = 2;
                                    await proxyComponent.Save(accountInfo);

                                    // 记录绑定日志
                                    {
                                        Log_OldUserBind log_OldUserBind = ComponentFactory.CreateWithId <Log_OldUserBind>(IdGenerater.GenerateId());
                                        log_OldUserBind.Uid          = userId;
                                        log_OldUserBind.OldUid       = old_uid;
                                        log_OldUserBind.macId        = accountInfo.MachineId;
                                        log_OldUserBind.isSendReward = 1;

                                        await proxyComponent.Save(log_OldUserBind);
                                    }

                                    {
                                        url = ("http://fksq.hy51v.com:10086/GetOldNjmjData?UserId=" + old_uid);
                                        str = HttpUtil.GetHttp(url);

                                        result = JObject.Parse(str);
                                        int moneyAmount  = (int)result.GetValue("moneyAmount");
                                        int gIngotAmount = (int)result.GetValue("gIngotAmount");

                                        Log.Debug("老用户金币=" + moneyAmount + "   元宝=" + gIngotAmount);

                                        playerBaseInfo.GoldNum = moneyAmount;
                                        playerBaseInfo.WingNum = gIngotAmount;
                                        await proxyComponent.Save(playerBaseInfo);

                                        await DBCommonUtil.changeWealthWithStr(userId, "111:10;2:10", "老用户赠送");
                                    }

                                    // 发送老用户广播
                                    Actor_OldUser actor_OldUser = new Actor_OldUser();
                                    actor_OldUser.OldAccount = old_uid;
                                    Game.Scene.GetComponent <UserComponent>().BroadCastToSingle(actor_OldUser, userId);
                                }
                            }
                        }
                        else if (accountInfo.OldAccountState == 2)
                        {
                            List <Log_OldUserBind> log_OldUserBinds = await proxyComponent.QueryJson <Log_OldUserBind>($"{{macId:'{accountInfo.MachineId}'}}");

                            if (log_OldUserBinds.Count > 0)
                            {
                                if (log_OldUserBinds[0].isSendReward != 1)
                                {
                                    log_OldUserBinds[0].isSendReward = 1;
                                    await proxyComponent.Save(log_OldUserBinds[0]);

                                    await DBCommonUtil.SendMail(userId, "更新游戏奖励", "亲爱的玩家,南京麻将最新版本更新了,特意送上更新奖励,请笑纳,祝您游戏愉快!", "111:10;2:10");
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("检测是否是老用户出错:" + ex);
                    }
                }

                #region 用户活动所获得的头像数据
                List <OtherData> otherDatas = await proxyComponent.QueryJson <OtherData>($"{{UId:{userId}}}");

                if (otherDatas.Count > 0)
                {
                    response.ownIcon = otherDatas[0].OwnIcon;
                }
                #endregion

                reply(response);
                session.Send(new G2C_TestHotfixMessage()
                {
                    Info = "recv hotfix message success"
                });

                // vip上线全服广播
                {
                    if (playerBaseInfo.VipTime.CompareTo(CommonUtil.getCurTimeNormalFormat()) > 0)
                    {
                        Actor_LaBa actor_LaBa = new Actor_LaBa();
                        actor_LaBa.LaBaContent = "贵族玩家" + playerBaseInfo.Name + "上线啦!";
                        Game.Scene.GetComponent <UserComponent>().BroadCast(actor_LaBa);
                    }
                }
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
Exemplo n.º 2
0
        //1,刷新所有配置表 2,发送邮件 3,解散房间 4,增减黑名单 5,生成报表 6,查看用户信息 7,强制离线 8,修改用户信息 9,查看游戏内信息
        protected override async void Run(Session session, C2G_GM message, Action <G2C_GM> reply)
        {
            G2C_GM response = new G2C_GM();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                if (Game.Scene.GetComponent <ConfigComponent>() != null)
                {
                    Game.Scene.RemoveComponent <ConfigComponent>();
                }
                Game.Scene.AddComponent <ConfigComponent>();
                ConfigComponent      configCom     = Game.Scene.GetComponent <ConfigComponent>();
                StartConfigComponent _config       = Game.Scene.GetComponent <StartConfigComponent>();
                IPEndPoint           mapIPEndPoint = _config.MapConfigs[0].GetComponent <InnerConfig>().IPEndPoint;
                Session mapSession = Game.Scene.GetComponent <NetInnerComponent>().Get(mapIPEndPoint);

                switch (message.Type)
                {
                case 1:
                {
                    //刷新所有配置表
                    List <PlayerBaseInfo> allInfos = await proxyComponent.QueryJsonDBInfos <PlayerBaseInfo>();

                    {
                        //商城
                        List <ShopConfig> shopList = new List <ShopConfig>();
                        for (int i = 1; i < configCom.GetAll(typeof(ShopConfig)).Length + 1; ++i)
                        {
                            int        id     = 1000 + i;
                            ShopConfig config = (ShopConfig)configCom.Get(typeof(ShopConfig), id);
                            shopList.Add(config);
                        }
                        ShopData.getInstance().getDataList().Clear();
                        ShopData.getInstance().getDataList().AddRange(shopList);
                    }
                    {
                        //任务
                        List <TaskConfig> taskList = new List <TaskConfig>();
                        for (int i = 1; i < configCom.GetAll(typeof(TaskConfig)).Length + 1; ++i)
                        {
                            int        id     = 100 + i;
                            TaskConfig config = (TaskConfig)configCom.Get(typeof(TaskConfig), id);
                            taskList.Add(config);
                        }
                        TaskData.getInstance().getDataList().Clear();
                        TaskData.getInstance().getDataList().AddRange(taskList);
                        for (int i = 0; i < allInfos.Count; ++i)
                        {
                            List <TaskProgressInfo> taskInfos = await proxyComponent.QueryJson <TaskProgressInfo>($"{{UId:{allInfos[i].Id}}}");

                            //无论删减任务 都要刷新一下任务的数据库
                            for (int j = 0; j < taskInfos.Count; ++j)
                            {
                                TaskConfig config = TaskData.getInstance().GetDataByTaskId(taskInfos[j].TaskId);
                                if (config != null)
                                {
                                    taskInfos[j].Name   = config.Name;
                                    taskInfos[j].Target = config.Target;
                                    taskInfos[j].Reward = config.Reward;
                                    taskInfos[j].Desc   = config.Desc;
                                    await proxyComponent.Save(taskInfos[j]);
                                }
                            }

                            #region 增加任务先不管 update时会重新添加
                            //if (TaskData.getInstance().getDataList().Count > taskInfos.Count)
                            //{
                            //    //增加了新任务
                            //    for (int j = 0; j < TaskData.getInstance().getDataList().Count; ++j)
                            //    {
                            //        List<TaskProgressInfo> progresses = await proxyComponent.QueryJson<TaskProgressInfo>($"{{UId:{allInfos[i].Id},TaskId:{TaskData.getInstance().getDataList()[j].Id}}}");
                            //        if (progresses.Count <= 0)
                            //        {
                            //            TaskProgressInfo progress =
                            //          ComponentFactory.CreateWithId<TaskProgressInfo>(IdGenerater.GenerateId());
                            //            progress.IsGet = false;
                            //            progress.UId = allInfos[i].Id;
                            //            progress.Name = TaskData.getInstance().getDataList()[j].Name;
                            //            progress.TaskId = (int)TaskData.getInstance().getDataList()[j].Id;
                            //            progress.IsComplete = false;
                            //            progress.Target = TaskData.getInstance().getDataList()[j].Target;
                            //            progress.Reward = TaskData.getInstance().getDataList()[j].Reward;
                            //            progress.Desc = TaskData.getInstance().getDataList()[j].Desc;
                            //            progress.CurProgress = 0;

                            //            await proxyComponent.Save(progress);
                            //        }
                            //    }
                            //}
                            #endregion

                            if (TaskData.getInstance().getDataList().Count < taskInfos.Count)
                            {
                                for (int j = 0; j < taskInfos.Count; ++j)
                                {
                                    TaskConfig config = TaskData.getInstance().GetDataByTaskId(taskInfos[j].TaskId);
                                    List <TaskProgressInfo> progresses = await proxyComponent.QueryJson <TaskProgressInfo>($"{{UId:{allInfos[i].Id},TaskId:{taskInfos[j].TaskId}}}");

                                    if (config == null)
                                    {
                                        if (progresses.Count > 0)
                                        {
                                            //删除该任务
                                            await proxyComponent.Delete <TaskProgressInfo>(progresses[0].Id);
                                        }
                                    }
                                }
                            }
                        }
                        {
                            //成就
                            List <ChengjiuConfig> chengjiuList = new List <ChengjiuConfig>();
                            for (int i = 1; i < configCom.GetAll(typeof(ChengjiuConfig)).Length + 1; ++i)
                            {
                                int            id     = 100 + i;
                                ChengjiuConfig config = (ChengjiuConfig)configCom.Get(typeof(ChengjiuConfig), id);
                                chengjiuList.Add(config);
                            }
                            ChengjiuData.getInstance().getDataList().Clear();
                            ChengjiuData.getInstance().getDataList().AddRange(chengjiuList);
                            for (int i = 0; i < allInfos.Count; ++i)
                            {
                                List <ChengjiuInfo> chengjiuInfos = await proxyComponent.QueryJson <ChengjiuInfo>($"{{UId:{allInfos[i].Id}}}");

                                //无论删减任务 都要刷新一下任务的数据库
                                for (int j = 0; j < chengjiuInfos.Count; ++j)
                                {
                                    ChengjiuConfig config = ChengjiuData.getInstance().GetDataByChengjiuId(chengjiuInfos[j].TaskId);
                                    if (config != null)
                                    {
                                        chengjiuInfos[j].Name   = config.Name;
                                        chengjiuInfos[j].Target = config.Target;
                                        chengjiuInfos[j].Reward = config.Reward;
                                        chengjiuInfos[j].Desc   = config.Desc;
                                        await proxyComponent.Save(chengjiuInfos[j]);
                                    }
                                }

                                #region 增加(暂时先不管 Update时会新加)
                                //if (ChengjiuData.getInstance().getDataList().Count > chengjiuInfos.Count)
                                //{
                                //    //增加了新成就
                                //    for (int j = chengjiuInfos.Count; j < ChengjiuData.getInstance().getDataList().Count; ++j)
                                //    {
                                //        List<ChengjiuInfo> progresses = await proxyComponent.QueryJson<ChengjiuInfo>($"{{UId:{allInfos[i].Id},TaskId:{ChengjiuData.getInstance().getDataList()[j].Id}}}");
                                //        if (progresses.Count <= 0)
                                //        {
                                //            Log.Debug("增加新成就");
                                //            ChengjiuInfo progress =
                                //          ComponentFactory.CreateWithId<ChengjiuInfo>(IdGenerater.GenerateId());
                                //            progress.IsGet = false;
                                //            progress.UId = allInfos[i].Id;
                                //            progress.Name = ChengjiuData.getInstance().getDataList()[j].Name;
                                //            progress.TaskId = (int)ChengjiuData.getInstance().getDataList()[j].Id;
                                //            progress.IsComplete = false;
                                //            progress.Target = ChengjiuData.getInstance().getDataList()[j].Target;
                                //            progress.Reward = ChengjiuData.getInstance().getDataList()[j].Reward;
                                //            progress.Desc = ChengjiuData.getInstance().getDataList()[j].Desc;
                                //            progress.CurProgress = 0;

                                //            await proxyComponent.Save(progress);
                                //        }
                                //    }
                                //}
                                #endregion

                                if (ChengjiuData.getInstance().getDataList().Count < chengjiuInfos.Count)
                                {
                                    for (int j = 0; j < chengjiuInfos.Count; ++j)
                                    {
                                        ChengjiuConfig      config     = ChengjiuData.getInstance().GetDataByChengjiuId(chengjiuInfos[j].TaskId);
                                        List <ChengjiuInfo> progresses = await proxyComponent.QueryJson <ChengjiuInfo>($"{{UId:{allInfos[i].Id},TaskId:{chengjiuInfos[j].TaskId}}}");

                                        if (config == null)
                                        {
                                            if (progresses.Count > 0)
                                            {
                                                //删除该成就
                                                await proxyComponent.Delete <ChengjiuInfo>(progresses[0].Id);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;

                case 2:
                {
                    //发送邮件 uid为空则为给全部玩家发送邮件
                    if (message.UId != -1)
                    {
                        Log.Debug("Mail" + message.UId + message.Title + message.Content + message.Reward);
                        await DBCommonUtil.SendMail(message.UId, message.Title, message.Content, message.Reward);
                    }
                    else
                    {
                        //分批发还是全部一次性发
                        List <PlayerBaseInfo> playerBaseInfos = await proxyComponent.QueryJsonDBInfos <PlayerBaseInfo>();

                        if (playerBaseInfos.Count > 0)
                        {
                            for (int i = 0; i < playerBaseInfos.Count; ++i)
                            {
                                await DBCommonUtil.SendMail(playerBaseInfos[i].Id, message.Title, message.Content, message.Reward);
                            }
                        }
                    }
                }
                break;

                case 3:
                {
                    //解散房间

                    M2G_GMInfo m2G_GMInfo = (M2G_GMInfo)await mapSession.Call(new G2M_GMInfo()
                        {
                            Type = 3, Uid = message.UId
                        });

                    response.Error   = m2G_GMInfo.Error;
                    response.Message = m2G_GMInfo.Message;
                }
                break;

                case 4:
                {
                    //增减黑名单(根据玩家IP)
                    List <BlackList> blackList = await proxyComponent.QueryJson <BlackList>($"{{ip:'{message.IP}'}}");

                    if (string.IsNullOrEmpty(message.EndTime))
                    {
                        //删除黑名单
                        if (blackList.Count > 0)
                        {
                            blackList[0].EndTime = "2000-01-01 00:00:00";
                            await proxyComponent.Save(blackList[0]);
                        }
                    }
                    else
                    {
                        if (blackList.Count > 0)
                        {
                            blackList[0].EndTime = message.EndTime;
                            await proxyComponent.Save(blackList[0]);
                        }
                        else
                        {
                            BlackList list = ComponentFactory.CreateWithId <BlackList>(IdGenerater.GenerateId());
                            list.Uid     = message.UId;
                            list.ip      = message.IP;
                            list.EndTime = message.EndTime;
                            list.Reason  = message.Reason;
                            await proxyComponent.Save(list);
                        }
                    }
                }
                break;

                case 5:
                {
                    //生成报表
                    string logData = await DataStatistics.Start(message.CreateBaobiaoTime, message.Content);

                    response.LogData = logData;
                }
                break;

                case 6:
                    //查看用户信息
                    List <PlayerBaseInfo> infos       = new List <PlayerBaseInfo>();
                    AccountInfo           accountInfo = null;
                    List <Log_Login>      logLogins   = new List <Log_Login>();
                    if (message.UId != 0)
                    {
                        infos = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{_id:{message.UId}}}");

                        accountInfo = await DBCommonUtil.getAccountInfo(message.UId);

                        logLogins = await proxyComponent.QueryJson <Log_Login>($"{{Uid:{message.UId}}}");
                    }
                    else if (!string.IsNullOrEmpty(message.Name))
                    {
                        infos = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{Name:'{message.Name}'}}");

                        if (infos.Count > 0)
                        {
                            accountInfo = await DBCommonUtil.getAccountInfo(infos[0].Id);

                            logLogins = await proxyComponent.QueryJson <Log_Login>($"{{Uid:{infos[0].Id}}}");
                        }
                    }

                    if (infos.Count > 0)
                    {
                        PlayerInfo info = new PlayerInfo();
                        info.Name           = infos[0].Name;
                        info.GoldNum        = infos[0].GoldNum;
                        info.WingNum        = infos[0].WingNum;
                        info.HuaFeiNum      = infos[0].HuaFeiNum;
                        info.IsRealName     = infos[0].IsRealName;
                        info.VipTime        = infos[0].VipTime;
                        info.EmogiTime      = infos[0].EmogiTime;
                        info.MaxHua         = infos[0].MaxHua;
                        info.TotalGameCount = infos[0].TotalGameCount;
                        info.WinGameCount   = infos[0].WinGameCount;
                        response.UId        = infos[0].Id;
                        M2G_GMInfo m2G_GMInfo = (M2G_GMInfo)await mapSession.Call(new G2M_GMInfo()
                        {
                            Type = 6, Uid = message.UId
                        });

                        Log.Debug(m2G_GMInfo.Type + "");
                        response.IsInGame = m2G_GMInfo.Type;
                        if (logLogins.Count > 0)
                        {
                            response.LastOnlineTime = logLogins[logLogins.Count - 1].CreateTime;
                        }
                        if (accountInfo != null)
                        {
                            info.Phone            = accountInfo.Phone;
                            response.RegisterTime = accountInfo.CreateTime;
                            response.Channel      = accountInfo.ChannelName;
                        }
                        response.Info = info;
                        response.Ip   = logLogins[logLogins.Count - 1].ip;
                    }
                    else
                    {
                        response.Message = "不存在该用户信息";
                        response.Error   = ErrorCode.ERR_Exception;
                        response.Info    = null;
                    }
                    break;

                case 7:
                {
                    //强制玩家离线
                    UserComponentSystem.ForceOffline(message.UId, message.Reason);
                }
                break;

                case 8:
                {
                    //更改用户信息
                    if (message.UId == -1)
                    {
                        List <PlayerBaseInfo> playerBaseInfos = await proxyComponent.QueryJsonDBInfos <PlayerBaseInfo>();

                        if (playerBaseInfos.Count > 0)
                        {
                            for (int i = 0; i < playerBaseInfos.Count; ++i)
                            {
                                if (!message.Icon.Equals("0"))
                                {
                                    playerBaseInfos[0].Icon = message.Icon;
                                    await proxyComponent.Save(playerBaseInfos[0]);
                                }
                                if (message.RestChangeNameCount != 0)
                                {
                                    playerBaseInfos[0].RestChangeNameCount = message.RestChangeNameCount;
                                    await proxyComponent.Save(playerBaseInfos[0]);
                                }
                                if (!message.Prop.Equals("0"))
                                {
                                    await DBCommonUtil.changeWealthWithStr(playerBaseInfos[i].Id, message.Prop, "GM中增加玩家道具");
                                }
                            }
                        }
                    }
                    else
                    {
                        List <PlayerBaseInfo> playerInfos = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{_id:{message.UId}}}");

                        if (playerInfos.Count > 0)
                        {
                            if (!message.Icon.Equals("0"))
                            {
                                playerInfos[0].Icon = message.Icon;
                                await proxyComponent.Save(playerInfos[0]);
                            }
                            if (message.RestChangeNameCount != 0)
                            {
                                playerInfos[0].RestChangeNameCount = message.RestChangeNameCount;
                                await proxyComponent.Save(playerInfos[0]);
                            }
                            if (!message.Prop.Equals("0"))
                            {
                                await DBCommonUtil.changeWealthWithStr(message.UId, message.Prop, "GM中增加玩家道具");
                            }
                        }
                        else
                        {
                            response.Error   = ErrorCode.ERR_Exception;
                            response.Message = "用户不存在,请检查UID是否正确";
                        }
                    }
                }
                break;

                case 9:
                {
                    //查看游戏内信息
                    M2G_GetRoomInfo getRoomInfo = (M2G_GetRoomInfo)await mapSession.Call(new G2M_GetRoomInfo());

                    response.Room = new RoomInfo();
                    response.Room.NewRoomCount = getRoomInfo.NewRoomCount;
                    response.Room.NewTotalPlayerInGameCount  = getRoomInfo.NewTotalPlayerInGameCount;
                    response.Room.JingRoomCount              = getRoomInfo.JingRoomCount;
                    response.Room.JingTotalPlayerInGameCount = getRoomInfo.JingTotalPlayerInGameCount;
                }
                break;

                case 10:
                {
                    // 发送通知
                    UserComponentSystem.EmergencyNotice(message.UId, message.Content);
                }
                break;

                case 11:
                {
                    //session
                    int count = Game.Scene.GetComponent <NetOuterComponent>().sessions.Count;
                    response.Channel = count.ToString();
                }
                break;

                case 12:
                {
                    //改变玩家好友房钥匙
                    long   uid     = message.UId;                   // -1代表给所有人发
                    int    num     = message.RestChangeNameCount;
                    string endTime = message.EndTime;               // 如果是删除钥匙,此参数可以为空
                    string reason  = message.Reason;

                    if (uid != -1)
                    {
                        if (num > 0)
                        {
                            await DBCommonUtil.AddFriendKey(uid, num, endTime, reason);
                        }
                        else if (num < 0)
                        {
                            await DBCommonUtil.DeleteFriendKey(uid, -num, reason);
                        }
                    }
                    else
                    {
                        List <AccountInfo> listData = await proxyComponent.QueryJsonDBInfos <AccountInfo>();

                        for (int i = 0; i < listData.Count; i++)
                        {
                            if (num > 0)
                            {
                                await DBCommonUtil.AddFriendKey(listData[i].Id, num, endTime, reason);
                            }
                            else if (num < 0)
                            {
                                await DBCommonUtil.DeleteFriendKey(listData[i].Id, -num, reason);
                            }
                        }
                    }
                }
                break;
                }
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }