Пример #1
0
        protected override async void Run(Session session, C2G_AddGoodsOrder message, Action <G2C_AddGoodsOrder> reply)
        {
            G2C_AddGoodsOrder response = new G2C_AddGoodsOrder();

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

                GoodsOrder GoodsOrder = ComponentFactory.Create <GoodsOrder>();
                GoodsOrder._InvAccountID = message.InvAccountID;
                GoodsOrder._GoodsID      = message.GoodsID;
                GoodsOrder._GoodsDataID  = message.GoodsDataID;
                GoodsOrder._Price        = message.Price;
                GoodsOrder._Intrduce     = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.Intrduce);
                GoodsOrder._PublicTime   = message.PublicTime;

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #2
0
        protected override async void Run(Session session, C2G_AddRelationInfo message, Action <G2C_AddRelationInfo> reply)
        {
            G2C_AddRelationInfo response = new G2C_AddRelationInfo();

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

                RelationInfo RelationInfo = ComponentFactory.Create <RelationInfo>();

                RelationInfo._AccountID    = message.InvAccountID;
                RelationInfo._InfoID       = message.InfoID;
                RelationInfo._FriendIDList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.FriendIDList);
                RelationInfo._BlackIDList  = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.BlackIDList);
                RelationInfo._GroupList    = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.GroupList);
                RelationInfo._ChatRoomList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.ChatRoomList);

                await dBProxyComponent.Save(RelationInfo);

                await dBProxyComponent.SaveLog(RelationInfo);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #3
0
        protected override async void Run(Session session, C2G_QueryChatRoom message, Action <G2C_QueryChatRoom> reply)
        {
            G2C_QueryChatRoom response = new G2C_QueryChatRoom();
            ChatRoom          ChatRoom = null;

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

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

                if (acounts.Count <= 0)
                {
                    ChatRoom Info = ComponentFactory.Create <ChatRoom>();

                    Info._InvAccountID   = message.Acount;
                    Info._ManagePassword = "";
                    Info._PublicBorad    = "";
                    Info._Name           = "";
                    Info._UserList       = new List <long>();
                    Info._CreateDate     = "";
                    Info._GroupType      = 0;
                    Info._State          = 0;


                    await dBProxyComponent.Save(Info);

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

                    response.ManagePassword = ChatRoom._ManagePassword;
                    response.PublicBorad    = ChatRoom._PublicBorad;
                    response.Name           = ChatRoom._Name;
                    response.UserList       = RepeatedFieldAndListChangeTool.ListToRepeatedField(ChatRoom._UserList);
                    response.CreateDate     = ChatRoom._CreateDate;
                    response.GroupType      = ChatRoom._GroupType;
                    //response.State = ChatRoom._State;
                }

                await dBProxyComponent.Save(ChatRoom);

                await dBProxyComponent.SaveLog(ChatRoom);

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #4
0
        protected override async void Run(Session session, C2G_QueryDealOrder message, Action <G2C_QueryDealOrder> reply)
        {
            G2C_QueryDealOrder response  = new G2C_QueryDealOrder();
            DealOrder          DealOrder = null;

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

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

                if (acounts.Count <= 0)
                {
                    //查询不到不创建
                }
                else
                {
                    for (int i = 0; i < acounts.Count; i++)
                    {
                        DealOrder = acounts[i] as DealOrder;

                        Dealorder record = new Dealorder();
                        record.ByInvAccountID      = DealOrder._ByInvAccountID;
                        record.ProductID           = DealOrder._ProductID;
                        record.InvItemList         = RepeatedFieldAndListChangeTool.ListToRepeatedField(DealOrder._InvItemList);
                        record.InvProductPoint     = DealOrder._InvProductPoint;
                        record.InvProductDiamond   = DealOrder._InvProductDiamond;
                        record.ByInvItemList       = RepeatedFieldAndListChangeTool.ListToRepeatedField(DealOrder._ByInvItemList);
                        record.ByInvProductPoint   = DealOrder._ByInvProductPoint;
                        record.ByInvProductDiamond = DealOrder._ByInvProductDiamond;
                        record.MessageList         = RepeatedFieldAndListChangeTool.ListToRepeatedField(DealOrder._MessageList);
                        record.CreateDate          = DealOrder._CreateDate;
                        record.DealDate            = DealOrder._DealDate;
                        record.InvIP   = DealOrder._InvIP;
                        record.ByInvIP = DealOrder._ByInvIP;
                        record.State   = DealOrder._State;

                        response.Userlist.Add(record);
                    }
                }

                await dBProxyComponent.Save(DealOrder);

                await dBProxyComponent.SaveLog(DealOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #5
0
        protected override async void Run(Session session, C2G_QueryGoodsOrder message, Action <G2C_QueryGoodsOrder> reply)
        {
            G2C_QueryGoodsOrder response   = new G2C_QueryGoodsOrder();
            GoodsOrder          GoodsOrder = null;

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

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

                if (acounts.Count <= 0)
                {
                    GoodsOrder Info = ComponentFactory.Create <GoodsOrder>();

                    Info._InvAccountID = message.AccountID;
                    Info._GoodsID      = 0;
                    Info._GoodsDataID  = 0;
                    Info._Price        = 0;
                    Info._Intrduce     = new List <string>();
                    Info._PublicTime   = "";


                    await dBProxyComponent.Save(Info);

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

                    response.GoodsID     = GoodsOrder._GoodsID;
                    response.GoodsDataID = GoodsOrder._GoodsDataID;
                    response.Price       = GoodsOrder._Price;
                    response.Intrduce    = RepeatedFieldAndListChangeTool.ListToRepeatedField(GoodsOrder._Intrduce);
                    response.PublicTime  = GoodsOrder._PublicTime;
                }

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #6
0
        protected override async void Run(Session session, C2G_QueryRelationInfo message, Action <G2C_QueryRelationInfo> reply)
        {
            G2C_QueryRelationInfo response     = new G2C_QueryRelationInfo();
            RelationInfo          RelationInfo = null;

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

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

                if (acounts.Count <= 0)
                {
                    RelationInfo Info = ComponentFactory.Create <RelationInfo>();

                    Info._AccountID    = message.AccountID;
                    Info._InfoID       = 0;
                    Info._FriendIDList = new List <long>();
                    Info._BlackIDList  = new List <long>();
                    Info._GroupList    = new List <long>();
                    Info._ChatRoomList = new List <long>();

                    await dBProxyComponent.Save(Info);

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

                    response.InfoID       = RelationInfo._InfoID;
                    response.FriendIDList = RepeatedFieldAndListChangeTool.ListToRepeatedField(RelationInfo._FriendIDList);
                    response.BlackIDList  = RepeatedFieldAndListChangeTool.ListToRepeatedField(RelationInfo._BlackIDList);
                    response.GroupList    = RepeatedFieldAndListChangeTool.ListToRepeatedField(RelationInfo._GroupList);
                    response.ChatRoomList = RepeatedFieldAndListChangeTool.ListToRepeatedField(RelationInfo._ChatRoomList);
                }

                await dBProxyComponent.Save(RelationInfo);

                await dBProxyComponent.SaveLog(RelationInfo);

                reply(response);
            }
            catch (Exception e)
            {
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #7
0
        protected override async void Run(Session session, C2G_UpdateGoodsOrder message, Action <G2C_UpdateGoodsOrder> reply)
        {
            G2C_UpdateGoodsOrder response   = new G2C_UpdateGoodsOrder();
            GoodsOrder           GoodsOrder = null;

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

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

                if (acounts.Count <= 0)
                {
                    //修改的时候查询不到说明数据库有问题
                }
                else
                {
                    GoodsOrder = acounts[0] as GoodsOrder;

                    GoodsOrder._InvAccountID = message.InvAccountID;
                    GoodsOrder._GoodsID      = message.GoodsID;
                    GoodsOrder._GoodsDataID  = message.GoodsDataID;
                    GoodsOrder._Price        = message.Price;
                    GoodsOrder._Intrduce     = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.Intrduce);
                    GoodsOrder._PublicTime   = message.PublicTime;
                }

                await dBProxyComponent.Save(GoodsOrder);

                await dBProxyComponent.SaveLog(GoodsOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #8
0
        protected override async void Run(Session session, C2G_UpdateRelationInfo message, Action <G2C_UpdateRelationInfo> reply)
        {
            G2C_UpdateRelationInfo response     = new G2C_UpdateRelationInfo();
            RelationInfo           RelationInfo = null;

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

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

                if (acounts.Count <= 0)
                {
                    //修改的时候查询不到说明数据库有问题
                }
                else
                {
                    RelationInfo = acounts[0] as RelationInfo;

                    RelationInfo._AccountID    = message.InvAccountID;
                    RelationInfo._InfoID       = message.InfoID;
                    RelationInfo._FriendIDList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.FriendIDList);
                    RelationInfo._BlackIDList  = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.BlackIDList);
                    RelationInfo._GroupList    = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.GroupList);
                    RelationInfo._ChatRoomList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.ChatRoomList);
                }

                await dBProxyComponent.Save(RelationInfo);

                await dBProxyComponent.SaveLog(RelationInfo);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #9
0
        protected override async void Run(Session session, C2G_AddDealOrder message, Action <G2C_AddDealOrder> reply)
        {
            G2C_AddDealOrder response = new G2C_AddDealOrder();

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

                DealOrder DealOrder = ComponentFactory.Create <DealOrder>();
                DealOrder._InvAccountID        = message.InvAccountID;
                DealOrder._ByInvAccountID      = message.ByInvAccountID;
                DealOrder._ProductID           = message.ProductID;
                DealOrder._InvItemList         = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.InvItemList);
                DealOrder._InvProductPoint     = message.InvProductPoint;
                DealOrder._InvProductDiamond   = message.InvProductDiamond;
                DealOrder._InvItemList         = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.ByInvItemList);
                DealOrder._ByInvProductPoint   = message.ByInvProductPoint;
                DealOrder._ByInvProductDiamond = message.ByInvProductDiamond;
                DealOrder._InvItemList         = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.MessageList);
                DealOrder._CreateDate          = message.CreateDate;
                DealOrder._DealDate            = message.DealDate;
                DealOrder._InvIP   = message.InvIP;
                DealOrder._ByInvIP = message.ByInvIP;
                DealOrder._State   = message.State;

                await dBProxyComponent.Save(DealOrder);

                await dBProxyComponent.SaveLog(DealOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }
Пример #10
0
        protected override async void Run(Session session, C2G_UpdateDealOrder message, Action <G2C_UpdateDealOrder> reply)
        {
            G2C_UpdateDealOrder response  = new G2C_UpdateDealOrder();
            DealOrder           DealOrder = null;

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

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

                if (acounts.Count <= 0)
                {
                    //修改的时候查询不到说明数据库有问题
                }
                else
                {
                    DealOrder = acounts[0] as DealOrder;

                    if (message.ByInvAccountID != -1)
                    {
                        DealOrder._ByInvAccountID = message.ByInvAccountID;
                    }
                    if (message.ProductID != -1)
                    {
                        DealOrder._ProductID = message.ProductID;
                    }
                    if (message.InvItemList.Count != 0)
                    {
                        DealOrder._InvItemList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.InvItemList);
                    }
                    if (message.InvProductPoint != -1)
                    {
                        DealOrder._InvProductPoint = message.InvProductPoint;
                    }
                    if (message.InvProductDiamond != -1)
                    {
                        DealOrder._InvProductDiamond = message.InvProductDiamond;
                    }
                    if (message.ByInvItemList.count != 0)
                    {
                        DealOrder._InvItemList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.ByInvItemList);
                    }
                    if (message.ByInvProductPoint != -1)
                    {
                        DealOrder._ByInvProductPoint = message.ByInvProductPoint;
                    }
                    if (message.ByInvProductDiamond != -1)
                    {
                        DealOrder._ByInvProductDiamond = message.ByInvProductDiamond;
                    }
                    if (message.MessageList.count != 0)
                    {
                        DealOrder._InvItemList = RepeatedFieldAndListChangeTool.RepeatedFieldToList(message.MessageList);
                    }
                    if (message.CreateDate != "")
                    {
                        DealOrder._CreateDate = message.CreateDate;
                    }
                    if (message.DealDate != "")
                    {
                        DealOrder._DealDate = message.DealDate;
                    }
                    if (message.InvIP != "")
                    {
                        DealOrder._InvIP = message.InvIP;
                    }
                    if (message.ByInvIP != "")
                    {
                        DealOrder._ByInvIP = message.ByInvIP;
                    }
                    if (message.State != -1)
                    {
                        DealOrder._State = message.State;
                    }
                }

                await dBProxyComponent.Save(DealOrder);

                await dBProxyComponent.SaveLog(DealOrder);

                reply(response);
            }
            catch (Exception e)
            {
                response.IsOk    = false;
                response.Message = "数据库异常";
                ReplyError(response, e, reply);
            }
        }