feat(push): add JPush integration for offline message push
Some checks failed
Build Backend / build-docker (push) Has been cancelled
Build Backend / build (push) Has been cancelled

Add JPush (极光推送) integration to enable push notifications for offline users. This includes:
- New jpush client package with API for batch push notifications
- Configuration for jpush (enabled, app_key, master_secret, production mode)
- Updated push service to send messages via JPush when users are offline
- Added PushChatMessage method with do-not-disturb checking
- Integrated push service with chat service to notify offline users of new messages
- Updated deployment workflow with JPush and related environment variables
This commit is contained in:
lafay
2026-04-27 23:20:24 +08:00
parent f03bbf6faa
commit fb85c9c20a
18 changed files with 919 additions and 66 deletions

View File

@@ -8,6 +8,7 @@ import (
"with_you/internal/grpc/runner"
"with_you/internal/pkg/email"
"with_you/internal/pkg/hook"
"with_you/internal/pkg/jpush"
"with_you/internal/pkg/openai"
"with_you/internal/pkg/redis"
"with_you/internal/pkg/s3"
@@ -105,8 +106,9 @@ func ProvidePushService(
deviceTokenRepo repository.DeviceTokenRepository,
messageRepo repository.MessageRepository,
wsHub *ws.Hub,
jpushClient *jpush.Client,
) service.PushService {
return service.NewPushService(pushRepo, deviceTokenRepo, messageRepo, wsHub)
return service.NewPushService(pushRepo, deviceTokenRepo, messageRepo, wsHub, jpushClient)
}
// ProvideSystemMessageService 提供系统消息服务
@@ -206,8 +208,9 @@ func ProvideChatService(
wsHub *ws.Hub,
cacheBackend cache.Cache,
uploadService *service.UploadService,
pushService service.PushService,
) service.ChatService {
return service.NewChatService(messageRepo, userRepo, nil, wsHub, cacheBackend, uploadService)
return service.NewChatService(messageRepo, userRepo, nil, wsHub, cacheBackend, uploadService, pushService)
}
// ProvideScheduleService 提供日程服务