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
|
2026-06-18 19:41:32 +08:00
|
|
|
|
|
|
|
|
|
|
// OPPO 消息分类(可选,2024.11.20 新规)
|
|
|
|
|
|
// category 消息场景标识,使用 notify_level 时必传;notify_level 提醒等级
|
|
|
|
|
|
// 取值:category 如 IM/ACCOUNT;notify_level 1=通知栏, 2=通知栏+锁屏, 16=通知栏+锁屏+横幅+震动+铃声
|
|
|
|
|
|
OppoSystemCategory string `mapstructure:"oppo_system_category"` // 系统消息 category(如 ACCOUNT)
|
|
|
|
|
|
OppoChatCategory string `mapstructure:"oppo_chat_category"` // 私聊消息 category(如 IM)
|
|
|
|
|
|
OppoSystemNotifyLevel int `mapstructure:"oppo_system_notify_level"` // 系统消息提醒等级(如 2)
|
|
|
|
|
|
OppoChatNotifyLevel int `mapstructure:"oppo_chat_notify_level"` // 私聊消息提醒等级(如 16)
|
|
|
|
|
|
|
|
|
|
|
|
// 荣耀通知栏消息智能分类(可选,importance 字段)
|
|
|
|
|
|
// 取值:"NORMAL"=服务与通讯,"LOW"=资讯营销
|
|
|
|
|
|
// 注:classification 优先级更高,会覆盖 importance 设置的值
|
|
|
|
|
|
HonorSystemImportance string `mapstructure:"honor_system_importance"` // 系统消息 importance(如 LOW)
|
|
|
|
|
|
HonorChatImportance string `mapstructure:"honor_chat_importance"` // 私聊消息 importance(如 NORMAL)
|
|
|
|
|
|
|
|
|
|
|
|
// vivo 厂商消息场景标识(可选,category 字段)
|
|
|
|
|
|
// 用于标识消息类型,确定提醒方式;classification=1 时 category 必须为系统消息类
|
|
|
|
|
|
// 不携带 category 会默认按运营消息下发,受频控限制
|
|
|
|
|
|
VivoSystemCategory string `mapstructure:"vivo_system_category"` // 系统消息 category(如 ACCOUNT 账号动态)
|
|
|
|
|
|
VivoChatCategory string `mapstructure:"vivo_chat_category"` // 私聊消息 category(如 IM 即时通讯)
|
2026-06-17 20:41:55 +08:00
|
|
|
|
}
|