给全员发送消息
(c *gin.Context)
| 91 | |
| 92 | // 给全员发送消息 |
| 93 | func 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 | } |
nothing calls this directly
no test coverage detected