长度 ≤ 256字

This commit is contained in:
jiangyong27 2024-05-21 16:48:45 +08:00
parent c1e936c8e5
commit a79e5bdfcd
1 changed files with 6 additions and 0 deletions

View File

@ -114,6 +114,12 @@ func (g *Getui) Token() string {
} }
func (g *Getui) Push(req *GetuiMessage) (*GetuiPushRsp, error) { func (g *Getui) Push(req *GetuiMessage) (*GetuiPushRsp, error) {
if len(req.Title) > 50 {
req.Title = string([]rune(req.Title)[:16])
}
if len(req.Message) > 256 {
req.Message = string([]rune(req.Message)[:80])
}
reqUrl := fmt.Sprintf("https://restapi.getui.com/v2/%s/push/single/cid", g.config.AppId) reqUrl := fmt.Sprintf("https://restapi.getui.com/v2/%s/push/single/cid", g.config.AppId)
params := make(map[string]interface{}) params := make(map[string]interface{})