fix: ws 消息格式统一

This commit is contained in:
TsMask
2024-01-24 14:10:23 +08:00
parent 0210d28cdb
commit 3135ff5b85
2 changed files with 22 additions and 12 deletions

View File

@@ -82,17 +82,23 @@ func (s *WSController) Test(c *gin.Context) {
return
}
// err = s.wsSendService.ByClientID(c.Query("clientId"), loginUser)
// if err != nil {
// c.JSON(200, result.ErrMsg(err.Error()))
// return
// }
errMsgArr := []string{}
err = s.wsSendService.ByGroupID(c.Query("groupID"), loginUser)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
return
clientId := c.Query("clientId")
if clientId != "" {
err := s.wsSendService.ByClientID(c.Query("clientId"), loginUser)
if err != nil {
errMsgArr = append(errMsgArr, "clientId: "+err.Error())
}
}
c.JSON(200, result.Ok(nil))
groupID := c.Query("groupID")
if groupID != "" {
err := s.wsSendService.ByGroupID(c.Query("groupID"), loginUser)
if err != nil {
errMsgArr = append(errMsgArr, "groupID: "+err.Error())
}
}
c.JSON(200, result.OkData(errMsgArr))
}