From 1fffd360547d0d678643c71866b0d1acd4ba16be Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 2 Jun 2022 20:06:14 +0800 Subject: [PATCH] singal offline push --- internal/push/jpush/push.go | 3 ++- internal/push/logic/push_to_client.go | 2 ++ pkg/common/config/config.go | 5 +++++ pkg/common/constant/constant.go | 18 ++++++++++-------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/internal/push/jpush/push.go b/internal/push/jpush/push.go index 01f827753..833174de5 100644 --- a/internal/push/jpush/push.go +++ b/internal/push/jpush/push.go @@ -34,12 +34,12 @@ func (j *JPush) SetAlias(cid, alias string) (resp string, err error) { } func (j *JPush) Push(accounts []string, alert, detailContent, operationID string, opts push.PushOpts) (string, error) { + var pf requestBody.Platform pf.SetAll() var au requestBody.Audience au.SetAlias(accounts) var no requestBody.Notification - no.SetAlert(alert) var extras requestBody.Extras if opts.Signal.ClientMsgID != "" { @@ -47,6 +47,7 @@ func (j *JPush) Push(accounts []string, alert, detailContent, operationID string } no.IOSEnableMutableContent() no.SetExtras(extras) + no.SetAlert(alert) var me requestBody.Message me.SetMsgContent(detailContent) var o requestBody.Options diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index b079c439e..d3d9ab068 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -104,6 +104,8 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { } else { content = constant.ContentType2PushContent[constant.GroupMsg] } + case constant.SignalingNotification: + content = constant.ContentType2PushContent[constant.SignalMsg] default: content = constant.ContentType2PushContent[constant.Common] } diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index d17677781..2b9a4d891 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -419,6 +419,11 @@ type config struct { OfflinePush POfflinePush `yaml:"offlinePush"` DefaultTips PDefaultTips `yaml:"defaultTips"` } `yaml:"joinDepartmentNotification"` + Signal struct { + OfflinePush struct { + Title string `yaml:"title"` + } `yaml:"offlinePush"` + } `yaml:"signal"` } Demo struct { Port []int `yaml:"openImDemoPort"` diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index e27be4d8e..53a4cce38 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -44,6 +44,7 @@ const ( Quote = 114 Common = 200 GroupMsg = 201 + SignalMsg = 202 //SysRelated NotificationBegin = 1000 @@ -212,14 +213,15 @@ const ( ) var ContentType2PushContent = map[int64]string{ - Picture: "[图片]", - Voice: "[语音]", - Video: "[视频]", - File: "[文件]", - Text: "你收到了一条文本消息", - AtText: "[有人@你]", - GroupMsg: "你收到一条群聊消息", - Common: "你收到一条新消息", + Picture: "[图片]", + Voice: "[语音]", + Video: "[视频]", + File: "[文件]", + Text: "你收到了一条文本消息", + AtText: "[有人@你]", + GroupMsg: "你收到一条群聊消息", + Common: "你收到一条新消息", + SignalMsg: "音視頻通話邀請", } const (