Commit 3c1978b8 authored by haoyanbin's avatar haoyanbin

1

parent 3239132a
...@@ -65,8 +65,8 @@ type SendMsg struct { ...@@ -65,8 +65,8 @@ type SendMsg struct {
BusinessId string `json:"businessId"` //客户端标识消息的id,主要区分相同cmd的不同消息,方便收到回复分发处理等效果,考虑长度问题定义成string BusinessId string `json:"businessId"` //客户端标识消息的id,主要区分相同cmd的不同消息,方便收到回复分发处理等效果,考虑长度问题定义成string
GroupId string `json:"groupId"` //服务端发送消息的ID,主要区分相同cmd的不同消息,方便服务端收到回复分发处理等效果,考虑长度问题定义成string GroupId string `json:"groupId"` //服务端发送消息的ID,主要区分相同cmd的不同消息,方便服务端收到回复分发处理等效果,考虑长度问题定义成string
Channel []string `json:"channel"` //指定需要广播的频道,可以指定一个或多个频道 Channel []string `json:"channel"` //指定需要广播的频道,可以指定一个或多个频道
ProcedureType int `json:"procedureType"` // 会话类型 1 用户连接,开始导诊 2 导诊完成,等待接诊 3 专家接诊 4 会话 5 结束会话 ProcedureType int `json:"procedureType"` //会话状态 1 开始导诊 2 等待连接 3 离线 4 双方建立连接 5 结束会话 6 对话 7 已读
MsgType int `json:"msgType"` // msg类型 procedureType=4时填写 1 文本消息 2 图片消息 MsgType int `json:"msgType"` // msg类型 procedureType=6时填写 1 文本消息 2 图片消息
Msg string `json:"msg"` //一般用于json数据传递,或消息发送响应内容 Msg string `json:"msg"` //一般用于json数据传递,或消息发送响应内容
Desc string `json:"desc"` //消息介绍内容,或其它数据 Desc string `json:"desc"` //消息介绍内容,或其它数据
} }
......
...@@ -306,6 +306,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) { ...@@ -306,6 +306,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
return nil, errors.New("用户数据有误") return nil, errors.New("用户数据有误")
} }
if tokenData[1] == "1" {
source, err := DataAesDecrypt(tokenData[0]) source, err := DataAesDecrypt(tokenData[0])
if err != nil { if err != nil {
return nil, errors.New("用户数据有误") return nil, errors.New("用户数据有误")
...@@ -314,6 +315,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) { ...@@ -314,6 +315,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
if len(source) <= 0 { if len(source) <= 0 {
return nil, errors.New("用户数据有误") return nil, errors.New("用户数据有误")
} }
}
userData := new(UserInfo) userData := new(UserInfo)
userData.Source = tokenData[0] userData.Source = tokenData[0]
...@@ -325,7 +327,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) { ...@@ -325,7 +327,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
return userData, nil return userData, nil
} }
//会话状态 0 新建会话 2 等待连接 3 离线 4 双方建立连接 5 结束会话 6 对话 7 已读 //会话状态 1 开始导诊 2 等待连接 3 离线 4 双方建立连接 5 结束会话 6 对话 7 已读
func SaveMsg(msg *SendMsg) { func SaveMsg(msg *SendMsg) {
user := GetClientInfoById(msg.FromClientId) user := GetClientInfoById(msg.FromClientId)
...@@ -364,6 +366,15 @@ func SaveMsg(msg *SendMsg) { ...@@ -364,6 +366,15 @@ func SaveMsg(msg *SendMsg) {
mqData.GuideDate = msg.SendTime mqData.GuideDate = msg.SendTime
} }
if msg.ProcedureType == 3 {
if user.Promoter == "1" {
mqData.Finish = "1"
}
if user.Promoter == "2" {
mqData.Finish = "2"
}
}
if msg.ProcedureType == 4 { if msg.ProcedureType == 4 {
mqData.StartReceiveDate = msg.SendTime mqData.StartReceiveDate = msg.SendTime
} }
......
...@@ -131,7 +131,7 @@ func ws(w http.ResponseWriter, r *http.Request) { ...@@ -131,7 +131,7 @@ func ws(w http.ResponseWriter, r *http.Request) {
if user.Promoter == "1" { if user.Promoter == "1" {
closeMsg.Finish = "3" closeMsg.Finish = "3"
closeMsg.BusinessId = userInfo.Source closeMsg.BusinessId,_ = pool.DataAesDecrypt(userInfo.Source)
closeMsg.CustomerId = userInfo.CustomerId closeMsg.CustomerId = userInfo.CustomerId
pool.PublishData(closeMsg) pool.PublishData(closeMsg)
fmt.Println("用户关闭连接", client.Id) fmt.Println("用户关闭连接", client.Id)
......
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