a
This commit is contained in:
@@ -69,12 +69,14 @@ func (c *EventController) TestWebsocket() {
|
||||
userID = c.GetString("userID")
|
||||
clientUser = make(map[string]*websocket.Conn)
|
||||
)
|
||||
if userID == "" {
|
||||
return
|
||||
}
|
||||
//将当前客户端放入map中
|
||||
messageGroups, _ := dao.GetUserMessageGroups(dao.GetDB(), userID)
|
||||
if len(messageGroups) == 0 {
|
||||
return
|
||||
}
|
||||
fmt.Println("11111111111111111111111111111111111111111111111", userID)
|
||||
clientUser[userID] = ws
|
||||
clientsHeart[userID] = ws
|
||||
for _, v := range messageGroups {
|
||||
@@ -114,6 +116,7 @@ func (c *EventController) TestWebsocket() {
|
||||
} else {
|
||||
//接受消息 业务逻辑
|
||||
broadcast <- s
|
||||
if s.GroupID != 0 {
|
||||
//发聊天消息时,这个组所有的成员包括创建者都在userIDs里
|
||||
userIDs := []string{}
|
||||
if results, err := dao.GetMessageGroups(db, "", s.GroupID, 0, true, ""); err == nil {
|
||||
@@ -134,6 +137,7 @@ func (c *EventController) TestWebsocket() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
utils.CallFuncAsync(func() {
|
||||
if s.GroupID != 0 {
|
||||
dao.WrapAddIDCULDEntity(s, "")
|
||||
|
||||
Reference in New Issue
Block a user