Ejemplo n.º 1
0
        public void PushUserMoneyChange(System.Data.DataTable tb, out uint[] userIdArray)
        {
            userIdArray = new uint[0];
            if (tb.Rows.Count <= 0)
            {
                return;
            }

            var mm = tb.Rows.Cast <System.Data.DataRow>().Select(dr =>
            {
                return(new QL.Common.PlayerMoneyBag()
                {
                    UserID = dr.GetData("UserID").ConvertToUInt32(),
                    MoneyNum = dr.GetData("MoneyNum").ConvertToInt32(),
                    MoneyType = dr.GetData("MoneyType").ConvertToByte(),
                });
            }).ToArray();

            userIdArray = mm.GroupBy(p => p.UserID).Select(p => p.Key).Where(p => p > 0).ToArray();

            foreach (var u in userIdArray)
            {
                var msg = new QL.Common.MSG_S_PlayerLatestBalance()
                {
                    MoneyBag = mm.Where(p => p.UserID == u).ToArray()
                };
                QL.Server.RedisOP.RedisOperation.SendMessageToUser(u, msg);
            }
        }
Ejemplo n.º 2
0
        public void PushSingleUserMoneyChange(uint userId, System.Data.DataTable tb)
        {
            if (tb.Rows.Count <= 0)
            {
                return;
            }

            var mm = tb.Rows.Cast <System.Data.DataRow>().Select(dr =>
            {
                return(new QL.Common.PlayerMoneyBagBase()
                {
                    MoneyNum = dr.GetData("MoneyNum").ConvertToInt32(),
                    MoneyType = dr.GetData("MoneyType").ConvertToByte(),
                });
            }).ToArray();

            var msg = new QL.Common.MSG_S_PlayerLatestBalance()
            {
                MoneyBag = mm
            };

            QL.Server.RedisOP.RedisOperation.SendMessageToUser(userId, msg);
        }