예제 #1
0
        protected override async void Run(Session session, C2G_PlayerInfo message, Action <G2C_PlayerInfo> reply)
        {
//            Log.Info(JsonHelper.ToJson(message));
            G2C_PlayerInfo response = new G2C_PlayerInfo();

            try
            {
                User user = session.GetComponent <SessionUserComponent>()?.User;

                if (user == null)
                {
                    response.Error = ErrorCode.ERR_Common;
                    reply(response);
                    session.Dispose();
                    return;
                }
                DBProxyComponent      proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                List <PlayerBaseInfo> playerInfo     = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{_id:{user.UserID}}}");

                List <OtherData> otherDatas = await proxyComponent.QueryJson <OtherData>($"{{UId:{user.UserID}}}");

                response.PlayerInfo = new PlayerInfo();
                int fKeyCount = await DBCommonUtil.GetUserFriendKeyNum(user.UserID);

                if (playerInfo != null)
                {
                    response.Message               = "数据库里已存在玩家的基本信息,返回玩家信息";
                    response.PlayerInfo.Name       = playerInfo[0].Name;
                    response.PlayerInfo.GoldNum    = playerInfo[0].GoldNum;
                    response.PlayerInfo.WingNum    = playerInfo[0].WingNum;
                    response.PlayerInfo.HuaFeiNum  = playerInfo[0].HuaFeiNum;
                    response.PlayerInfo.Icon       = playerInfo[0].Icon;
                    response.PlayerInfo.IsRealName = playerInfo[0].IsRealName;
                    AccountInfo accountInfo = await DBCommonUtil.getAccountInfo(user.UserID);

                    response.PlayerInfo.Phone               = accountInfo.Phone;
                    response.PlayerInfo.PlayerSound         = playerInfo[0].PlayerSound;
                    response.PlayerInfo.RestChangeNameCount = playerInfo[0].RestChangeNameCount;
                    response.PlayerInfo.VipTime             = playerInfo[0].VipTime;
                    response.PlayerInfo.EmogiTime           = playerInfo[0].EmogiTime;
                    response.PlayerInfo.MaxHua              = playerInfo[0].MaxHua;
                    response.PlayerInfo.WinGameCount        = playerInfo[0].WinGameCount;
                    response.PlayerInfo.IsGiveFriendKey     = playerInfo[0].IsGiveFriendKey;
                    response.PlayerInfo.FriendKeyCount      = fKeyCount;
                    response.PlayerInfo.Score               = playerInfo[0].Score;
                    List <ChengjiuInfo> infos =
                        await proxyComponent.QueryJson <ChengjiuInfo>($"{{UId:{user.UserID},TaskId:{102}}}");

                    if (infos.Count > 0)
                    {
                        response.PlayerInfo.TotalGameCount = infos[0].CurProgress;
                    }
                    if (otherDatas.Count > 0)
                    {
                        response.OwnIcon = otherDatas[0].OwnIcon;
                    }

                    // 今天是否签到过
                    {
                        List <DailySign> dailySigns = await proxyComponent.QueryJson <DailySign>($"{{CreateTime:/^{DateTime.Now.GetCurrentDay()}/,Uid:{user.UserID}}}");

                        if (dailySigns.Count == 0)
                        {
                            response.PlayerInfo.IsSign = false;
                        }
                        else
                        {
                            response.PlayerInfo.IsSign = true;
                        }
                    }

                    {
                        //端午节活动是否结束
//                        List<DuanwuDataBase> duanwuDataBases = await proxyComponent.QueryJson<DuanwuDataBase>($"{{UId:{user.UserID}}}");
//                        string curTime = CommonUtil.getCurTimeNormalFormat();
//                        if (string.CompareOrdinal(curTime, duanwuDataBases[0].EndTime) >= 0)
//                        {
//                            long goldNum = 0;
//                            if (duanwuDataBases[0].ZongziCount > 0)
//                            {
//                                goldNum = duanwuDataBases[0].ZongziCount * 100;
//                                duanwuDataBases[0].ZongziCount = 0;
//                                //添加邮件
//                                await DBCommonUtil.SendMail(user.UserID, "端午粽香", $"端午活动已结束,剩余粽子已转换为金币存入您的账号,兑换比例:一个粽子=100金币,您获得{goldNum}金币", $"1:{goldNum}");
//                                await proxyComponent.Save(duanwuDataBases[0]);
//                            }
//                        }
                    }

                    reply(response);
                    return;
                }

                response.Message    = "Account数据库里不存在该用户";
                response.PlayerInfo = null;
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #2
0
        protected override async void Run(Session session, C2R_PhoneLogin message, Action <R2C_PhoneLogin> reply)
        {
            Log.Info(JsonHelper.ToJson(message));
            R2C_PhoneLogin response = new R2C_PhoneLogin();

            try
            {
                DBProxyComponent   proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                List <AccountInfo> accountInfos   = await proxyComponent.QueryJson <AccountInfo>($"{{Phone:'{message.Phone}'}}");

                // 用验证码登录
                if (message.Code.CompareTo("") != 0)
                {
                    // 先校验验证码
                    {
                        string str = HttpUtil.CheckSms("0", message.Phone, message.Code);
                        if (!CommonUtil.checkSmsCode(str))
                        {
                            response.Message = "验证码错误";
                            response.Error   = ErrorCode.ERR_PhoneCodeError;
                            reply(response);
                            return;
                        }
                    }
                    // 用户已存在,走登录流程
                    if (accountInfos.Count > 0)
                    {
                        AccountInfo accountInfo = accountInfos[0];

                        // 黑名单检测
                        if (await DBCommonUtil.CheckIsInBlackList(accountInfo.Id, session))
                        {
                            response.Message = "您的账号存在异常,请联系客服处理。";
                            response.Error   = ErrorCode.ERR_PhoneCodeError;
                            reply(response);
                            return;
                        }

                        // 更新Token
                        accountInfo.Token = CommonUtil.getToken(message.Phone);
                        await proxyComponent.Save(accountInfo);

                        // 随机分配一个Gate
                        StartConfig config       = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                        IPEndPoint  innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                        Session     gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                        // 向gate请求一个key,客户端可以拿着这个key连接gate
                        G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                        {
                            UserId = accountInfo.Id
                        });

                        string outerAddress = config.GetComponent <OuterConfig>().IPEndPoint2.ToString();

                        response.Address = outerAddress;
                        response.Key     = g2RGetLoginKey.Key;
                        response.Token   = accountInfo.Token;
                        reply(response);
                        // 登录日志
                        await DBCommonUtil.Log_Login(accountInfo.Id, session, message.ClientVersion);
                    }
                    // 用户不存在,走注册流程
                    else
                    {
                        AccountInfo accountInfo = ComponentFactory.CreateWithId <AccountInfo>(UidUtil.createUID());
                        accountInfo.Phone         = message.Phone;
                        accountInfo.Token         = CommonUtil.getToken(message.Phone);
                        accountInfo.MachineId     = message.MachineId;
                        accountInfo.ChannelName   = message.ChannelName;
                        accountInfo.ClientVersion = message.ClientVersion;

                        await proxyComponent.Save(accountInfo);

                        // 添加用户信息
                        PlayerBaseInfo playerBaseInfo = await DBCommonUtil.addPlayerBaseInfo(accountInfo.Id, accountInfo.Phone, "", "");

                        // 随机分配一个Gate
                        StartConfig config       = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                        IPEndPoint  innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                        Session     gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                        // 向gate请求一个key,客户端可以拿着这个key连接gate
                        G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                        {
                            UserId = accountInfo.Id
                        });

                        string outerAddress = config.GetComponent <OuterConfig>().IPEndPoint2.ToString();

                        response.Address = outerAddress;
                        response.Key     = g2RGetLoginKey.Key;
                        response.Token   = accountInfo.Token;
                        reply(response);
                        // 登录日志
                        await DBCommonUtil.Log_Login(accountInfo.Id, session, message.ClientVersion);
                    }
                }
                // 用Token登录
                else if (message.Token.CompareTo("") != 0)
                {
                    if (accountInfos.Count > 0)
                    {
                        AccountInfo accountInfo = accountInfos[0];

                        // 黑名单检测
                        if (await DBCommonUtil.CheckIsInBlackList(accountInfo.Id, session))
                        {
                            response.Message = "您的账号存在异常,请联系客服处理。";
                            response.Error   = ErrorCode.ERR_PhoneCodeError;
                            reply(response);
                            return;
                        }

                        if (accountInfo?.Token?.CompareTo(message.Token) == 0)
                        {
                            // 随机分配一个Gate
                            StartConfig config       = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                            IPEndPoint  innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                            Session     gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                            // 向gate请求一个key,客户端可以拿着这个key连接gate
                            G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                            {
                                UserId = accountInfo.Id
                            });

                            string outerAddress = config.GetComponent <OuterConfig>().IPEndPoint2.ToString();

                            response.Address = outerAddress;
                            response.Key     = g2RGetLoginKey.Key;
                            response.Token   = accountInfo.Token;
                            reply(response);

                            // 登录日志
                            await DBCommonUtil.Log_Login(accountInfo.Id, session, message.ClientVersion);
                        }
                        else
                        {
                            response.Message = "Token失效,请重新验证登录";
                            response.Error   = ErrorCode.ERR_TokenError;
                            reply(response);
                            return;
                        }
                    }
                    else
                    {
                        response.Message = "用户不存在";
                        response.Error   = ErrorCode.ERR_AccountNoExist;
                        reply(response);
                        return;
                    }
                }
                // 传的数据错误
                else
                {
                    response.Message = "请求参数缺失";
                    response.Error   = ErrorCode.ERR_ParamError;
                    reply(response);
                    return;
                }
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
            session.Dispose();
        }
        protected override async void Run(Session session, C2R_ThirdLogin message, Action <R2C_ThirdLogin> reply)
        {
            Log.Info("收到第三方登录");

            R2C_ThirdLogin response = new R2C_ThirdLogin();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                bool any = (await proxyComponent.Query <AccountInfo>(a => a.Third_Id == message.Third_Id && a.Token == "")).Any();

                List <AccountInfo> accountInfos = await proxyComponent.QueryJson <AccountInfo>($"{{Third_Id:'{message.Third_Id}'}}");

                // 用户已存在,走登录流程
                if (accountInfos.Count > 0)
                {
                    AccountInfo accountInfo = accountInfos[0];
                    // 黑名单检测
                    if (await DBCommonUtil.CheckIsInBlackList(accountInfo.Id, session))
                    {
                        response.Message = "您的账号存在异常,请联系客服处理。";
                        response.Error   = ErrorCode.ERR_PhoneCodeError;
                        reply(response);
                        return;
                    }
                    // 随机分配一个Gate
                    StartConfig config       = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                    IPEndPoint  innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                    Session     gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                    // 向gate请求一个key,客户端可以拿着这个key连接gate
                    G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                    {
                        UserId = accountInfo.Id
                    });

                    string outerAddress = config.GetComponent <OuterConfig>().IPEndPoint2.ToString();

//                    Log.Warning("Gate的ip:" + outerAddress);

                    response.Address = outerAddress;
                    response.Key     = g2RGetLoginKey.Key;
                    reply(response);

                    // 登录日志
                    await DBCommonUtil.Log_Login(accountInfo.Id, session, message.ClientVersion);
                }
                // 用户不存在,走注册流程
                else
                {
                    AccountInfo accountInfo = ComponentFactory.CreateWithId <AccountInfo>(UidUtil.createUID());
                    accountInfo.Third_Id      = message.Third_Id;
                    accountInfo.MachineId     = message.MachineId;
                    accountInfo.ChannelName   = message.ChannelName;
                    accountInfo.ClientVersion = message.ClientVersion;

                    await proxyComponent.Save(accountInfo);

                    // 添加用户信息
                    PlayerBaseInfo playerBaseInfo = await DBCommonUtil.addPlayerBaseInfo(accountInfo.Id, "", message.Name, message.Head);

                    // 随机分配一个Gate
                    StartConfig config       = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                    IPEndPoint  innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                    Session     gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                    // 向gate请求一个key,客户端可以拿着这个key连接gate
                    G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                    {
                        UserId = accountInfo.Id
                    });

                    string outerAddress = config.GetComponent <OuterConfig>().IPEndPoint2.ToString();

                    response.Address = outerAddress;
                    response.Key     = g2RGetLoginKey.Key;
                    reply(response);

                    // 登录日志
                    await DBCommonUtil.Log_Login(accountInfo.Id, session, message.ClientVersion);
                }
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
            session.Dispose();
        }
예제 #4
0
        private async ETVoid RunAsync(Session session, C2R_RegisterAndLogin message, Action <R2C_RegisterAndLogin> reply)
        {
            Console.WriteLine(" --> C2R_RegisterAndLoginHandler");

            R2C_RegisterAndLogin response = new R2C_RegisterAndLogin();

            try
            {
                Console.WriteLine("account : " + message.Account + " password : "******"dbProxy : " + dbProxy);

                    //查询账号是否存在  使用LINQ和Lambda表达式根据特定条件来查询
                    List <ComponentWithId> result = await dbProxy.Query <AccountInfo>(_account => _account.Account == message.Account);

                    Console.WriteLine("result : " + result);

                    if (result.Count > 0)
                    {
                        Console.WriteLine("result.Count : " + result.Count);

                        response.Error = ErrorCode.ERR_AccountAlreadyRegister;
                        reply(response);
                        return;
                    }
                    Console.WriteLine("新建账号 : ");

                    //新建账号
                    AccountInfo newAccount = ComponentFactory.CreateWithId <AccountInfo>(IdGenerater.GenerateId());
                    newAccount.Account  = message.Account;
                    newAccount.Password = message.Password;

                    Log.Info($"注册新账号:{MongoHelper.ToJson(newAccount)}");

                    //新建用户信息
                    UserInfo newUser = ComponentFactory.CreateWithId <UserInfo>(newAccount.Id);
                    newUser.Nickname = $"用户{message.Account}";
                    newUser.Gold     = 10000;

                    //保存到数据库
                    await dbProxy.Save(newAccount);

                    await dbProxy.Save(newUser);

                    //释放数据库连接
                    dbProxy.Dispose();
                }

                // 随机分配一个Gate
                StartConfig config = Game.Scene.GetComponent <RealmGateAddressComponent>().GetAddress();
                //Log.Debug($"gate address: {MongoHelper.ToJson(config)}");
                IPEndPoint innerAddress = config.GetComponent <InnerConfig>().IPEndPoint;
                Session    gateSession  = Game.Scene.GetComponent <NetInnerComponent>().Get(innerAddress);

                // 向gate请求一个key,客户端可以拿着这个key连接gate
                G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await gateSession.Call(new R2G_GetLoginKey()
                {
                    Account = message.Account
                });

                string outerAddress = config.GetComponent <OuterConfig>().Address2;

                response.Address = outerAddress;
                response.Key     = g2RGetLoginKey.Key;
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #5
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);
            }
        }
예제 #6
0
        protected override async void Run(Session session, C2G_UpdateAccountInfo message, Action <G2C_UpdateAccountInfo> reply)
        {
            G2C_UpdateAccountInfo response    = new G2C_UpdateAccountInfo();
            AccountInfo           accountInfo = null;

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                var acounts = await dBProxyComponent.Query <AccountInfo>("{ '_AccountID': " + message.AccountID + "}");

                if (acounts.Count <= 0)
                {
                    //修改的时候查询不到说明数据库有问题
                    //AccountInfo Info = ComponentFactory.Create<AccountInfo>();
                    //Info._AccountID = message.AccountID;
                    //Info._Name = message.Name;
                    //Info._BornDate = message.BornDate;
                    //Info._IDCardNumber = message.IDCardNumber;
                    //Info._Sex = message.Sex;
                    //Info._IsFinishIdentify = message.IsFinishIdentify;
                    //Info._HeadImage = message.HeadImage;
                    //Info._FingerprintCode = message.FingerprintCode;
                    //Info._UserImpotentLevel = message.UserImpotentLevel;

                    //await dBProxyComponent.Save(Info);
                    //await dBProxyComponent.SaveLog(Info);
                }
                else
                {
                    accountInfo = acounts[0] as AccountInfo;

                    if (message.Name != "")
                    {
                        accountInfo._Name = message.Name;
                    }
                    if (message.BornDate != "")
                    {
                        accountInfo._BornDate = message.BornDate;
                    }
                    if (message.IDCardNumber != "")
                    {
                        accountInfo._IDCardNumber = message.IDCardNumber;
                    }
                    if (message.Sex != -1)
                    {
                        accountInfo._Sex = message.Sex;
                    }
                    if (message.IsFinishIdentify != -1)
                    {
                        accountInfo._IsFinishIdentify = message.IsFinishIdentify;
                    }
                    if (message.HeadImage != "")
                    {
                        accountInfo._HeadImage = message.HeadImage;
                    }
                    if (message.FingerprintCode != "")
                    {
                        accountInfo._FingerprintCode = message.FingerprintCode;
                    }
                    if (message.UserImpotentLevel != -1)
                    {
                        accountInfo._UserImpotentLevel = message.UserImpotentLevel;
                    }
                    if (message.FaceprintCode != "")
                    {
                        accountInfo._FaceprintCode = message.FaceprintCode;
                    }
                    if (message.PrintType != -1)
                    {
                        accountInfo._PrintType = message.PrintType;
                    }
                }

                await dBProxyComponent.Save(accountInfo);

                await dBProxyComponent.SaveLog(accountInfo);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
예제 #7
0
        protected override async void Run(Session session, C2G_QueryAccountInfo message, Action <G2C_QueryAccountInfo> reply)
        {
            G2C_QueryAccountInfo response    = new G2C_QueryAccountInfo();
            AccountInfo          accountInfo = null;

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                var acounts = await dBProxyComponent.Query <AccountInfo>("{ '_AccountID': " + message.AccountID + "}");

                if (acounts.Count <= 0)
                {
                    AccountInfo Info = ComponentFactory.Create <AccountInfo>();
                    Info._AccountID         = message.AccountID;
                    Info._Name              = "皮皮鱼";
                    Info._BornDate          = DateTime.Now.ToString("yyyy-MM-dd");
                    Info._IDCardNumber      = "";
                    Info._Sex               = 0;
                    Info._IsFinishIdentify  = 0;
                    Info._HeadImage         = "";
                    Info._FingerprintCode   = "";
                    Info._UserImpotentLevel = 0;

                    response.Name              = Info._Name;
                    response.BornDate          = Info._BornDate;
                    response.IDCardNumber      = Info._IDCardNumber;
                    response.Sex               = Info._Sex;
                    response.IsFinishIdentify  = Info._IsFinishIdentify;
                    response.HeadImage         = Info._HeadImage;
                    response.FingerprintCode   = Info._FingerprintCode;
                    response.UserImpotentLevel = Info._UserImpotentLevel;
                    response.FaceprintCode     = Info._FaceprintCode;
                    response.PrintType         = Info._PrintType;
                    await dBProxyComponent.Save(Info);

                    await dBProxyComponent.SaveLog(Info);
                }
                else
                {
                    accountInfo = acounts[0] as AccountInfo;

                    response.Name              = accountInfo._Name;
                    response.BornDate          = accountInfo._BornDate;
                    response.IDCardNumber      = accountInfo._IDCardNumber;
                    response.Sex               = accountInfo._Sex;
                    response.IsFinishIdentify  = accountInfo._IsFinishIdentify;
                    response.HeadImage         = accountInfo._HeadImage;
                    response.FingerprintCode   = accountInfo._FingerprintCode;
                    response.UserImpotentLevel = accountInfo._UserImpotentLevel;
                    response.FaceprintCode     = accountInfo._FaceprintCode;
                    response.PrintType         = accountInfo._PrintType;
                    await dBProxyComponent.Save(accountInfo);

                    await dBProxyComponent.SaveLog(accountInfo);
                }

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
예제 #8
0
        public static async Task <PlayerBaseInfo> addPlayerBaseInfo(long uid, string Phone, string name, string head)
        {
            DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
            ConfigComponent  configCom      = Game.Scene.GetComponent <ConfigComponent>();
            AccountInfo      accountInfo    = await DBCommonUtil.getAccountInfo(uid);

            List <PlayerBaseInfo> playerBaseInfos = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{_id:{uid}}}");

            if (playerBaseInfos.Count > 0)
            {
                return(playerBaseInfos[0]);
            }

            PlayerBaseInfo playerBaseInfo = ComponentFactory.CreateWithId <PlayerBaseInfo>(IdGenerater.GenerateId());

            playerBaseInfo.Id = uid;

            if (string.IsNullOrEmpty(name))
            {
                playerBaseInfo.Name = uid.ToString();
            }
            else
            {
                List <PlayerBaseInfo> playerBaseInfos_temp =
                    await proxyComponent.QueryJson <PlayerBaseInfo>($"{{Name:'{name}'}}");

                // 昵称已经有人用了
                if (playerBaseInfos_temp.Count > 0)
                {
                    playerBaseInfo.Name = (name + uid.ToString().Substring(6));
                }

                playerBaseInfo.Name = name;
            }

            if (string.IsNullOrEmpty(head))
            {
                int random = Common_Random.getRandom(1, 5);
                //百分之五十的概率随机生成男生或女生头像
                int rate = Common_Random.getRandom(1, 100);
                if (rate <= 50)
                {
                    playerBaseInfo.Icon = $"f_icon{random}";
                }
                else
                {
                    playerBaseInfo.Icon = $"m_icon{random}";
                }
            }
            else
            {
                playerBaseInfo.Icon = head;
            }

            if (accountInfo != null)
            {
                accountInfo.Phone = Phone;
            }
            else
            {
                Log.Error("addPlayerBaseInfo() accountInfo==null  uid = " + uid);
            }

            playerBaseInfo.PlayerSound = Common_Random.getRandom(1, 4);
            await proxyComponent.Save(playerBaseInfo);

            await proxyComponent.Save(accountInfo);

            Log.Debug("增加新用户完毕");

            //// 插入任务数据
            //{
            //    Log.Debug("增加新用户任务");

            //    for (int i = 1; i < configCom.GetAll(typeof(TaskConfig)).Length + 1; ++i)
            //    {
            //        int id = 100 + i;
            //        TaskConfig config = (TaskConfig) configCom.Get(typeof(TaskConfig), id);
            //        TaskProgressInfo progress =
            //            ComponentFactory.CreateWithId<TaskProgressInfo>(IdGenerater.GenerateId());
            //        progress.IsGet = false;
            //        progress.UId = uid;
            //        progress.Name = config.Name;
            //        progress.TaskId = (int) config.Id;
            //        progress.IsComplete = false;
            //        progress.Target = config.Target;
            //        progress.Reward = config.Reward;
            //        progress.Desc = config.Desc;
            //        progress.CurProgress = 0;

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

            //    Log.Debug("增加新用户任务完毕");
            //}
            //插入新用户成就
            //{
            //    Log.Debug("增加新用户成就");
            //    for (int i = 1; i < configCom.GetAll(typeof(ChengjiuConfig)).Length + 1; ++i)
            //    {
            //        int id = 100 + i;
            //        ChengjiuConfig config = (ChengjiuConfig) configCom.Get(typeof(ChengjiuConfig), id);
            //        ChengjiuInfo chengjiu = ComponentFactory.CreateWithId<ChengjiuInfo>(IdGenerater.GenerateId());
            //        chengjiu.IsGet = false;
            //        chengjiu.UId = uid;
            //        chengjiu.Name = config.Name;
            //        chengjiu.TaskId = (int) config.Id;
            //        chengjiu.IsComplete = false;
            //        chengjiu.Target = config.Target;
            //        chengjiu.Reward = config.Reward;
            //        chengjiu.Desc = config.Desc;
            //        chengjiu.CurProgress = 0;

            //        await proxyComponent.Save(chengjiu);
            //    }

            //    Log.Debug("增加新用户成就完毕");
            //}

            return(playerBaseInfo);
        }
예제 #9
0
        // 游戏人数
        static async Task <string> GameUserCount(string time, string channelName)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                List <Log_Game>  listData       = await proxyComponent.QueryJsonDBInfos <Log_Game>(time);

                List <long> listPlayer = new List <long>();
                for (int i = 0; i < listData.Count; i++)
                {
                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player1_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player1_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player2_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player2_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player3_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player3_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player4_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player4_uid);
                        }
                    }
                }

                return("游戏人数:" + listPlayer.Count + "\r\n");
            }
            else
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                List <Log_Game>  listData       = await proxyComponent.QueryJsonDBInfos <Log_Game>(time);

                List <long> listPlayer = new List <long>();
                for (int i = 0; i < listData.Count; i++)
                {
                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player1_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player1_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player2_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player2_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player3_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player3_uid);
                        }
                    }

                    {
                        bool isFind = false;
                        for (int j = 0; j < listPlayer.Count; j++)
                        {
                            if (listPlayer[j] == listData[i].Player4_uid)
                            {
                                isFind = true;
                                break;
                            }
                        }

                        if (!isFind)
                        {
                            listPlayer.Add(listData[i].Player4_uid);
                        }
                    }
                }

                int count = 0;

                for (int i = 0; i < listPlayer.Count; i++)
                {
                    AccountInfo accountInfo = await DBCommonUtil.getAccountInfo(listPlayer[i]);

                    if (accountInfo.ChannelName.CompareTo(channelName) == 0)
                    {
                        ++count;
                    }
                }

                return("游戏人数:" + count + "\r\n");
            }
        }
        protected override async void Run(Session session, C2R_ForSaveInformation message, Action <R2C_ForSaveInformation> reply)
        {
            R2C_ForSaveInformation response = new R2C_ForSaveInformation();

            try
            {
                DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                //新建保存数据
                if (message.State == 1)
                {
                    //查询数据是否存在
                    var acounts = await dBProxyComponent.Query <AccountInfo>("{'_AccountID' : " + message.AccountID + "}");

                    if (acounts.Count > 0)
                    {
                        response.Message   = "账号已存在";
                        response.IsSuccess = false;
                    }
                    else
                    {
                        Log.Debug(MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + MethodBase.GetCurrentMethod().Name + "创建用户表和用户购物表!");
                        AccountInfo accountInfo = ComponentFactory.Create <AccountInfo>();

                        accountInfo._AccountID         = accountInfo.Id;
                        accountInfo._Name              = message.Nickname;
                        accountInfo._BornDate          = message.BornDate;
                        accountInfo._IDCardNumber      = message.IDCardNumber;
                        accountInfo._Sex               = message.Sex;
                        accountInfo._IsFinishIdentify  = message.IsFinishIdentify;
                        accountInfo._HeadImage         = message.HeadPhoto;
                        accountInfo._FingerprintCode   = "";
                        accountInfo._UserImpotentLevel = message.UserImpotentLevel;
                        accountInfo._FaceprintCode     = "";
                        accountInfo._PrintType         = 0;

                        await dBProxyComponent.Save(accountInfo);

                        await dBProxyComponent.SaveLog(accountInfo);
                    }
                }
                //修改数据
                else if (message.State == 2)
                {
                    //查询数据是否存在
                    var acounts = await dBProxyComponent.Query <AccountInfo>("{'_AccountID' : " + message.AccountID + "}");

                    Log.Debug(message.AccountID.ToString());
                    if (acounts.Count != 1)
                    {
                        if (acounts.Count > 1)
                        {
                            //存在多条数据
                            Log.Debug(MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + MethodBase.GetCurrentMethod().Name + "账号数据库异常,存在多条相同的账号。");
                            response.Message   = "数据异常, 1003";
                            response.IsSuccess = false;
                        }
                        else
                        {
                            //数据不存在
                            Log.Debug(MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + MethodBase.GetCurrentMethod().Name + "账号数据库异常,账号信息不存在。");

                            response.Message   = "数据异常 , 1002";
                            response.IsSuccess = false;
                        }
                    }
                    else
                    {
                        //找到数据,修改数据
                        foreach (var item in acounts)
                        {
                            AccountInfo accountInfo = item as AccountInfo;

                            if (message.HeadPhoto.Length > 1)
                            {
                                accountInfo._HeadImage = message.HeadPhoto;
                            }

                            accountInfo._Name              = message.Nickname;
                            accountInfo._Age               = message.Age;
                            accountInfo._IsFinishIdentify  = message.IsFinishIdentify;
                            accountInfo._FingerprintCode   = message.FingerprintCode;
                            accountInfo._FaceprintCode     = message.FaceprintCode;
                            accountInfo._PrintType         = message.PrintType;
                            accountInfo._UserImpotentLevel = message.UserImpotentLevel;

                            await dBProxyComponent.Save(accountInfo);

                            await dBProxyComponent.SaveLog(accountInfo);
                        }

                        response.IsSuccess = true;
                        response.Message   = "资料修改成功";
                        Log.Debug(MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + MethodBase.GetCurrentMethod().Name + "修改资料完成");
                    }
                }
                reply(response);
            }
            catch (Exception e)
            {
                response.Message   = MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + MethodBase.GetCurrentMethod().Name + "数据操作失败,请稍后再试。";
                response.IsSuccess = false;

                ReplyError(response, e, reply);
            }
        }