Esempio n. 1
0
        /// <summary>
        /// 聊天计费倍率查询
        /// </summary>
        /// <param name="messageString"></param>
        private void ProChatFeeRateQuery(string messageString)
        {
            var client = _connections.GetConnection(Context.ConnectionId);

            if (client == null || client.Nodeid == 0)
            {
                MessageInfo($"聊天计费倍率查询客户端为空,client={client}");
                this.OnReconnected();
                return;
            }
            var chatFeeRateQuery = new ChatFeeRateQuery(messageString);

            MessageInfo("调用聊天计费倍率查询逻辑之前");
            var result = chatFeeRateFacade.ProChatFeeRateQuery(chatFeeRateQuery.ToBytes(), client.Nodeid);

            MessageInfo("调用聊天计费倍率查询逻辑之后");
            if (result.Count != 1)
            {
                MessageInfo("调用聊天计费倍率查询逻辑失败");
            }
            foreach (var item in result)
            {
                //var receiveClient = _connections.GetConnections().Values.FirstOrDefault(c => c.Nodeid == item.GetNodeid());
                //if (receiveClient == null)
                //{
                //    MessageInfo("聊天计费倍率查询结果推送失败:" + item.ToJson());
                //}
                Clients.Caller.receiveMessage(item.ToJson());
                //SendChatMessage(receiveClient, item.ToJson());
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 向服务器发送"倍率查询"消息
 /// </summary>
 /// <param name="chatFeeRateQuery"></param>
 /// <returns></returns>
 public bool SendMessageRateQuery(ChatFeeRateQuery chatFeeRateQuery)
 {
     SendData(chatFeeRateQuery.ToBytes());
     OnRaiseMsgSendEvent(chatFeeRateQuery.Header.Command_Id, chatFeeRateQuery, "发送消息:" + chatFeeRateQuery.ToString());
     return(true);
 }