feat(jpush): add vendor-specific message classification support for push notifications
All checks were successful
Build Backend / build (push) Successful in 3m4s
Build Backend / build-docker (push) Successful in 1m15s

- 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:
lafay
2026-06-18 19:41:32 +08:00
parent 5b83f98fb8
commit 821e066446
13 changed files with 637 additions and 66 deletions

View File

@@ -317,7 +317,7 @@ func (s *pushServiceImpl) pushViaJPush(ctx context.Context, device *model.Device
}
payload := s.buildPayload(params)
_, err := s.jpushClient.PushByRegistrationIDs([]string{device.PushToken}, payload.Notification, payload.TPC)
_, err := s.jpushClient.PushByRegistrationIDs([]string{device.PushToken}, payload.Notification, payload.Classification, payload.TPC)
if err != nil {
return fmt.Errorf("jpush push failed: %w", err)
}
@@ -373,7 +373,7 @@ func (s *pushServiceImpl) pushViaJPushBatch(devices []*model.DeviceToken, params
}
payload := s.buildPayload(params)
_, err := s.jpushClient.PushByRegistrationIDs(regIDs, payload.Notification, payload.TPC)
_, err := s.jpushClient.PushByRegistrationIDs(regIDs, payload.Notification, payload.Classification, payload.TPC)
if err != nil {
return fmt.Errorf("jpush batch push failed: %w", err)
}
@@ -819,7 +819,9 @@ func (s *pushServiceImpl) PushChatMessage(ctx context.Context, userID string, co
largeIcon = groupAvatar
}
params := vendor.MessageParams{
Scene: s.resolveChannelScene(message),
// PushChatMessage 处理的是会话上下文内的消息(含群内通知),
// 统一走 chat channel保证会话内通知体验一致
Scene: vendor.SceneChat,
Title: title,
Body: content,
SenderName: sender.Name,
@@ -831,7 +833,7 @@ func (s *pushServiceImpl) PushChatMessage(ctx context.Context, userID string, co
Extra: extras,
}
payload := s.buildPayload(params)
if _, pushErr := s.jpushClient.PushByRegistrationIDs(regIDs, payload.Notification, payload.TPC); pushErr != nil {
if _, pushErr := s.jpushClient.PushByRegistrationIDs(regIDs, payload.Notification, payload.Classification, payload.TPC); pushErr != nil {
zap.L().Error("jpush push chat message failed",
zap.String("userID", userID),
zap.String("conversationID", conversationID),
@@ -932,6 +934,7 @@ func (s *pushServiceImpl) PushSystemNotification(ctx context.Context, userID str
return ids
}(),
payload.Notification,
payload.Classification,
payload.TPC,
)
if pushErr == nil {