mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-06 02:23:10 +08:00
notification
This commit is contained in:
parent
f6cebdbdef
commit
0071252777
@ -10,10 +10,6 @@ groupCreated:
|
|||||||
# 加消息contentType,老的作为通知的 content统一json 结构体使用pb的
|
# 加消息contentType,老的作为通知的 content统一json 结构体使用pb的
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
groupInfoSet:
|
groupInfoSet:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 3
|
reliabilityLevel: 3
|
||||||
@ -199,155 +195,113 @@ groupMemberInfoSet:
|
|||||||
|
|
||||||
|
|
||||||
#############################friend#################################
|
#############################friend#################################
|
||||||
|
|
||||||
friendApplicationAdded:
|
friendApplicationAdded:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: false
|
||||||
title: "Somebody applies to add you as a friend"
|
title: "Somebody applies to add you as a friend"
|
||||||
desc: "Somebody applies to add you as a friend"
|
desc: "Somebody applies to add you as a friend"
|
||||||
ext: "Somebody applies to add you as a friend"
|
ext: "Somebody applies to add you as a friend"
|
||||||
defaultTips:
|
|
||||||
tips: "I applies to add you as a friend" #
|
|
||||||
|
|
||||||
friendApplicationApproved:
|
friendApplicationApproved:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "Someone applies to add your friend application"
|
title: "Someone applies to add your friend application"
|
||||||
desc: "Someone applies to add your friend application"
|
desc: "Someone applies to add your friend application"
|
||||||
ext: "Someone applies to add your friend application"
|
ext: "Someone applies to add your friend application"
|
||||||
defaultTips:
|
|
||||||
tips: "I applies to add your friend application" #
|
|
||||||
|
|
||||||
|
|
||||||
friendApplicationRejected:
|
friendApplicationRejected:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "Someone rejected your friend application"
|
title: "Someone rejected your friend application"
|
||||||
desc: "Someone rejected your friend application"
|
desc: "Someone rejected your friend application"
|
||||||
ext: "Someone rejected your friend application"
|
ext: "Someone rejected your friend application"
|
||||||
defaultTips:
|
|
||||||
tips: "I rejected your friend application" #
|
|
||||||
|
|
||||||
friendAdded:
|
friendAdded:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 3
|
unreadCount: false
|
||||||
unreadCount: true
|
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "We have become friends"
|
title: "We have become friends"
|
||||||
desc: "We have become friends"
|
desc: "We have become friends"
|
||||||
ext: "We have become friends"
|
ext: "We have become friends"
|
||||||
defaultTips:
|
|
||||||
tips: "We have become friends" #
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
friendDeleted:
|
friendDeleted:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "deleted a friend"
|
title: "deleted a friend"
|
||||||
desc: "deleted a friend"
|
desc: "deleted a friend"
|
||||||
ext: "deleted a friend"
|
ext: "deleted a friend"
|
||||||
defaultTips:
|
|
||||||
tips: "deleted a friend" #
|
|
||||||
|
|
||||||
|
|
||||||
friendRemarkSet:
|
friendRemarkSet:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "Your friend's profile has been changed"
|
title: "Your friend's profile has been changed"
|
||||||
desc: "Your friend's profile has been changed"
|
desc: "Your friend's profile has been changed"
|
||||||
ext: "Your friend's profile has been changed"
|
ext: "Your friend's profile has been changed"
|
||||||
defaultTips:
|
|
||||||
tips: "Your friend's profile has been changed" #
|
|
||||||
|
|
||||||
blackAdded:
|
blackAdded:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "blocked a user"
|
title: "blocked a user"
|
||||||
desc: "blocked a user"
|
desc: "blocked a user"
|
||||||
ext: "blocked a user"
|
ext: "blocked a user"
|
||||||
defaultTips:
|
|
||||||
tips: "blocked a user" #
|
|
||||||
|
|
||||||
blackDeleted:
|
blackDeleted:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "Remove a blocked user"
|
title: "Remove a blocked user"
|
||||||
desc: "Remove a blocked user"
|
desc: "Remove a blocked user"
|
||||||
ext: "Remove a blocked user"
|
ext: "Remove a blocked user"
|
||||||
defaultTips:
|
|
||||||
tips: "Remove a blocked user"
|
|
||||||
|
|
||||||
friendInfoUpdated:
|
friendInfoUpdated:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "friend info updated"
|
title: "friend info updated"
|
||||||
desc: "friend info updated"
|
desc: "friend info updated"
|
||||||
ext: "friend info updated"
|
ext: "friend info updated"
|
||||||
defaultTips:
|
|
||||||
tips: "friend info updated"
|
|
||||||
|
|
||||||
#####################user#########################
|
#####################user#########################
|
||||||
userInfoUpdated:
|
userInfoUpdated:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 2
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "Remove a blocked user"
|
title: "Remove a blocked user"
|
||||||
desc: "Remove a blocked user"
|
desc: "Remove a blocked user"
|
||||||
ext: "Remove a blocked user"
|
ext: "Remove a blocked user"
|
||||||
defaultTips:
|
|
||||||
tips: "remove a blocked user"
|
|
||||||
|
|
||||||
#####################conversation#########################
|
#####################conversation#########################
|
||||||
conversationOptUpdate:
|
conversationOptUpdate:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 1
|
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "conversation opt update"
|
title: "conversation opt update"
|
||||||
desc: "conversation opt update"
|
desc: "conversation opt update"
|
||||||
ext: "conversation opt update"
|
ext: "conversation opt update"
|
||||||
defaultTips:
|
|
||||||
tips: "conversation opt update"
|
|
||||||
|
|
||||||
conversationSetPrivate:
|
conversationSetPrivate:
|
||||||
conversation:
|
isSendMsg: true
|
||||||
reliabilityLevel: 3
|
unreadCount: false
|
||||||
unreadCount: true
|
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
enable: true
|
||||||
title: "burn after reading"
|
title: "burn after reading"
|
||||||
desc: "burn after reading"
|
desc: "burn after reading"
|
||||||
ext: "burn after reading"
|
ext: "burn after reading"
|
||||||
defaultTips:
|
|
||||||
openTips: "burn after reading was opened"
|
|
||||||
closeTips: "burn after reading was closed"
|
|
||||||
|
|
||||||
|
@ -39,22 +39,19 @@ type CallBackConfig struct {
|
|||||||
CallbackFailedContinue *bool `yaml:"callbackFailedContinue"`
|
CallbackFailedContinue *bool `yaml:"callbackFailedContinue"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PConversation struct {
|
type NotificationConf struct {
|
||||||
ReliabilityLevel int `yaml:"reliabilityLevel"`
|
IsSendMsg bool `yaml:"isSendMsg"`
|
||||||
UnreadCount bool `yaml:"unreadCount"`
|
UnreadCount bool `yaml:"unreadCount"`
|
||||||
|
OfflinePush POfflinePush `yaml:"offlinePush"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type POfflinePush struct {
|
type POfflinePush struct {
|
||||||
PushSwitch bool `yaml:"switch"`
|
Enable bool `yaml:"enable"`
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
Desc string `yaml:"desc"`
|
Desc string `yaml:"desc"`
|
||||||
Ext string `yaml:"ext"`
|
Ext string `yaml:"ext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PDefaultTips struct {
|
|
||||||
Tips string `yaml:"tips"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
ServerIP string `yaml:"serverip"`
|
ServerIP string `yaml:"serverip"`
|
||||||
|
|
||||||
@ -320,181 +317,39 @@ type config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
GroupCreated struct {
|
GroupCreated NotificationConf `yaml:"groupCreated"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
GroupInfoSet NotificationConf `yaml:"groupInfoSet"`
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
JoinGroupApplication NotificationConf `yaml:"joinGroupApplication"`
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
MemberQuit NotificationConf `yaml:"memberQuit"`
|
||||||
} `yaml:"groupCreated"`
|
GroupApplicationAccepted NotificationConf `yaml:"groupApplicationAccepted"`
|
||||||
|
GroupApplicationRejected NotificationConf `yaml:"groupApplicationRejected"`
|
||||||
GroupInfoSet struct {
|
GroupOwnerTransferred NotificationConf `yaml:"groupOwnerTransferred"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
MemberKicked NotificationConf `yaml:"memberKicked"`
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
MemberInvited NotificationConf `yaml:"memberInvited"`
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
MemberEnter NotificationConf `yaml:"memberEnter"`
|
||||||
} `yaml:"groupInfoSet"`
|
GroupDismissed NotificationConf `yaml:"groupDismissed"`
|
||||||
|
GroupMuted NotificationConf `yaml:"groupMuted"`
|
||||||
JoinGroupApplication struct {
|
GroupCancelMuted NotificationConf `yaml:"groupCancelMuted"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
GroupMemberMuted NotificationConf `yaml:"groupMemberMuted"`
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
GroupMemberCancelMuted NotificationConf `yaml:"groupMemberCancelMuted"`
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
GroupMemberInfoSet NotificationConf `yaml:"groupMemberInfoSet"`
|
||||||
} `yaml:"joinGroupApplication"`
|
GroupMemberSetToAdmin NotificationConf `yaml:"groupMemberSetToAdmin"`
|
||||||
|
GroupMemberSetToOrdinary NotificationConf `yaml:"groupMemberSetToOrdinaryUser"`
|
||||||
MemberQuit struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"memberQuit"`
|
|
||||||
|
|
||||||
GroupApplicationAccepted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupApplicationAccepted"`
|
|
||||||
|
|
||||||
GroupApplicationRejected struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupApplicationRejected"`
|
|
||||||
|
|
||||||
GroupOwnerTransferred struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupOwnerTransferred"`
|
|
||||||
|
|
||||||
MemberKicked struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"memberKicked"`
|
|
||||||
|
|
||||||
MemberInvited struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"memberInvited"`
|
|
||||||
|
|
||||||
MemberEnter struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"memberEnter"`
|
|
||||||
|
|
||||||
GroupDismissed struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupDismissed"`
|
|
||||||
|
|
||||||
GroupMuted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMuted"`
|
|
||||||
|
|
||||||
GroupCancelMuted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupCancelMuted"`
|
|
||||||
|
|
||||||
GroupMemberMuted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMemberMuted"`
|
|
||||||
|
|
||||||
GroupMemberCancelMuted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMemberCancelMuted"`
|
|
||||||
GroupMemberInfoSet struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMemberInfoSet"`
|
|
||||||
GroupMemberSetToAdmin struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMemberSetToAdmin"`
|
|
||||||
GroupMemberSetToOrdinary struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"groupMemberSetToOrdinaryUser"`
|
|
||||||
|
|
||||||
////////////////////////user///////////////////////
|
////////////////////////user///////////////////////
|
||||||
UserInfoUpdated struct {
|
UserInfoUpdated NotificationConf `yaml:"userInfoUpdated"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"userInfoUpdated"`
|
|
||||||
|
|
||||||
//////////////////////friend///////////////////////
|
//////////////////////friend///////////////////////
|
||||||
FriendApplication struct {
|
FriendApplication NotificationConf `yaml:"friendApplicationAdded"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
FriendApplicationApproved NotificationConf `yaml:"friendApplicationApproved"`
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
FriendApplicationRejected NotificationConf `yaml:"friendApplicationRejected"`
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
FriendAdded NotificationConf `yaml:"friendAdded"`
|
||||||
} `yaml:"friendApplicationAdded"`
|
FriendDeleted NotificationConf `yaml:"friendDeleted"`
|
||||||
FriendApplicationApproved struct {
|
FriendRemarkSet NotificationConf `yaml:"friendRemarkSet"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
BlackAdded NotificationConf `yaml:"blackAdded"`
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
BlackDeleted NotificationConf `yaml:"blackDeleted"`
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
FriendInfoUpdated NotificationConf `yaml:"friendInfoUpdated"`
|
||||||
} `yaml:"friendApplicationApproved"`
|
//////////////////////conversation///////////////////////
|
||||||
|
ConversationOptUpdate NotificationConf `yaml:"conversationOptUpdate"`
|
||||||
FriendApplicationRejected struct {
|
ConversationSetPrivate NotificationConf `yaml:"conversationSetPrivate"`
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"friendApplicationRejected"`
|
|
||||||
|
|
||||||
FriendAdded struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"friendAdded"`
|
|
||||||
|
|
||||||
FriendDeleted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"friendDeleted"`
|
|
||||||
FriendRemarkSet struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"friendRemarkSet"`
|
|
||||||
BlackAdded struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"blackAdded"`
|
|
||||||
BlackDeleted struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"blackDeleted"`
|
|
||||||
FriendInfoUpdated struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"friendInfoUpdated"`
|
|
||||||
|
|
||||||
ConversationOptUpdate struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips PDefaultTips `yaml:"defaultTips"`
|
|
||||||
} `yaml:"conversationOptUpdate"`
|
|
||||||
ConversationSetPrivate struct {
|
|
||||||
Conversation PConversation `yaml:"conversation"`
|
|
||||||
OfflinePush POfflinePush `yaml:"offlinePush"`
|
|
||||||
DefaultTips struct {
|
|
||||||
OpenTips string `yaml:"openTips"`
|
|
||||||
CloseTips string `yaml:"closeTips"`
|
|
||||||
} `yaml:"defaultTips"`
|
|
||||||
} `yaml:"conversationSetPrivate"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) unmarshalConfig(config interface{}, configPath string) error {
|
func (c *config) unmarshalConfig(config interface{}, configPath string) error {
|
||||||
|
@ -275,11 +275,6 @@ const CheckKey = "CheckKey"
|
|||||||
const TriggerID = "triggerID"
|
const TriggerID = "triggerID"
|
||||||
const RemoteAddr = "remoteAddr"
|
const RemoteAddr = "remoteAddr"
|
||||||
|
|
||||||
const (
|
|
||||||
UnreliableNotification = 1
|
|
||||||
ReliableNotificationNoMsg = 2
|
|
||||||
ReliableNotificationMsg = 3
|
|
||||||
)
|
|
||||||
const (
|
const (
|
||||||
BecomeFriendByImport = 1 //管理员导入
|
BecomeFriendByImport = 1 //管理员导入
|
||||||
BecomeFriendByApply = 2 //申请添加
|
BecomeFriendByApply = 2 //申请添加
|
||||||
|
@ -22,10 +22,6 @@ func (m *MetaClient) getConn() (*grpc.ClientConn, error) {
|
|||||||
return m.client.GetConn(m.rpcRegisterName)
|
return m.client.GetConn(m.rpcRegisterName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MetaClient) getRpcRegisterName() string {
|
|
||||||
return m.rpcRegisterName
|
|
||||||
}
|
|
||||||
|
|
||||||
type NotificationMsg struct {
|
type NotificationMsg struct {
|
||||||
SendID string
|
SendID string
|
||||||
RecvID string
|
RecvID string
|
||||||
|
@ -52,8 +52,7 @@ func (c *MsgClient) Notification(ctx context.Context, notificationMsg *Notificat
|
|||||||
var msg sdkws.MsgData
|
var msg sdkws.MsgData
|
||||||
var offlineInfo sdkws.OfflinePushInfo
|
var offlineInfo sdkws.OfflinePushInfo
|
||||||
var title, desc, ex string
|
var title, desc, ex string
|
||||||
var pushSwitch, unReadCount bool
|
var pushEnable, unReadCount bool
|
||||||
var reliabilityLevel int
|
|
||||||
msg.SendID = notificationMsg.SendID
|
msg.SendID = notificationMsg.SendID
|
||||||
msg.RecvID = notificationMsg.RecvID
|
msg.RecvID = notificationMsg.RecvID
|
||||||
msg.Content = notificationMsg.Content
|
msg.Content = notificationMsg.Content
|
||||||
@ -74,227 +73,124 @@ func (c *MsgClient) Notification(ctx context.Context, notificationMsg *Notificat
|
|||||||
offlineInfo.IOSPushSound = config.Config.IOSPush.PushSound
|
offlineInfo.IOSPushSound = config.Config.IOSPush.PushSound
|
||||||
switch msg.ContentType {
|
switch msg.ContentType {
|
||||||
case constant.GroupCreatedNotification:
|
case constant.GroupCreatedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupCreated.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupCreated.OfflinePush.Title
|
title = config.Config.Notification.GroupCreated.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupCreated.OfflinePush.Desc
|
desc = config.Config.Notification.GroupCreated.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupCreated.OfflinePush.Ext
|
ex = config.Config.Notification.GroupCreated.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupCreated.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupCreated.Conversation.UnreadCount
|
|
||||||
case constant.GroupInfoSetNotification:
|
case constant.GroupInfoSetNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupInfoSet.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupInfoSet.OfflinePush.Title
|
title = config.Config.Notification.GroupInfoSet.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupInfoSet.OfflinePush.Desc
|
desc = config.Config.Notification.GroupInfoSet.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupInfoSet.OfflinePush.Ext
|
ex = config.Config.Notification.GroupInfoSet.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupInfoSet.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupInfoSet.Conversation.UnreadCount
|
|
||||||
case constant.JoinGroupApplicationNotification:
|
case constant.JoinGroupApplicationNotification:
|
||||||
pushSwitch = config.Config.Notification.JoinGroupApplication.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.JoinGroupApplication.OfflinePush.Title
|
title = config.Config.Notification.JoinGroupApplication.OfflinePush.Title
|
||||||
desc = config.Config.Notification.JoinGroupApplication.OfflinePush.Desc
|
desc = config.Config.Notification.JoinGroupApplication.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.JoinGroupApplication.OfflinePush.Ext
|
ex = config.Config.Notification.JoinGroupApplication.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.JoinGroupApplication.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.JoinGroupApplication.Conversation.UnreadCount
|
|
||||||
case constant.MemberQuitNotification:
|
case constant.MemberQuitNotification:
|
||||||
pushSwitch = config.Config.Notification.MemberQuit.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.MemberQuit.OfflinePush.Title
|
title = config.Config.Notification.MemberQuit.OfflinePush.Title
|
||||||
desc = config.Config.Notification.MemberQuit.OfflinePush.Desc
|
desc = config.Config.Notification.MemberQuit.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.MemberQuit.OfflinePush.Ext
|
ex = config.Config.Notification.MemberQuit.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.MemberQuit.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.MemberQuit.Conversation.UnreadCount
|
|
||||||
case constant.GroupApplicationAcceptedNotification:
|
case constant.GroupApplicationAcceptedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupApplicationAccepted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Title
|
title = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Desc
|
desc = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Ext
|
ex = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupApplicationAccepted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupApplicationAccepted.Conversation.UnreadCount
|
|
||||||
case constant.GroupApplicationRejectedNotification:
|
case constant.GroupApplicationRejectedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupApplicationRejected.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupApplicationRejected.OfflinePush.Title
|
title = config.Config.Notification.GroupApplicationRejected.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupApplicationRejected.OfflinePush.Desc
|
desc = config.Config.Notification.GroupApplicationRejected.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupApplicationRejected.OfflinePush.Ext
|
ex = config.Config.Notification.GroupApplicationRejected.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupApplicationRejected.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupApplicationRejected.Conversation.UnreadCount
|
|
||||||
case constant.GroupOwnerTransferredNotification:
|
case constant.GroupOwnerTransferredNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupOwnerTransferred.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Title
|
title = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Desc
|
desc = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Ext
|
ex = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupOwnerTransferred.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupOwnerTransferred.Conversation.UnreadCount
|
|
||||||
case constant.MemberKickedNotification:
|
case constant.MemberKickedNotification:
|
||||||
pushSwitch = config.Config.Notification.MemberKicked.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.MemberKicked.OfflinePush.Title
|
title = config.Config.Notification.MemberKicked.OfflinePush.Title
|
||||||
desc = config.Config.Notification.MemberKicked.OfflinePush.Desc
|
desc = config.Config.Notification.MemberKicked.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.MemberKicked.OfflinePush.Ext
|
ex = config.Config.Notification.MemberKicked.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.MemberKicked.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.MemberKicked.Conversation.UnreadCount
|
|
||||||
case constant.MemberInvitedNotification:
|
case constant.MemberInvitedNotification:
|
||||||
pushSwitch = config.Config.Notification.MemberInvited.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.MemberInvited.OfflinePush.Title
|
title = config.Config.Notification.MemberInvited.OfflinePush.Title
|
||||||
desc = config.Config.Notification.MemberInvited.OfflinePush.Desc
|
desc = config.Config.Notification.MemberInvited.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.MemberInvited.OfflinePush.Ext
|
ex = config.Config.Notification.MemberInvited.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.MemberInvited.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.MemberInvited.Conversation.UnreadCount
|
|
||||||
case constant.MemberEnterNotification:
|
case constant.MemberEnterNotification:
|
||||||
pushSwitch = config.Config.Notification.MemberEnter.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.MemberEnter.OfflinePush.Title
|
title = config.Config.Notification.MemberEnter.OfflinePush.Title
|
||||||
desc = config.Config.Notification.MemberEnter.OfflinePush.Desc
|
desc = config.Config.Notification.MemberEnter.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.MemberEnter.OfflinePush.Ext
|
ex = config.Config.Notification.MemberEnter.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.MemberEnter.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.MemberEnter.Conversation.UnreadCount
|
|
||||||
case constant.UserInfoUpdatedNotification:
|
case constant.UserInfoUpdatedNotification:
|
||||||
pushSwitch = config.Config.Notification.UserInfoUpdated.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.UserInfoUpdated.OfflinePush.Title
|
title = config.Config.Notification.UserInfoUpdated.OfflinePush.Title
|
||||||
desc = config.Config.Notification.UserInfoUpdated.OfflinePush.Desc
|
desc = config.Config.Notification.UserInfoUpdated.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.UserInfoUpdated.OfflinePush.Ext
|
ex = config.Config.Notification.UserInfoUpdated.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.UserInfoUpdated.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.UserInfoUpdated.Conversation.UnreadCount
|
|
||||||
case constant.FriendApplicationNotification:
|
case constant.FriendApplicationNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendApplication.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendApplication.OfflinePush.Title
|
title = config.Config.Notification.FriendApplication.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendApplication.OfflinePush.Desc
|
desc = config.Config.Notification.FriendApplication.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendApplication.OfflinePush.Ext
|
ex = config.Config.Notification.FriendApplication.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendApplication.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendApplication.Conversation.UnreadCount
|
|
||||||
case constant.FriendApplicationApprovedNotification:
|
case constant.FriendApplicationApprovedNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendApplicationApproved.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendApplicationApproved.OfflinePush.Title
|
title = config.Config.Notification.FriendApplicationApproved.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendApplicationApproved.OfflinePush.Desc
|
desc = config.Config.Notification.FriendApplicationApproved.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendApplicationApproved.OfflinePush.Ext
|
ex = config.Config.Notification.FriendApplicationApproved.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendApplicationApproved.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendApplicationApproved.Conversation.UnreadCount
|
|
||||||
case constant.FriendApplicationRejectedNotification:
|
case constant.FriendApplicationRejectedNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendApplicationRejected.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendApplicationRejected.OfflinePush.Title
|
title = config.Config.Notification.FriendApplicationRejected.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendApplicationRejected.OfflinePush.Desc
|
desc = config.Config.Notification.FriendApplicationRejected.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendApplicationRejected.OfflinePush.Ext
|
ex = config.Config.Notification.FriendApplicationRejected.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendApplicationRejected.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendApplicationRejected.Conversation.UnreadCount
|
|
||||||
case constant.FriendAddedNotification:
|
case constant.FriendAddedNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendAdded.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendAdded.OfflinePush.Title
|
title = config.Config.Notification.FriendAdded.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendAdded.OfflinePush.Desc
|
desc = config.Config.Notification.FriendAdded.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendAdded.OfflinePush.Ext
|
ex = config.Config.Notification.FriendAdded.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendAdded.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendAdded.Conversation.UnreadCount
|
|
||||||
case constant.FriendDeletedNotification:
|
case constant.FriendDeletedNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendDeleted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendDeleted.OfflinePush.Title
|
title = config.Config.Notification.FriendDeleted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendDeleted.OfflinePush.Desc
|
desc = config.Config.Notification.FriendDeleted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendDeleted.OfflinePush.Ext
|
ex = config.Config.Notification.FriendDeleted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendDeleted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendDeleted.Conversation.UnreadCount
|
|
||||||
case constant.FriendRemarkSetNotification:
|
case constant.FriendRemarkSetNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendRemarkSet.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendRemarkSet.OfflinePush.Title
|
title = config.Config.Notification.FriendRemarkSet.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendRemarkSet.OfflinePush.Desc
|
desc = config.Config.Notification.FriendRemarkSet.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendRemarkSet.OfflinePush.Ext
|
ex = config.Config.Notification.FriendRemarkSet.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendRemarkSet.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendRemarkSet.Conversation.UnreadCount
|
|
||||||
case constant.BlackAddedNotification:
|
case constant.BlackAddedNotification:
|
||||||
pushSwitch = config.Config.Notification.BlackAdded.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.BlackAdded.OfflinePush.Title
|
title = config.Config.Notification.BlackAdded.OfflinePush.Title
|
||||||
desc = config.Config.Notification.BlackAdded.OfflinePush.Desc
|
desc = config.Config.Notification.BlackAdded.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.BlackAdded.OfflinePush.Ext
|
ex = config.Config.Notification.BlackAdded.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.BlackAdded.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.BlackAdded.Conversation.UnreadCount
|
|
||||||
case constant.BlackDeletedNotification:
|
case constant.BlackDeletedNotification:
|
||||||
pushSwitch = config.Config.Notification.BlackDeleted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.BlackDeleted.OfflinePush.Title
|
title = config.Config.Notification.BlackDeleted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.BlackDeleted.OfflinePush.Desc
|
desc = config.Config.Notification.BlackDeleted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.BlackDeleted.OfflinePush.Ext
|
ex = config.Config.Notification.BlackDeleted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.BlackDeleted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.BlackDeleted.Conversation.UnreadCount
|
|
||||||
case constant.ConversationOptChangeNotification:
|
case constant.ConversationOptChangeNotification:
|
||||||
pushSwitch = config.Config.Notification.ConversationOptUpdate.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.ConversationOptUpdate.OfflinePush.Title
|
title = config.Config.Notification.ConversationOptUpdate.OfflinePush.Title
|
||||||
desc = config.Config.Notification.ConversationOptUpdate.OfflinePush.Desc
|
desc = config.Config.Notification.ConversationOptUpdate.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.ConversationOptUpdate.OfflinePush.Ext
|
ex = config.Config.Notification.ConversationOptUpdate.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.ConversationOptUpdate.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.ConversationOptUpdate.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupDismissedNotification:
|
case constant.GroupDismissedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupDismissed.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupDismissed.OfflinePush.Title
|
title = config.Config.Notification.GroupDismissed.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupDismissed.OfflinePush.Desc
|
desc = config.Config.Notification.GroupDismissed.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext
|
ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupDismissed.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupDismissed.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupMutedNotification:
|
case constant.GroupMutedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupMuted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupMuted.OfflinePush.Title
|
title = config.Config.Notification.GroupMuted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupMuted.OfflinePush.Desc
|
desc = config.Config.Notification.GroupMuted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupMuted.OfflinePush.Ext
|
ex = config.Config.Notification.GroupMuted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupMuted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupMuted.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupCancelMutedNotification:
|
case constant.GroupCancelMutedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupCancelMuted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title
|
title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc
|
desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext
|
ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupCancelMuted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupCancelMuted.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupMemberMutedNotification:
|
case constant.GroupMemberMutedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupMemberMuted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title
|
title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc
|
desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext
|
ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupMemberMuted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupMemberMuted.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupMemberCancelMutedNotification:
|
case constant.GroupMemberCancelMutedNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title
|
title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc
|
desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext
|
ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupMemberCancelMuted.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupMemberCancelMuted.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.GroupMemberInfoSetNotification:
|
case constant.GroupMemberInfoSetNotification:
|
||||||
pushSwitch = config.Config.Notification.GroupMemberInfoSet.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Title
|
title = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Title
|
||||||
desc = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Desc
|
desc = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Ext
|
ex = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.GroupMemberInfoSet.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.GroupMemberInfoSet.Conversation.UnreadCount
|
|
||||||
|
|
||||||
case constant.ConversationPrivateChatNotification:
|
case constant.ConversationPrivateChatNotification:
|
||||||
pushSwitch = config.Config.Notification.ConversationSetPrivate.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.ConversationSetPrivate.OfflinePush.Title
|
title = config.Config.Notification.ConversationSetPrivate.OfflinePush.Title
|
||||||
desc = config.Config.Notification.ConversationSetPrivate.OfflinePush.Desc
|
desc = config.Config.Notification.ConversationSetPrivate.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.ConversationSetPrivate.OfflinePush.Ext
|
ex = config.Config.Notification.ConversationSetPrivate.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.ConversationSetPrivate.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount
|
|
||||||
case constant.FriendInfoUpdatedNotification:
|
case constant.FriendInfoUpdatedNotification:
|
||||||
pushSwitch = config.Config.Notification.FriendInfoUpdated.OfflinePush.PushSwitch
|
|
||||||
title = config.Config.Notification.FriendInfoUpdated.OfflinePush.Title
|
title = config.Config.Notification.FriendInfoUpdated.OfflinePush.Title
|
||||||
desc = config.Config.Notification.FriendInfoUpdated.OfflinePush.Desc
|
desc = config.Config.Notification.FriendInfoUpdated.OfflinePush.Desc
|
||||||
ex = config.Config.Notification.FriendInfoUpdated.OfflinePush.Ext
|
ex = config.Config.Notification.FriendInfoUpdated.OfflinePush.Ext
|
||||||
reliabilityLevel = config.Config.Notification.FriendInfoUpdated.Conversation.ReliabilityLevel
|
|
||||||
unReadCount = config.Config.Notification.FriendInfoUpdated.Conversation.UnreadCount
|
|
||||||
case constant.DeleteMessageNotification:
|
case constant.DeleteMessageNotification:
|
||||||
reliabilityLevel = constant.ReliableNotificationNoMsg
|
|
||||||
case constant.ConversationUnreadNotification, constant.SuperGroupUpdateNotification:
|
case constant.ConversationUnreadNotification, constant.SuperGroupUpdateNotification:
|
||||||
reliabilityLevel = constant.UnreliableNotification
|
|
||||||
}
|
|
||||||
switch reliabilityLevel {
|
|
||||||
case constant.UnreliableNotification:
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false)
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false)
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false)
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false)
|
|
||||||
case constant.ReliableNotificationNoMsg:
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false)
|
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false)
|
|
||||||
case constant.ReliableNotificationMsg:
|
|
||||||
|
|
||||||
}
|
}
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, unReadCount)
|
utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, unReadCount)
|
||||||
utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, pushSwitch)
|
utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, pushEnable)
|
||||||
offlineInfo.Title = title
|
offlineInfo.Title = title
|
||||||
offlineInfo.Desc = desc
|
offlineInfo.Desc = desc
|
||||||
offlineInfo.Ex = ex
|
offlineInfo.Ex = ex
|
||||||
|
@ -2,13 +2,12 @@ package notification2
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,25 +19,15 @@ func NewConversationNotificationSender(client discoveryregistry.SvcDiscoveryRegi
|
|||||||
return &ConversationNotificationSender{rpcclient.NewMsgClient(client)}
|
return &ConversationNotificationSender{rpcclient.NewMsgClient(client)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConversationNotificationSender) SetConversationNotification(ctx context.Context, sendID, recvID string, contentType int, m proto.Message, tips *sdkws.TipsComm) {
|
func (c *ConversationNotificationSender) SetConversationNotification(ctx context.Context, sendID, recvID string, contentType int, m proto.Message) {
|
||||||
var err error
|
var err error
|
||||||
tips.Detail, err = proto.Marshal(m)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
marshaler := jsonpb.Marshaler{
|
|
||||||
OrigName: true,
|
|
||||||
EnumsAsInts: false,
|
|
||||||
EmitDefaults: false,
|
|
||||||
}
|
|
||||||
tips.JsonDetail, _ = marshaler.MarshalToString(m)
|
|
||||||
var n rpcclient.NotificationMsg
|
var n rpcclient.NotificationMsg
|
||||||
n.SendID = sendID
|
n.SendID = sendID
|
||||||
n.RecvID = recvID
|
n.RecvID = recvID
|
||||||
n.ContentType = int32(contentType)
|
n.ContentType = int32(contentType)
|
||||||
n.SessionType = constant.SingleChatType
|
n.SessionType = constant.SingleChatType
|
||||||
n.MsgFrom = constant.SysMsgType
|
n.MsgFrom = constant.SysMsgType
|
||||||
n.Content, err = proto.Marshal(tips)
|
n.Content, err = json.Marshal(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -47,40 +36,28 @@ func (c *ConversationNotificationSender) SetConversationNotification(ctx context
|
|||||||
|
|
||||||
// SetPrivate调用
|
// SetPrivate调用
|
||||||
func (c *ConversationNotificationSender) ConversationSetPrivateNotification(ctx context.Context, sendID, recvID string, isPrivateChat bool) {
|
func (c *ConversationNotificationSender) ConversationSetPrivateNotification(ctx context.Context, sendID, recvID string, isPrivateChat bool) {
|
||||||
conversationSetPrivateTips := &sdkws.ConversationSetPrivateTips{
|
tips := &sdkws.ConversationSetPrivateTips{
|
||||||
RecvID: recvID,
|
RecvID: recvID,
|
||||||
SendID: sendID,
|
SendID: sendID,
|
||||||
IsPrivate: isPrivateChat,
|
IsPrivate: isPrivateChat,
|
||||||
}
|
}
|
||||||
var tips sdkws.TipsComm
|
c.SetConversationNotification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, tips)
|
||||||
var tipsMsg string
|
|
||||||
if isPrivateChat == true {
|
|
||||||
tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.OpenTips
|
|
||||||
} else {
|
|
||||||
tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.CloseTips
|
|
||||||
}
|
|
||||||
tips.DefaultTips = tipsMsg
|
|
||||||
c.SetConversationNotification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, conversationSetPrivateTips, &tips)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 会话改变
|
// 会话改变
|
||||||
func (c *ConversationNotificationSender) ConversationChangeNotification(ctx context.Context, userID string) {
|
func (c *ConversationNotificationSender) ConversationChangeNotification(ctx context.Context, userID string) {
|
||||||
ConversationChangedTips := &sdkws.ConversationUpdateTips{
|
tips := &sdkws.ConversationUpdateTips{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
}
|
}
|
||||||
var tips sdkws.TipsComm
|
c.SetConversationNotification(ctx, userID, userID, constant.ConversationOptChangeNotification, tips)
|
||||||
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
|
|
||||||
c.SetConversationNotification(ctx, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, &tips)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 会话未读数同步
|
// 会话未读数同步
|
||||||
func (c *ConversationNotificationSender) ConversationUnreadChangeNotification(ctx context.Context, userID, conversationID string, updateUnreadCountTime int64) {
|
func (c *ConversationNotificationSender) ConversationUnreadChangeNotification(ctx context.Context, userID, conversationID string, updateUnreadCountTime int64) {
|
||||||
ConversationChangedTips := &sdkws.ConversationUpdateTips{
|
tips := &sdkws.ConversationUpdateTips{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
ConversationIDList: []string{conversationID},
|
ConversationIDList: []string{conversationID},
|
||||||
UpdateUnreadCountTime: updateUnreadCountTime,
|
UpdateUnreadCountTime: updateUnreadCountTime,
|
||||||
}
|
}
|
||||||
var tips sdkws.TipsComm
|
c.SetConversationNotification(ctx, userID, userID, constant.ConversationUnreadNotification, tips)
|
||||||
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
|
|
||||||
c.SetConversationNotification(ctx, userID, userID, constant.ConversationUnreadNotification, ConversationChangedTips, &tips)
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package notification2
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
|
||||||
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||||
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/convert"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/convert"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -96,56 +95,13 @@ func (c *FriendNotificationSender) getFromToUserNickname(ctx context.Context, fr
|
|||||||
|
|
||||||
func (c *FriendNotificationSender) friendNotification(ctx context.Context, fromUserID, toUserID string, contentType int32, m proto.Message) {
|
func (c *FriendNotificationSender) friendNotification(ctx context.Context, fromUserID, toUserID string, contentType int32, m proto.Message) {
|
||||||
var err error
|
var err error
|
||||||
var tips sdkws.TipsComm
|
|
||||||
tips.Detail, err = proto.Marshal(m)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
marshaler := jsonpb.Marshaler{
|
|
||||||
OrigName: true,
|
|
||||||
EnumsAsInts: false,
|
|
||||||
EmitDefaults: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
tips.JsonDetail, _ = marshaler.MarshalToString(m)
|
|
||||||
|
|
||||||
fromUserNickname, toUserNickname, err := c.getFromToUserNickname(ctx, fromUserID, toUserID)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
cn := config.Config.Notification
|
|
||||||
switch contentType {
|
|
||||||
case constant.FriendApplicationNotification:
|
|
||||||
tips.DefaultTips = fromUserNickname + cn.FriendApplication.DefaultTips.Tips
|
|
||||||
case constant.FriendApplicationApprovedNotification:
|
|
||||||
tips.DefaultTips = fromUserNickname + cn.FriendApplicationApproved.DefaultTips.Tips
|
|
||||||
case constant.FriendApplicationRejectedNotification:
|
|
||||||
tips.DefaultTips = fromUserNickname + cn.FriendApplicationRejected.DefaultTips.Tips
|
|
||||||
case constant.FriendAddedNotification:
|
|
||||||
tips.DefaultTips = cn.FriendAdded.DefaultTips.Tips
|
|
||||||
case constant.FriendDeletedNotification:
|
|
||||||
tips.DefaultTips = cn.FriendDeleted.DefaultTips.Tips + toUserNickname
|
|
||||||
case constant.FriendRemarkSetNotification:
|
|
||||||
tips.DefaultTips = fromUserNickname + cn.FriendRemarkSet.DefaultTips.Tips
|
|
||||||
case constant.BlackAddedNotification:
|
|
||||||
tips.DefaultTips = cn.BlackAdded.DefaultTips.Tips
|
|
||||||
case constant.BlackDeletedNotification:
|
|
||||||
tips.DefaultTips = cn.BlackDeleted.DefaultTips.Tips + toUserNickname
|
|
||||||
case constant.UserInfoUpdatedNotification:
|
|
||||||
tips.DefaultTips = cn.UserInfoUpdated.DefaultTips.Tips
|
|
||||||
case constant.FriendInfoUpdatedNotification:
|
|
||||||
tips.DefaultTips = cn.FriendInfoUpdated.DefaultTips.Tips + toUserNickname
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var n rpcclient.NotificationMsg
|
var n rpcclient.NotificationMsg
|
||||||
n.SendID = fromUserID
|
n.SendID = fromUserID
|
||||||
n.RecvID = toUserID
|
n.RecvID = toUserID
|
||||||
n.ContentType = contentType
|
n.ContentType = contentType
|
||||||
n.SessionType = constant.SingleChatType
|
n.SessionType = constant.SingleChatType
|
||||||
n.MsgFrom = constant.SysMsgType
|
n.MsgFrom = constant.SysMsgType
|
||||||
n.Content, err = proto.Marshal(&tips)
|
n.Content, err = json.Marshal(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -153,8 +109,8 @@ func (c *FriendNotificationSender) friendNotification(ctx context.Context, fromU
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) {
|
func (u *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) {
|
||||||
selfInfoUpdatedTips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
||||||
u.friendNotification(ctx, opUserID, changedUserID, constant.UserInfoUpdatedNotification, &selfInfoUpdatedTips)
|
u.friendNotification(ctx, opUserID, changedUserID, constant.UserInfoUpdatedNotification, &tips)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FriendNotificationSender) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) {
|
func (c *FriendNotificationSender) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) {
|
||||||
@ -190,7 +146,6 @@ func (c *FriendNotificationSender) FriendAddedNotification(ctx context.Context,
|
|||||||
friendAddedTips.OpUser.Ex = user[0].GetEx()
|
friendAddedTips.OpUser.Ex = user[0].GetEx()
|
||||||
friendAddedTips.OpUser.Nickname = user[0].GetNickname()
|
friendAddedTips.OpUser.Nickname = user[0].GetNickname()
|
||||||
friendAddedTips.OpUser.FaceURL = user[0].GetFaceURL()
|
friendAddedTips.OpUser.FaceURL = user[0].GetFaceURL()
|
||||||
|
|
||||||
friends, err := c.db.FindFriendsWithError(ctx, fromUserID, []string{toUserID})
|
friends, err := c.db.FindFriendsWithError(ctx, fromUserID, []string{toUserID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user