getui update

This commit is contained in:
wangchuxiao 2023-03-27 17:56:08 +08:00
parent 1b31a07b40
commit baece7eb3a
3 changed files with 52 additions and 26 deletions

View File

@ -236,6 +236,13 @@ push:
enable: # true or false (bool) enable: # true or false (bool)
channelID: "" channelID: ""
channelName: "" channelName: ""
channel:
HW:
category:
XM:
channelID:
OPPO:
channelID:
fcm: #firebase cloud message 消息推送 fcm: #firebase cloud message 消息推送
serviceAccount: #帐号文件,此处需要改修配置,并且这个文件放在 config目录下 serviceAccount: #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
enable: false enable: false

View File

@ -117,18 +117,35 @@ type Notification struct {
} }
type Options struct { type Options struct {
HW struct { HW *HW `json:"HW"`
DefaultSound bool `json:"/message/android/notification/default_sound"` XM *XM `json:"XM"`
ChannelID string `json:"/message/android/notification/channel_id"` VV *VV `json:"VV"`
Sound string `json:"/message/android/notification/sound"` OP *OP `json:"OP"`
Importance string `json:"/message/android/notification/importance"` HO *HO `json:"HO"`
} `json:"HW"` }
XM struct {
ChannelID string `json:"/extra.channel_id"` type HW struct {
} `json:"XM"` Category string `json:"/message/android/category"`
VV struct { DefaultSound bool `json:"/message/android/notification/default_sound"`
Classification int `json:"/classification"` ChannelID string `json:"/message/android/notification/channel_id"`
} `json:"VV"` Sound string `json:"/message/android/notification/sound"`
Importance string `json:"/message/android/notification/importance"`
}
type XM struct {
ChannelID string `json:"/extra.channel_id"`
}
type VV struct {
Classification int `json:"/classification"`
}
type OP struct {
ChannelID string `json:"/channel_id"`
}
type HO struct {
Importance string `json:"/android/notification/importance"`
} }
type PushResp struct { type PushResp struct {
@ -280,20 +297,11 @@ func (pushReq *PushReq) setPushChannel(title string, body string) {
ClickType: "startapp", ClickType: "startapp",
} }
pushReq.PushChannel.Android.Ups.Options = Options{ pushReq.PushChannel.Android.Ups.Options = Options{
HW: struct { HW: &HW{Category: config.Config.Push.Getui.Channel.HW.Category, ChannelID: "RingRing4", Sound: "/raw/ring001", Importance: "NORMAL"},
DefaultSound bool `json:"/message/android/notification/default_sound"` HO: &HO{Importance: "NORMAL"},
ChannelID string `json:"/message/android/notification/channel_id"` XM: &XM{ChannelID: config.Config.Push.Getui.Channel.XM.ChannelID},
Sound string `json:"/message/android/notification/sound"` OP: &OP{ChannelID: config.Config.Push.Getui.Channel.OPPO.ChannelID},
Importance string `json:"/message/android/notification/importance"` VV: &VV{Classification: 1},
}{ChannelID: "RingRing4", Sound: "/raw/ring001", Importance: "NORMAL"},
XM: struct {
ChannelID string `json:"/extra.channel_id"`
}{ChannelID: "high_system"},
VV: struct {
Classification int "json:\"/classification\""
}{
Classification: 1,
},
} }
} }

View File

@ -210,6 +210,17 @@ type config struct {
MasterSecret string `yaml:"masterSecret"` MasterSecret string `yaml:"masterSecret"`
ChannelID string `yaml:"channelID"` ChannelID string `yaml:"channelID"`
ChannelName string `yaml:"channelName"` ChannelName string `yaml:"channelName"`
Channel struct {
HW struct {
Category string `yaml:"category"`
} `yaml:"HW"`
XM struct {
ChannelID string `yaml:"channelID"`
} `yaml:"XM"`
OPPO struct {
ChannelID string `yaml:"channelID"`
} `yaml:"OPPO"`
} `yaml:"channel"`
} }
Fcm struct { Fcm struct {
ServiceAccount string `yaml:"serviceAccount"` ServiceAccount string `yaml:"serviceAccount"`