Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
im-pool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
im-pool
Commits
3c1978b8
Commit
3c1978b8
authored
Oct 19, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3239132a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
client.go
pool/client.go
+2
-2
publicApi.go
pool/publicApi.go
+18
-7
ws_server.go
ws_server.go
+1
-1
No files found.
pool/client.go
View file @
3c1978b8
...
@@ -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"`
//消息介绍内容,或其它数据
}
}
...
...
pool/publicApi.go
View file @
3c1978b8
...
@@ -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
}
}
...
...
ws_server.go
View file @
3c1978b8
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment