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
0bbe94eb
Commit
0bbe94eb
authored
Dec 01, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
4d5d4553
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
154 deletions
+88
-154
client.go
pool/client.go
+17
-16
publicApi.go
pool/publicApi.go
+63
-117
ws_server.go
ws_server.go
+8
-21
No files found.
pool/client.go
View file @
0bbe94eb
...
@@ -60,7 +60,7 @@ type RuntimeInfo struct {
...
@@ -60,7 +60,7 @@ type RuntimeInfo struct {
}
}
type
SendMsg
struct
{
type
SendMsg
struct
{
MsgId
string
`json:"msg
Id"`
ConversationId
int
`json:"conversation
Id"`
SendTime
string
`json:"sendTime"`
//消息发送时间
SendTime
string
`json:"sendTime"`
//消息发送时间
FromClientId
string
`json:"fromClientId"`
//指令消息的来源。发送者的连接ID
FromClientId
string
`json:"fromClientId"`
//指令消息的来源。发送者的连接ID
ToClientId
string
`json:"toClientId"`
//指令消息的接收者。发送给对应的客户端连接ID
ToClientId
string
`json:"toClientId"`
//指令消息的接收者。发送给对应的客户端连接ID
...
@@ -114,8 +114,9 @@ type Client struct {
...
@@ -114,8 +114,9 @@ type Client struct {
//}
//}
type
Conversation
struct
{
type
Conversation
struct
{
CustomerClientId
string
`json:"customerClientId"`
ConversationId
int
`json:"conversationId"`
UserClientId
string
`json:"userClientId"`
Promoter
string
`json:"promoter"`
Participant
string
`json:"participant"`
StartTime
string
`json:"startTime"`
StartTime
string
`json:"startTime"`
StartReceiveDate
string
`json:"startReceiveDate"`
StartReceiveDate
string
`json:"startReceiveDate"`
Status
int
`json:"status"`
Status
int
`json:"status"`
...
...
pool/publicApi.go
View file @
0bbe94eb
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"net/http"
"net/http"
"pool/pool/util/grpool"
"pool/pool/util/grpool"
"strconv"
"strings"
"strings"
"sync"
"sync"
"time"
"time"
...
@@ -12,35 +13,22 @@ import (
...
@@ -12,35 +13,22 @@ import (
type
SetMsgReq
struct
{
type
SetMsgReq
struct
{
ProcedureType
int
`json:"procedureType"`
ProcedureType
int
`json:"procedureType"`
GroupId
string
`json:"groupId" db:"group_id"`
ConversationId
int
`json:"conversationId" db:"conversation_id"`
UserId
string
`json:"userId" db:"user_id"`
Promoter
string
`json:"promoter" db:"promoter"`
BusinessId
string
`json:"businessId" db:"business_id"`
Participant
string
`json:"participant" db:"participant"`
CustomerId
string
`json:"customerId" db:"customer_id"`
Status
string
`json:"status" db:"status"`
Status
string
`json:"status" db:"status"`
StartTime
string
`json:"startTime" db:"start_time"`
StartTime
string
`json:"startTime" db:"start_time"`
EndTime
string
`json:"endTime" db:"end_time"`
EndTime
string
`json:"endTime" db:"end_time"`
Remark
string
`json:"remark" db:"remark"`
Remark
string
`json:"remark" db:"remark"`
Promoter
string
`json:"promoter" db:"promoter"`
Finish
string
`json:"finish" db:"finish"`
Finish
string
`json:"finish" db:"finish"`
ExpertUnread
string
`json:"expertUnread" db:"expert_unread"`
UserUnread
string
`json:"userUnread" db:"user_unread"`
ExpertUnreadMessage
string
`json:"expertUnreadMessage" db:"expert_unread_message"`
ExpertUnreadMessageTime
string
`json:"expertUnreadMessageTime" db:"expert_unread_message_time"`
GuideMsg
string
`json:"guideMsg" db:"guide_msg"`
GuideMsg
string
`json:"guideMsg" db:"guide_msg"`
GuideDate
string
`json:"guideDate" db:"guide_date"`
GuideDate
string
`json:"guideDate" db:"guide_date"`
ReceiveDate
string
`json:"receiveDate" db:"receive_date"`
ConversationDate
string
`json:"conversationDate" db:"conversation_date"`
StartReceiveDate
string
`json:"startReceiveDate" db:"start_receive_date"`
StartReceiveDate
string
`json:"startReceiveDate" db:"start_receive_date"`
ConversationId
string
`json:"conversationId" db:"conversation_id"`
PromoterType
string
`json:"promoterType" db:"promoter_type"`
SendTime
string
`json:"sendTime" db:"send_time"`
SendTime
string
`json:"sendTime" db:"send_time"`
MsgType
int
`json:"msgType" db:"msg_type"`
MsgType
int
`json:"msgType" db:"msg_type"`
Content
string
`json:"content" db:"content"`
Content
string
`json:"content" db:"content"`
Sender
string
`json:"sender" db:"sender"`
Sender
string
`json:"sender" db:"sender"`
Receiver
string
`json:"receiver" db:"receiver"`
Receiver
string
`json:"receiver" db:"receiver"`
HandleTime
string
`json:"handleTime" db:"handle_time"`
HandlePersonId
string
`json:"handlePersonId" db:"handle_person_id"`
HandlePerson
string
`json:"handlePerson" db:"handle_person"`
}
}
// 第一步,实例化连接对像
// 第一步,实例化连接对像
...
@@ -306,13 +294,13 @@ func BroadcastAll(msg *SendMsg) error {
...
@@ -306,13 +294,13 @@ func BroadcastAll(msg *SendMsg) error {
}
}
// 根据来源和类型获取客户端列表
// 根据来源和类型获取客户端列表
func
GetList
(
source
,
us
erType
string
)
map
[
string
]
*
Client
{
func
GetList
(
source
,
sourceId
,
custom
erType
string
)
map
[
string
]
*
Client
{
clientData
:=
make
(
map
[
string
]
*
Client
,
0
)
clientData
:=
make
(
map
[
string
]
*
Client
,
0
)
for
k
,
v
:=
range
wsSever
.
hub
.
clients
{
for
k
,
v
:=
range
wsSever
.
hub
.
clients
{
userInfo
:=
strings
.
Split
(
k
,
"_"
)
userInfo
:=
strings
.
Split
(
k
,
"_"
)
if
(
userInfo
[
0
]
==
source
)
||
(
source
==
""
)
{
if
(
userInfo
[
0
]
==
source
&&
userInfo
[
1
]
==
sourceId
)
||
(
source
==
""
)
{
if
us
erType
!=
""
{
if
custom
erType
!=
""
{
if
userInfo
[
1
]
==
us
erType
{
if
userInfo
[
1
]
==
custom
erType
{
clientData
[
k
]
=
v
clientData
[
k
]
=
v
}
}
}
else
{
}
else
{
...
@@ -325,7 +313,8 @@ func GetList(source, userType string) map[string]*Client {
...
@@ -325,7 +313,8 @@ func GetList(source, userType string) map[string]*Client {
type
UserInfo
struct
{
type
UserInfo
struct
{
Source
string
`json:"source"`
//
Source
string
`json:"source"`
//
Promoter
string
`json:"promoter"`
SourceId
string
`json:"sourceId"`
//
CustomerType
string
`json:"customerType"`
CustomerId
string
`json:"customerId"`
CustomerId
string
`json:"customerId"`
ClientId
string
`json:"clientId"`
ClientId
string
`json:"clientId"`
ToChannel
[]
string
`json:"toChannel"`
ToChannel
[]
string
`json:"toChannel"`
...
@@ -336,7 +325,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
...
@@ -336,7 +325,7 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
tokenData
:=
strings
.
Split
(
token
,
"_"
)
tokenData
:=
strings
.
Split
(
token
,
"_"
)
if
len
(
tokenData
)
<
3
{
if
len
(
tokenData
)
<
4
{
return
nil
,
errors
.
New
(
"用户数据有误"
)
return
nil
,
errors
.
New
(
"用户数据有误"
)
}
}
...
@@ -353,55 +342,23 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
...
@@ -353,55 +342,23 @@ func GetClientInfoByToken(token string) (*UserInfo, error) {
userData
:=
new
(
UserInfo
)
userData
:=
new
(
UserInfo
)
userData
.
Source
=
tokenData
[
0
]
userData
.
Source
=
tokenData
[
0
]
userData
.
Promoter
=
tokenData
[
1
]
userData
.
SourceId
=
tokenData
[
1
]
userData
.
CustomerId
=
tokenData
[
2
]
userData
.
CustomerType
=
tokenData
[
2
]
userData
.
CustomerId
=
tokenData
[
3
]
userData
.
ClientId
=
userData
.
Source
+
"_"
+
userData
.
Promoter
+
"_"
+
userData
.
CustomerId
userData
.
ClientId
=
userData
.
Source
+
"_"
+
userData
.
Source
+
"_"
+
userData
.
CustomerType
+
"_"
+
userData
.
CustomerId
return
userData
,
nil
return
userData
,
nil
}
}
// 会话状态 1 开始导诊 2 等待连接 3 双方建立连接 4 结束会话 5 离线 6 对话 7 已读 8 超时自动结束
// 会话状态 1 开始导诊 2 等待连接 3 双方建立连接 4 结束会话 5 离线 6 对话 7 已读 8 超时自动结束
func
SaveMsg
(
msg
*
SendMsg
)
{
func
SaveMsg
(
msg
*
SendMsg
)
{
msg
.
SendTime
=
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
user
:=
GetClientInfoById
(
msg
.
FromClientId
)
user
:=
GetClientInfoById
(
msg
.
FromClientId
)
toUser
:=
&
UserInfo
{}
if
msg
.
ToClientId
!=
""
{
toUser
=
GetClientInfoById
(
msg
.
ToClientId
)
}
if
user
.
Promoter
==
""
{
fmt
.
Println
(
"用户数据有误"
)
return
}
mqData
:=
&
SetMsgReq
{}
mqData
:=
&
SetMsgReq
{}
if
user
.
Promoter
==
"1"
{
mqData
.
BusinessId
=
user
.
Source
mqData
.
CustomerId
=
user
.
CustomerId
mqData
.
GroupId
=
toUser
.
Source
mqData
.
UserId
=
toUser
.
CustomerId
}
if
user
.
Promoter
==
"2"
{
mqData
.
BusinessId
=
toUser
.
Source
mqData
.
CustomerId
=
toUser
.
CustomerId
mqData
.
GroupId
=
user
.
Source
mqData
.
UserId
=
user
.
CustomerId
}
if
mqData
.
BusinessId
!=
""
{
//mqData.BusinessId, _ = DataAesDecrypt(mqData.BusinessId)
mqData
.
BusinessId
=
mqData
.
BusinessId
}
mqData
.
ProcedureType
=
msg
.
ProcedureType
mqData
.
ProcedureType
=
msg
.
ProcedureType
mqData
.
ConversationId
=
msg
.
ConversationId
if
msg
.
ProcedureType
==
1
{
mqData
.
StartTime
=
msg
.
SendTime
mqData
.
Promoter
=
user
.
Promoter
}
if
msg
.
ProcedureType
==
2
{
if
msg
.
ProcedureType
==
2
{
mqData
.
GuideMsg
=
msg
.
Msg
mqData
.
GuideMsg
=
msg
.
Msg
...
@@ -411,17 +368,13 @@ func SaveMsg(msg *SendMsg) {
...
@@ -411,17 +368,13 @@ func SaveMsg(msg *SendMsg) {
//建立连接
//建立连接
if
msg
.
ProcedureType
==
3
{
if
msg
.
ProcedureType
==
3
{
mqData
.
StartReceiveDate
=
msg
.
SendTime
mqData
.
StartReceiveDate
=
msg
.
SendTime
mqData
.
Participant
=
msg
.
FromClientId
//连接开启信息存入
//连接开启信息存入
conversation
:=
&
Conversation
{}
conversation
:=
&
Conversation
{}
if
user
.
Promoter
==
"1"
{
conversation
.
ConversationId
=
msg
.
ConversationId
conversation
.
CustomerClientId
=
msg
.
FromClientId
conversation
.
Promoter
=
msg
.
FromClientId
conversation
.
UserClientId
=
msg
.
ToClientId
conversation
.
Participant
=
msg
.
ToClientId
}
if
user
.
Promoter
==
"2"
{
conversation
.
CustomerClientId
=
msg
.
ToClientId
conversation
.
UserClientId
=
msg
.
FromClientId
}
conversation
.
Status
=
3
conversation
.
Status
=
3
conversation
.
StartReceiveDate
=
mqData
.
StartReceiveDate
conversation
.
StartReceiveDate
=
mqData
.
StartReceiveDate
AppendConversation
(
conversation
)
AppendConversation
(
conversation
)
...
@@ -430,29 +383,28 @@ func SaveMsg(msg *SendMsg) {
...
@@ -430,29 +383,28 @@ func SaveMsg(msg *SendMsg) {
//结束
//结束
if
msg
.
ProcedureType
==
4
{
if
msg
.
ProcedureType
==
4
{
mqData
.
EndTime
=
msg
.
SendTime
mqData
.
EndTime
=
msg
.
SendTime
mqData
.
Promoter
=
user
.
Promoter
if
user
.
Promoter
==
"1"
{
if
user
.
CustomerType
==
"1"
{
mqData
.
Finish
=
"3"
mqData
.
Finish
=
"3"
}
}
if
user
.
Promoter
==
"2"
{
if
user
.
CustomerType
==
"2"
{
mqData
.
Finish
=
"1"
mqData
.
Finish
=
"1"
}
}
}
}
//离线
//离线
if
msg
.
ProcedureType
==
5
{
if
msg
.
ProcedureType
==
5
{
if
user
.
Promoter
==
"1"
{
if
user
.
CustomerType
==
"1"
{
mqData
.
Finish
=
"1"
mqData
.
Finish
=
"1"
}
}
if
user
.
Promoter
==
"2"
{
if
user
.
CustomerType
==
"2"
{
mqData
.
Finish
=
"2"
mqData
.
Finish
=
"2"
}
}
}
}
//对话
//对话
if
msg
.
ProcedureType
==
6
{
if
msg
.
ProcedureType
==
6
{
mqData
.
PromoterType
=
user
.
Promoter
mqData
.
SendTime
=
msg
.
SendTime
mqData
.
SendTime
=
msg
.
SendTime
mqData
.
MsgType
=
msg
.
MsgType
mqData
.
MsgType
=
msg
.
MsgType
mqData
.
Content
=
msg
.
Msg
mqData
.
Content
=
msg
.
Msg
...
@@ -461,21 +413,14 @@ func SaveMsg(msg *SendMsg) {
...
@@ -461,21 +413,14 @@ func SaveMsg(msg *SendMsg) {
}
}
//已读状态
//已读状态
if
msg
.
ProcedureType
==
7
{
//if msg.ProcedureType == 7 {
if
user
.
Promoter
==
"1"
{
// mqData.SendTime = msg.SendTime
mqData
.
PromoterType
=
"2"
//}
}
if
user
.
Promoter
==
"2"
{
mqData
.
PromoterType
=
"1"
}
mqData
.
SendTime
=
msg
.
SendTime
}
if
msg
.
ProcedureType
==
8
{
if
msg
.
ProcedureType
==
8
{
mqData
.
EndTime
=
msg
.
SendTime
mqData
.
EndTime
=
msg
.
SendTime
mqData
.
Promoter
=
user
.
Promoter
mqData
.
Finish
=
"5"
mqData
.
Finish
=
"5"
DelConversation
(
msg
.
FromClientId
,
msg
.
ToClient
Id
)
DelConversation
(
msg
.
Conversation
Id
)
}
}
if
mqData
.
ProcedureType
!=
0
{
if
mqData
.
ProcedureType
!=
0
{
...
@@ -490,14 +435,15 @@ func GetClientInfoById(clientId string) *UserInfo {
...
@@ -490,14 +435,15 @@ func GetClientInfoById(clientId string) *UserInfo {
userData
:=
new
(
UserInfo
)
userData
:=
new
(
UserInfo
)
if
len
(
data
)
<
3
{
if
len
(
data
)
<
4
{
fmt
.
Println
(
"用户数据有误"
)
fmt
.
Println
(
"用户数据有误"
)
return
userData
return
userData
}
}
userData
.
Source
=
data
[
0
]
userData
.
Source
=
data
[
0
]
userData
.
Promoter
=
data
[
1
]
userData
.
SourceId
=
data
[
1
]
userData
.
CustomerId
=
data
[
2
]
userData
.
CustomerType
=
data
[
2
]
userData
.
CustomerId
=
data
[
3
]
return
userData
return
userData
}
}
...
@@ -514,12 +460,12 @@ func GetAllList(key string) map[string]string {
...
@@ -514,12 +460,12 @@ func GetAllList(key string) map[string]string {
}
}
func
AppendConversation
(
conversation
*
Conversation
)
{
func
AppendConversation
(
conversation
*
Conversation
)
{
Redis
.
HSetNX
(
convKey
,
conversation
.
CustomerClientId
+
"^"
+
conversation
.
UserClientId
,
string
(
SerializeJson
(
conversation
)))
Redis
.
HSetNX
(
convKey
,
strconv
.
Itoa
(
conversation
.
ConversationId
)
,
string
(
SerializeJson
(
conversation
)))
return
return
}
}
func
DelConversation
(
c
ustomerClientId
,
userClientId
string
)
{
func
DelConversation
(
c
onversationId
int
)
{
Redis
.
HDel
(
convKey
,
customerClientId
+
"^"
+
userClientId
)
Redis
.
HDel
(
convKey
,
strconv
.
Itoa
(
conversationId
)
)
return
return
}
}
...
@@ -541,25 +487,25 @@ func SetEnd() {
...
@@ -541,25 +487,25 @@ func SetEnd() {
if
conversationData
.
StartReceiveDate
<
time
.
Now
()
.
Add
(
-
endDate
)
.
Format
(
"2006-01-02 15:04:05"
)
{
if
conversationData
.
StartReceiveDate
<
time
.
Now
()
.
Add
(
-
endDate
)
.
Format
(
"2006-01-02 15:04:05"
)
{
mqData
:=
&
SendMsg
{
mqData
:=
&
SendMsg
{
ProcedureType
:
8
,
ProcedureType
:
8
,
ToClientId
:
conversationData
.
CustomerClientId
,
ToClientId
:
conversationData
.
Promoter
,
FromClientId
:
conversationData
.
UserClientId
,
FromClientId
:
conversationData
.
Participant
,
SendTime
:
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
),
SendTime
:
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
),
}
}
//发送结束会话给客户端
//发送结束会话给客户端
_
,
isSet
:=
wsSever
.
hub
.
clients
[
conversationData
.
CustomerClientId
]
_
,
isSet
:=
wsSever
.
hub
.
clients
[
conversationData
.
Promoter
]
if
isSet
==
true
{
if
isSet
==
true
{
wsSever
.
hub
.
clients
[
conversationData
.
CustomerClientId
]
.
readMessage
(
mqData
)
wsSever
.
hub
.
clients
[
conversationData
.
Promoter
]
.
readMessage
(
mqData
)
}
}
toMqData
:=
&
SendMsg
{
toMqData
:=
&
SendMsg
{
ProcedureType
:
8
,
ProcedureType
:
8
,
ToClientId
:
conversationData
.
UserClientId
,
ToClientId
:
conversationData
.
Participant
,
FromClientId
:
conversationData
.
CustomerClientId
,
FromClientId
:
conversationData
.
Promoter
,
SendTime
:
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
),
SendTime
:
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
),
}
}
_
,
isSet
=
wsSever
.
hub
.
clients
[
conversationData
.
UserClientId
]
_
,
isSet
=
wsSever
.
hub
.
clients
[
conversationData
.
Participant
]
if
isSet
==
true
{
if
isSet
==
true
{
wsSever
.
hub
.
clients
[
conversationData
.
UserClientId
]
.
readMessage
(
toMqData
)
wsSever
.
hub
.
clients
[
conversationData
.
Participant
]
.
readMessage
(
toMqData
)
}
}
SaveMsg
(
toMqData
)
SaveMsg
(
toMqData
)
}
}
...
...
ws_server.go
View file @
0bbe94eb
...
@@ -97,12 +97,6 @@ func ws(w http.ResponseWriter, r *http.Request) {
...
@@ -97,12 +97,6 @@ func ws(w http.ResponseWriter, r *http.Request) {
//接收消息
//接收消息
client
.
OnMessage
(
func
(
msg
*
pool
.
SendMsg
)
{
client
.
OnMessage
(
func
(
msg
*
pool
.
SendMsg
)
{
user
:=
pool
.
GetClientInfoById
(
client
.
Id
)
if
user
.
Promoter
==
"1"
{
msg
.
BusinessId
=
user
.
Source
}
else
if
user
.
Promoter
==
"2"
{
msg
.
GroupId
=
user
.
Source
}
if
msg
.
Status
==
3
{
if
msg
.
Status
==
3
{
fmt
.
Println
(
"OnMessage:收到出错消息=》"
,
client
.
Id
,
msg
.
Desc
)
fmt
.
Println
(
"OnMessage:收到出错消息=》"
,
client
.
Id
,
msg
.
Desc
)
...
@@ -143,24 +137,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
...
@@ -143,24 +137,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
closeMsg
:=
&
pool
.
SetMsgReq
{}
closeMsg
:=
&
pool
.
SetMsgReq
{}
closeMsg
.
ProcedureType
=
5
closeMsg
.
ProcedureType
=
5
closeMsg
.
EndTime
=
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
closeMsg
.
EndTime
=
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
closeMsg
.
Promoter
=
user
.
Promoter
if
user
.
Promoter
==
"1"
{
if
user
.
CustomerType
==
"1"
{
closeMsg
.
Finish
=
"3"
closeMsg
.
Promoter
=
client
.
Id
if
userInfo
.
Source
!=
""
{
closeMsg
.
BusinessId
,
_
=
pool
.
DataAesDecrypt
(
userInfo
.
Source
)
}
closeMsg
.
CustomerId
=
userInfo
.
CustomerId
pool
.
PublishData
(
closeMsg
)
pool
.
PublishData
(
closeMsg
)
fmt
.
Println
(
"用户关闭连接"
,
client
.
Id
)
fmt
.
Println
(
"用户关闭连接"
,
client
.
Id
)
}
}
if
user
.
Promoter
==
"2"
{
if
user
.
CustomerType
==
"2"
{
closeMsg
.
Finish
=
"4"
closeMsg
.
Participant
=
client
.
Id
closeMsg
.
GroupId
=
userInfo
.
Source
closeMsg
.
UserId
=
userInfo
.
CustomerId
pool
.
PublishData
(
closeMsg
)
pool
.
PublishData
(
closeMsg
)
fmt
.
Println
(
"专家关闭连接"
,
client
.
Id
)
fmt
.
Println
(
"专家关闭连接"
,
client
.
Id
)
}
}
...
@@ -182,17 +169,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
...
@@ -182,17 +169,17 @@ func ws(w http.ResponseWriter, r *http.Request) {
func
GetClientList
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
GetClientList
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
data
:=
r
.
URL
.
Query
()
data
:=
r
.
URL
.
Query
()
list
:=
pool
.
GetList
(
data
[
"source"
][
0
],
data
[
"
promoter
"
][
0
])
list
:=
pool
.
GetList
(
data
[
"source"
][
0
],
data
[
"
sourceId"
][
0
],
data
[
"customerType
"
][
0
])
reply
:=
make
([]
string
,
0
)
reply
:=
make
([]
string
,
0
)
for
k
:=
range
list
{
for
k
:=
range
list
{
reply
=
append
(
reply
,
k
)
reply
=
append
(
reply
,
k
)
}
}
resp
(
w
,
reply
)
resp
(
w
,
reply
)
}
}
func
resp
(
w
http
.
ResponseWriter
,
data
interface
{})
{
func
resp
(
w
http
.
ResponseWriter
,
data
interface
{})
{
w
.
Header
()
.
Set
(
"content-type"
,
"text/json"
)
w
.
Header
()
.
Set
(
"content-type"
,
"text/json"
)
w
.
WriteHeader
(
200
)
w
.
WriteHeader
(
200
)
w
.
Write
(
pool
.
SerializeJson
(
data
))
w
.
Write
(
pool
.
SerializeJson
(
data
))
...
...
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