This commit is contained in:
jiangyong27 2024-02-29 21:00:48 +08:00
parent 354b99c47c
commit 0ab848d838
1 changed files with 11 additions and 6 deletions

View File

@ -35,9 +35,11 @@ type GetuiDetail struct {
}
type GetuiMessage struct {
Cid string
Title string
Message string
Cid string
Title string
Message string
NotifyId string
Payload string
}
type Getui struct {
@ -82,10 +84,9 @@ func (g *Getui) Token() string {
params["appkey"] = g.config.AppKey
params["sign"] = util.Sha256(signStr)
reqBody, _ := json.Marshal(params)
rspBody, err := util.HttpPostJson(reqUrl, nil, reqBody)
if err != nil {
log.Errorf("goutil http post error :%s", err.Error())
fmt.Println(string(reqBody))
return ""
}
@ -118,7 +119,9 @@ func (g *Getui) Push(req *GetuiMessage) error {
"title": req.Title,
"body": req.Message,
"channel_level": 4,
"click_type": "startapp",
"click_type": "payload",
"notify_id": cast.ToInt64(req.NotifyId),
"payload": req.Payload,
},
}
params["push_channel"] = map[string]interface{}{
@ -128,6 +131,8 @@ func (g *Getui) Push(req *GetuiMessage) error {
"title": req.Title,
"body": req.Message,
"click_type": "startapp",
"notify_id": cast.ToInt64(req.NotifyId),
"payload": req.Payload,
},
},
},