2026-04-27 23:20:24 +08:00
|
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
|
|
type JPushConfig struct {
|
2026-06-17 20:41:55 +08:00
|
|
|
|
Enabled bool `mapstructure:"enabled"`
|
|
|
|
|
|
AppKey string `mapstructure:"app_key"`
|
|
|
|
|
|
MasterSecret string `mapstructure:"master_secret"`
|
|
|
|
|
|
Production bool `mapstructure:"production"`
|
|
|
|
|
|
// Channel 厂商通道 channel_id 配置
|
|
|
|
|
|
// 通过 options.third_party_channel 下发到各厂商(小米/华为/OPPO 等)
|
|
|
|
|
|
Channel ChannelConfig `mapstructure:"channel"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ChannelConfig 厂商通道 channel_id 配置
|
|
|
|
|
|
// 区分「系统消息」与「私聊/群聊消息」两类 channel
|
|
|
|
|
|
type ChannelConfig struct {
|
|
|
|
|
|
// System 系统消息/通知默认 channel_id,未单独配置 Vendor 时各厂商共用
|
|
|
|
|
|
System string `mapstructure:"system"`
|
|
|
|
|
|
// Chat 私聊/群聊消息默认 channel_id,未单独配置 Vendor 时各厂商共用
|
|
|
|
|
|
Chat string `mapstructure:"chat"`
|
|
|
|
|
|
// Vendor 各厂商 channel_id 覆盖配置(留空则回退到 System/Chat)
|
|
|
|
|
|
Vendor VendorChannel `mapstructure:"vendor"`
|
|
|
|
|
|
// iOS APNs 通知场景区分配置(按 thread-id 分组)
|
|
|
|
|
|
IOS IOSChannelConfig `mapstructure:"ios"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// IOSChannelConfig iOS APNs 通知场景区分配置
|
|
|
|
|
|
// iOS 走 APNs 无 channel_id 概念,通过 thread-id 实现通知分组
|
|
|
|
|
|
type IOSChannelConfig struct {
|
|
|
|
|
|
// ChatThreadID 私聊/群聊消息通知分组 thread-id
|
|
|
|
|
|
ChatThreadID string `mapstructure:"chat_thread_id"`
|
|
|
|
|
|
// SystemThreadID 系统消息/通知分组 thread-id
|
|
|
|
|
|
SystemThreadID string `mapstructure:"system_thread_id"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VendorChannel 各厂商通道 channel_id 覆盖
|
|
|
|
|
|
// 每个厂商区分 System(系统消息)与 Chat(私聊消息)两个 channel_id
|
|
|
|
|
|
type VendorChannel struct {
|
|
|
|
|
|
Xiaomi VendorChannelID `mapstructure:"xiaomi"`
|
|
|
|
|
|
Huawei VendorChannelID `mapstructure:"huawei"`
|
|
|
|
|
|
OPPO VendorChannelID `mapstructure:"oppo"`
|
|
|
|
|
|
VIVO VendorChannelID `mapstructure:"vivo"`
|
|
|
|
|
|
Meizu VendorChannelID `mapstructure:"meizu"`
|
|
|
|
|
|
Honor VendorChannelID `mapstructure:"honor"`
|
|
|
|
|
|
FCM VendorChannelID `mapstructure:"fcm"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VendorChannelID 单个厂商的两类 channel 配置
|
|
|
|
|
|
// 每个 channel 可携带厂商私有模板配置(如小米 mi_template_id、OPPO private_msg_template_id)
|
|
|
|
|
|
type VendorChannelID struct {
|
|
|
|
|
|
// channel_id
|
|
|
|
|
|
System string `mapstructure:"system"`
|
|
|
|
|
|
Chat string `mapstructure:"chat"`
|
|
|
|
|
|
|
|
|
|
|
|
// 小米消息模板(可选,配置后私信消息下发时携带 channel_id 及 mi_template_id)
|
|
|
|
|
|
// 见:小米关于消息模板推送新规的更新通知
|
|
|
|
|
|
MiSystemTemplateID string `mapstructure:"mi_system_template_id"` // 系统消息模板 id
|
|
|
|
|
|
MiChatTemplateID string `mapstructure:"mi_chat_template_id"` // 私聊消息模板 id
|
|
|
|
|
|
|
|
|
|
|
|
// OPPO 私信模板(可选,仅 OPPO 厂商,配置后下发私信时携带)
|
|
|
|
|
|
// 见:OPUSH 私信模版校验能力接入说明
|
|
|
|
|
|
OppoSystemPrivateTemplateID string `mapstructure:"oppo_system_private_template_id"` // 系统消息私信模板 id
|
|
|
|
|
|
OppoChatPrivateTemplateID string `mapstructure:"oppo_chat_private_template_id"` // 私聊消息私信模板 id
|
|
|
|
|
|
}
|