feat(jpush): add vendor-specific message classification support for push notifications
- Add OPPO category/notify_level support (2024.11.20 regulation: category required when notify_level present) - Add Honor importance field (NORMAL=service/LOW=marketing) for notification classification - Add vivo category field (IM/ACCOUNT) for message scenario identification - Set Xiaomi channel/template defaults in code (system=153609, chat=153608, templates P10761/M10289) - Add classification option to JPush push payloads (0=operation, 1=system) - Update xiaomi template keywords mapping to match actual template placeholders - Add keyword search support for GetFollowers and GetFollowing endpoints - Bind new config fields to environment variables for OPPO/Honor/vivo
This commit is contained in:
25
internal/pkg/jpush/vendor/params.go
vendored
25
internal/pkg/jpush/vendor/params.go
vendored
@@ -47,12 +47,24 @@ type MessageParams struct {
|
||||
Extra map[string]any
|
||||
}
|
||||
|
||||
// 消息分类常量(对应 JPush options.classification)
|
||||
const (
|
||||
// ClassificationOperation 运营消息(0):营销/公告类,受厂商限速
|
||||
ClassificationOperation = 0
|
||||
// ClassificationSystem 系统消息(1):即时聊天/系统通知/互动通知,高优先级及时送达
|
||||
// 注:聊天即时消息也归为系统消息,避免被厂商运营消息限速影响送达
|
||||
ClassificationSystem = 1
|
||||
)
|
||||
|
||||
// PushPayload 工厂统一产物,client 据此组装最终推送 payload
|
||||
type PushPayload struct {
|
||||
// Notification 含 android + ios,由 TextRenderer 产出
|
||||
Notification *jpush.Notification
|
||||
// TPC 各厂商私有字段(options.third_party_channel),由 PrivateConverter 产出
|
||||
TPC *jpush.ThirdPartyChannel
|
||||
// Classification 消息分类(options.classification):0=运营消息,1=系统消息
|
||||
// 聊天和系统通知统一用 1,避免厂商运营消息限速
|
||||
Classification int
|
||||
}
|
||||
|
||||
// TextRenderer 通用文本渲染器(基础层)
|
||||
@@ -124,7 +136,16 @@ func (f *Factory) Build(params MessageParams, cfg config.ChannelConfig) *PushPay
|
||||
}
|
||||
|
||||
return &PushPayload{
|
||||
Notification: notification,
|
||||
TPC: tpc.Normalize(),
|
||||
Notification: notification,
|
||||
TPC: tpc.Normalize(),
|
||||
Classification: resolveClassification(params.Scene),
|
||||
}
|
||||
}
|
||||
|
||||
// resolveClassification 根据场景映射 JPush options.classification
|
||||
// 聊天即时消息与系统通知统一归为系统消息(1),避免厂商运营消息限速影响送达
|
||||
// 未来若引入营销/公告推送可扩展为运营消息(0)
|
||||
func resolveClassification(scene string) int {
|
||||
// system 与 chat 场景均使用系统消息分类
|
||||
return ClassificationSystem
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user