加入个推推送服务

This commit is contained in:
xh
2025-08-27 03:15:52 +08:00
parent c9033ddb7f
commit a58c1360d7
5 changed files with 382 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package commonController
import (
"x_admin/core/response"
"x_admin/service/commonService"
"github.com/gin-gonic/gin"
)
func GeTuiRoute(rg *gin.RouterGroup) {
handle := geTuiHandler{}
rg = rg.Group("/common")
rg.GET("/push", handle.push)
}
type geTuiHandler struct{}
// push 推送
func (ih geTuiHandler) push(c *gin.Context) {
var req []commonService.PushMessage
// if err := c.ShouldBindJSON(&req); err != nil {
// response.CheckAndResp(c, err)
// return
// }
// "cid":"ca416f34681c49d2ee14a192c28de537", #华为
// "cid": "43e9228f90aec7b37be97d4c5250829f",# 荣耀
// "cid": "525420466c409f555b5a461d7c981a36",# 小米
req = append(req, commonService.PushMessage{
CID: "ca416f34681c49d2ee14a192c28de537",
RequestID: "",
NotifyID: 0,
Title: "气体报警",
Body: "气体报警",
Payload: nil,
})
res, err := commonService.GeTuiService.PushToSingleBatchCID(req)
response.CheckAndRespWithData(c, res, err)
}