Commit fa87a8b6 authored by haoyanbin's avatar haoyanbin

1

parent 48c7ec6d
......@@ -67,8 +67,6 @@ type SendMsg struct {
CmdData []byte `json:"cmdData"` //对应指令的CmdData1的protobuf的message
Status int `json:"status"` //消息发送响应状态
Priority int `json:"priority"` //用于处理指令队列的优先级的权重值
BusinessId string `json:"businessId"` //客户端标识消息的id,主要区分相同cmd的不同消息,方便收到回复分发处理等效果,考虑长度问题定义成string
GroupId string `json:"groupId"` //服务端发送消息的ID,主要区分相同cmd的不同消息,方便服务端收到回复分发处理等效果,考虑长度问题定义成string
Channel []string `json:"channel"` //指定需要广播的频道,可以指定一个或多个频道
ProcedureType int `json:"procedureType"` //会话状态 1 开始导诊 2 等待连接 3 离线 4 双方建立连接 5 结束会话 6 对话 7 已读 8 超时关闭
MsgType int `json:"msgType"` // msg类型 procedureType=6时填写 1 文本消息 2 图片消息
......
......@@ -29,6 +29,7 @@ type SetMsgReq struct {
Content string `json:"content" db:"content"`
Sender string `json:"sender" db:"sender"`
Receiver string `json:"receiver" db:"receiver"`
ReadStatus string `json:"readStatus" db:"read_status"`
}
// 第一步,实例化连接对像
......@@ -415,7 +416,8 @@ func SaveMsg(msg *SendMsg) {
mqData.Content = msg.Msg
mqData.Sender = msg.FromClientId
mqData.Receiver = msg.ToClientId
AppendConversationRecord(msg)
mqData.ReadStatus = "0"
AppendConversationRecord(mqData)
}
if msg.ProcedureType == 8 {
......@@ -460,8 +462,8 @@ func GetAllList(key string) map[string]string {
return jsonDataAll
}
func AppendConversationRecord(msg *SendMsg) {
Redis.HSetNX("msg:"+strconv.Itoa(msg.ConversationId), msg.FromClientId+":"+msg.ToClientId, string(SerializeJson(msg)))
func AppendConversationRecord(msg *SetMsgReq) {
Redis.HSetNX("msg:"+strconv.Itoa(msg.ConversationId), msg.Sender+":"+msg.Receiver+":"+msg.SendTime, string(SerializeJson(msg)))
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment