Skip to content

Commit 64a5cca

Browse files
committed
fix: restroe huawei config
1 parent 0f3fee4 commit 64a5cca

5 files changed

Lines changed: 30 additions & 14 deletions

File tree

config/config.example.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ vendors:
9898
teaching:
9999
channel_id: '133203'
100100
template_id: 'P12325'
101+
huawei:
102+
channel_importance: '' # 华为通道重要性,例如 NORMAL/LOW
103+
channel_category: '' # 华为消息分类,需在华为后台申请自分类权益后配置,例如 SERVICE
101104
harmony:
102105
channel_category: 'SUBSCRIPTION' # 鸿蒙消息分类,需在友盟/华为后台申请自分类后配置,例如 SERVICE
103106

config/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ type oppo struct {
158158
} `mapstructure:"private_msg_template"`
159159
}
160160

161+
type huawei struct {
162+
ChannelImportance string `mapstructure:"channel_importance"`
163+
ChannelCategory string `mapstructure:"channel_category"`
164+
}
165+
161166
type harmonyVendor struct {
162167
ChannelCategory string `mapstructure:"channel_category"`
163168
}
@@ -180,6 +185,7 @@ type vendors struct {
180185
XiaomiNotice XiaomiNotice `mapstructure:"xiaomi_notice"`
181186
VivoCategory string `mapstructure:"vivo_category"`
182187
Oppo oppo `mapstructure:"oppo"`
188+
Huawei huawei `mapstructure:"huawei"`
183189
Harmony harmonyVendor `mapstructure:"harmony"`
184190
LocalProperties localProperties `mapstructure:"local_properties"`
185191
}

k8s/config/configmap.yaml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,8 @@ data:
202202
channel_id: ""
203203
template_id: ""
204204
huawei:
205+
channel_importance: ""
206+
channel_category: ""
207+
harmony:
205208
channel_category: ""
206209
---

pkg/umeng/groupcast.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ import (
3535

3636
func getChannelProperties(title, content string) AndroidChannelProperties {
3737
return AndroidChannelProperties{
38-
ChannelActivity: config.Vendors.ChannelActivity,
39-
VivoCategory: config.Vendors.VivoCategory,
40-
OppoChannelID: config.Vendors.Oppo.ChannelID,
41-
OppoCategory: config.Vendors.Oppo.Category,
42-
OppoNotifyLevel: config.Vendors.Oppo.NotifyLevel,
38+
ChannelActivity: config.Vendors.ChannelActivity,
39+
VivoCategory: config.Vendors.VivoCategory,
40+
OppoChannelID: config.Vendors.Oppo.ChannelID,
41+
OppoCategory: config.Vendors.Oppo.Category,
42+
OppoNotifyLevel: config.Vendors.Oppo.NotifyLevel,
43+
HuaweiChannelImportance: config.Vendors.Huawei.ChannelImportance,
44+
HuaweiChannelCategory: config.Vendors.Huawei.ChannelCategory,
4345
OppoPrivateMsgTemplate: OppoPrivateMsgTemplate{
4446
PrivateMsgTemplateID: config.Vendors.Oppo.PrivateMsgTemplate.PrivateMsgTemplateID,
4547
PrivateTitleParameters: OppoPrivateTitleParameters{

pkg/umeng/model.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,17 @@ type AndroidBody struct {
5959
}
6060

6161
type AndroidChannelProperties struct {
62-
ChannelActivity string `json:"channel_activity"`
63-
XiaoMiChannelID string `json:"xiaomi_channel_id"`
64-
XiaoMiExtraProperties *XiaomiExtraProperties `json:"xiaomi_extra_properties,omitempty"`
65-
VivoCategory string `json:"vivo_category"`
66-
OppoChannelID string `json:"oppo_channel_id"`
67-
OppoCategory string `json:"oppo_category"`
68-
OppoNotifyLevel string `json:"oppo_notify_level"`
69-
OppoPrivateMsgTemplate OppoPrivateMsgTemplate `json:"oppo_private_msg_template"`
70-
LocalProperties LocalProperties `json:"local_properties"`
62+
ChannelActivity string `json:"channel_activity"`
63+
XiaoMiChannelID string `json:"xiaomi_channel_id"`
64+
XiaoMiExtraProperties *XiaomiExtraProperties `json:"xiaomi_extra_properties,omitempty"`
65+
VivoCategory string `json:"vivo_category"`
66+
OppoChannelID string `json:"oppo_channel_id"`
67+
OppoCategory string `json:"oppo_category"`
68+
OppoNotifyLevel string `json:"oppo_notify_level"`
69+
HuaweiChannelImportance string `json:"huawei_channel_importance"`
70+
HuaweiChannelCategory string `json:"huawei_channel_category"`
71+
OppoPrivateMsgTemplate OppoPrivateMsgTemplate `json:"oppo_private_msg_template"`
72+
LocalProperties LocalProperties `json:"local_properties"`
7173
}
7274

7375
// HarmonyGroupcastMessage 鸿蒙广播消息结构

0 commit comments

Comments
 (0)