@@ -18,6 +18,16 @@ import (
1818 "fmt"
1919
2020 "github.com/openimsdk/open-im-server/v3/pkg/common/config"
21+ "github.com/openimsdk/tools/utils/datautil"
22+ )
23+
24+ var (
25+ incOne = datautil .ToPtr ("+1" )
26+ addNum = "1"
27+ defaultStrategy = strategy {
28+ Default : 1 ,
29+ }
30+ msgCategory = "CATEGORY_MESSAGE"
2131)
2232
2333type Resp struct {
@@ -58,7 +68,24 @@ type TaskResp struct {
5868}
5969
6070type Settings struct {
61- TTL * int64 `json:"ttl"`
71+ TTL * int64 `json:"ttl"`
72+ Strategy strategy `json:"strategy"`
73+ }
74+
75+ type strategy struct {
76+ Default int64 `json:"default"`
77+ //IOS int64 `json:"ios"`
78+ //St int64 `json:"st"`
79+ //Hw int64 `json:"hw"`
80+ //Ho int64 `json:"ho"`
81+ //XM int64 `json:"xm"`
82+ //XMG int64 `json:"xmg"`
83+ //VV int64 `json:"vv"`
84+ //Op int64 `json:"op"`
85+ //OpG int64 `json:"opg"`
86+ //MZ int64 `json:"mz"`
87+ //HosHw int64 `json:"hoshw"`
88+ //WX int64 `json:"wx"`
6289}
6390
6491type Audience struct {
@@ -112,6 +139,8 @@ type Notification struct {
112139 ChannelID string `json:"channelID"`
113140 ChannelName string `json:"ChannelName"`
114141 ClickType string `json:"click_type"`
142+ BadgeAddNum string `json:"badge_add_num"`
143+ Category string `json:"category"`
115144}
116145
117146type Options struct {
@@ -120,6 +149,7 @@ type Options struct {
120149 ChannelID string `json:"/message/android/notification/channel_id"`
121150 Sound string `json:"/message/android/notification/sound"`
122151 Importance string `json:"/message/android/notification/importance"`
152+ Category string `json:"/message/android/category"`
123153 } `json:"HW"`
124154 XM struct {
125155 ChannelID string `json:"/extra.channel_id"`
@@ -140,6 +170,8 @@ func newPushReq(pushConf *config.Push, title, content string) PushReq {
140170 ClickType : "startapp" ,
141171 ChannelID : pushConf .GeTui .ChannelID ,
142172 ChannelName : pushConf .GeTui .ChannelName ,
173+ BadgeAddNum : addNum ,
174+ Category : msgCategory ,
143175 }}}
144176 return pushReq
145177}
@@ -156,6 +188,7 @@ func (pushReq *PushReq) setPushChannel(title string, body string) {
156188 notify := "notify"
157189 pushReq .PushChannel .Ios .NotificationType = & notify
158190 pushReq .PushChannel .Ios .Aps .Sound = "default"
191+ pushReq .PushChannel .Ios .AutoBadge = incOne
159192 pushReq .PushChannel .Ios .Aps .Alert = Alert {
160193 Title : title ,
161194 Body : body ,
@@ -172,7 +205,8 @@ func (pushReq *PushReq) setPushChannel(title string, body string) {
172205 ChannelID string `json:"/message/android/notification/channel_id"`
173206 Sound string `json:"/message/android/notification/sound"`
174207 Importance string `json:"/message/android/notification/importance"`
175- }{ChannelID : "RingRing4" , Sound : "/raw/ring001" , Importance : "NORMAL" },
208+ Category string `json:"/message/android/category"`
209+ }{ChannelID : "RingRing4" , Sound : "/raw/ring001" , Importance : "NORMAL" , Category : "IM" },
176210 XM : struct {
177211 ChannelID string `json:"/extra.channel_id"`
178212 }{ChannelID : "high_system" },
0 commit comments