/// <summary> /// 聊天计费倍率设置 /// </summary> /// <param name="client"></param> /// <param name="buffer"></param> private void ProChatFeeRateSet(CommuTcpClient client, byte[] buffer) { ChatFeeRateSet chatFeeRateSet = new ChatFeeRateSet(buffer); OnRaiseMsgRecvEvent(client, chatFeeRateSet.ToString()); TchatRate tchatRate = new TchatRate(); tchatRate.Typeid = chatFeeRateSet.Body.Type; tchatRate.Sender = chatFeeRateSet.Body.Sender;//0; tchatRate.Receiver = chatFeeRateSet.Body.Receiver; tchatRate.Rate = chatFeeRateSet.Body.Rate; tchatRate.Createtime = DateTime.Now; tchatRate.Remarks = "聊天计费倍率设置"; var flag = true; var result = pXinDb.GetTchatRate(tchatRate.Sender, tchatRate.Receiver, tchatRate.Typeid); if (result.Id == 0) { if (tchatRate.Rate > 1) { flag = pXinDb.ChatFeeRateSet(tchatRate); } } else { flag = pXinDb.UpdateChatFeeRate(tchatRate); } tchatRate.Rate = flag == false ? result.Rate : tchatRate.Rate; ChatFeeRateSetResp chatFeeRateSetResp = new ChatFeeRateSetResp(chatFeeRateSet.Header.Sequence_Id); chatFeeRateSetResp.Body.Status = flag == true ? (uint)1 : 0; chatFeeRateSetResp.Body.Rate = tchatRate.Rate; client.SendData(chatFeeRateSetResp.ToBytes()); //推送 RateSetPush(client.Nodeid, chatFeeRateSet, tchatRate); }
/// <summary> /// 向服务器发送"倍率设置"消息 /// </summary> /// <param name="chatFeeRateSet"></param> /// <returns></returns> public bool SendMessageRateSet(ChatFeeRateSet chatFeeRateSet) { SendData(chatFeeRateSet.ToBytes()); OnRaiseMsgSendEvent(chatFeeRateSet.Header.Command_Id, chatFeeRateSet, "发送消息:" + chatFeeRateSet.ToString()); return(true); }