MCPcopy
hub / github.com/link1st/gowebsocket / SendMessageAll

Function SendMessageAll

controllers/user/user_controller.go:93–122  ·  view source on GitHub ↗

给全员发送消息

(c *gin.Context)

Source from the content-addressed store, hash-verified

91
92// 给全员发送消息
93func SendMessageAll(c *gin.Context) {
94 // 获取参数
95 appIdStr := c.PostForm("appId")
96 userId := c.PostForm("userId")
97 msgId := c.PostForm("msgId")
98 message := c.PostForm("message")
99 appIdUint64, _ := strconv.ParseInt(appIdStr, 10, 32)
100 appId := uint32(appIdUint64)
101
102 fmt.Println("http_request 给全体用户发送消息", appIdStr, userId, msgId, message)
103
104 data := make(map[string]interface{})
105 if cache.SeqDuplicates(msgId) {
106 fmt.Println("给用户发送消息 重复提交:", msgId)
107 controllers.Response(c, common.OK, "", data)
108
109 return
110 }
111
112 sendResults, err := websocket.SendUserMessageAll(appId, userId, msgId, models.MessageCmdMsg, message)
113 if err != nil {
114 data["sendResultsErr"] = err.Error()
115
116 }
117
118 data["sendResults"] = sendResults
119
120 controllers.Response(c, common.OK, "", data)
121
122}

Callers

nothing calls this directly

Calls 3

SeqDuplicatesFunction · 0.92
ResponseFunction · 0.92
SendUserMessageAllFunction · 0.92

Tested by

no test coverage detected