private void RateSetPush(PushRate pushRate) { CommuTcpClient receiveClient = CommuClient.Values.FirstOrDefault(c => c.Nodeid == pushRate.NodeId); if (receiveClient != null && pushRate != null) { //给聊天中的用户推送倍率 ChatFeeRateSetPush chatFeeRateSetPush = new ChatFeeRateSetPush(); chatFeeRateSetPush.Body.Rate = pushRate.Rate; chatFeeRateSetPush.Body.SNodeId = pushRate.SNodeId; receiveClient.SendData(chatFeeRateSetPush.ToBytes()); } }
private void RateSetPush(int nodeId, ChatFeeRateSet chatFeeRateSet, TchatRate tchatRate) { if (chatFeeRateSet.Body.Type == 1 && chatFeeRateSet.Body.Sender > 0)//当为私聊且在聊天中时推送 { var ratePush = new PushRate() { NodeId = chatFeeRateSet.Body.Sender, Rate = tchatRate.Rate, SNodeId = chatFeeRateSet.Body.Receiver }; var pxinUser = pXinDb.GetReginfoByNodeid(chatFeeRateSet.Body.Sender); if (pxinUser.Isenterprise == 3)//当用户是达人时 { ratePush.Rate = 1; } RateSetPush(ratePush); } else //接收者类型为群时 { List <PushRate> pushRates = new List <PushRate>(); var userIds = pXinDb.GetGroupUserId(chatFeeRateSet.Body.Receiver).Where(p => p != nodeId).ToList(); if (chatFeeRateSet.Body.Type == 3)//通用倍率 { userIds = pXinDb.GetTchatFriendNodeIds(chatFeeRateSet.Body.Receiver); } userIds.ForEach(p => { pushRates.Add(new PushRate { NodeId = p, Rate = tchatRate.Rate, SNodeId = chatFeeRateSet.Body.Receiver }); }); foreach (var item in pushRates)//遍历群成员进行推送 { RateSetPush(item); } } }