mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
Refactor code
This commit is contained in:
parent
3380cab2c3
commit
9077b56df1
@ -179,7 +179,7 @@ notification:
|
|||||||
|
|
||||||
groupCreated:
|
groupCreated:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: true
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: true
|
switch: true
|
||||||
@ -191,111 +191,111 @@ notification:
|
|||||||
|
|
||||||
groupInfoSet:
|
groupInfoSet:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "groupInfoSet title"
|
||||||
desc: "group info changed desc"
|
desc: "groupInfoSet desc"
|
||||||
ext: "group info changed ext"
|
ext: "groupInfoSet ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "modified the group profile" # group info changed by xx
|
||||||
|
|
||||||
joinGroupApplication:
|
joinGroupApplication:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 2
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "joinGroupApplication title"
|
||||||
desc: "group info changed desc"
|
desc: "joinGroupApplication desc"
|
||||||
ext: "group info changed ext"
|
ext: "joinGroupApplication ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "apply to join the group" # group info changed by xx
|
||||||
|
|
||||||
memberQuit:
|
memberQuit:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "memberQuit title"
|
||||||
desc: "group info changed desc"
|
desc: "memberQuit desc"
|
||||||
ext: "group info changed ext"
|
ext: "memberQuit ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "quit group chat" # group info changed by xx
|
||||||
|
|
||||||
groupApplicationAccepted:
|
groupApplicationAccepted:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "groupApplicationAccepted title"
|
||||||
desc: "group info changed desc"
|
desc: "groupApplicationAccepted desc"
|
||||||
ext: "group info changed ext"
|
ext: "groupApplicationAccepted ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "was allowed to join the group" # group info changed by xx
|
||||||
|
|
||||||
groupApplicationRejected:
|
groupApplicationRejected:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 2
|
||||||
unreadCount: false
|
unreadCount: false
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: " title"
|
||||||
desc: "group info changed desc"
|
desc: " desc"
|
||||||
ext: "group info changed ext"
|
ext: " ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "was rejected into the group" # group info changed by xx
|
||||||
|
|
||||||
groupOwnerTransferred:
|
groupOwnerTransferred:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "groupOwnerTransferred title"
|
||||||
desc: "group info changed desc"
|
desc: "groupOwnerTransferred desc"
|
||||||
ext: "group info changed ext"
|
ext: "groupOwnerTransferred ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "become a new group owner" # group info changed by xx
|
||||||
|
|
||||||
memberKicked:
|
memberKicked:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "memberKicked title"
|
||||||
desc: "group info changed desc"
|
desc: "memberKicked desc"
|
||||||
ext: "group info changed ext"
|
ext: "memberKicked ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "was kicked out of the group" # group info changed by xx
|
||||||
|
|
||||||
memberInvited:
|
memberInvited:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "memberInvited title"
|
||||||
desc: "group info changed desc"
|
desc: "memberInvited desc"
|
||||||
ext: "group info changed ext"
|
ext: "memberInvited ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "was invited into the group" # group info changed by xx
|
||||||
|
|
||||||
memberEnter:
|
memberEnter:
|
||||||
conversation:
|
conversation:
|
||||||
reliabilityLevel: 1
|
reliabilityLevel: 3
|
||||||
unreadCount: false
|
unreadCount: true
|
||||||
offlinePush:
|
offlinePush:
|
||||||
switch: false
|
switch: false
|
||||||
title: "group info changed title"
|
title: "memberEnter title"
|
||||||
desc: "group info changed desc"
|
desc: "memberEnter desc"
|
||||||
ext: "group info changed ext"
|
ext: "memberEnter ext"
|
||||||
defaultTips:
|
defaultTips:
|
||||||
tips: "group info changed by" # group info changed by xx
|
tips: "entered the group" # group info changed by xx
|
||||||
|
|
||||||
#############################friend#################################
|
#############################friend#################################
|
||||||
|
|
||||||
|
@ -94,18 +94,44 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from, err := imdb.GetUserByUserID(sendID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(operationID, "GetUserByUserID failed ", err.Error())
|
||||||
|
}
|
||||||
|
nickname := ""
|
||||||
|
if from != nil {
|
||||||
|
nickname = from.Nickname
|
||||||
|
}
|
||||||
|
|
||||||
|
to, err := imdb.GetUserByUserID(recvUserID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(operationID, "GetUserByUserID failed ", err.Error())
|
||||||
|
}
|
||||||
|
toNickname := ""
|
||||||
|
if from != nil {
|
||||||
|
toNickname = to.Nickname
|
||||||
|
}
|
||||||
|
|
||||||
cn := config.Config.Notification
|
cn := config.Config.Notification
|
||||||
switch contentType {
|
switch contentType {
|
||||||
case constant.GroupCreatedNotification:
|
case constant.GroupCreatedNotification:
|
||||||
tips.DefaultTips = cn.GroupCreated.DefaultTips.Tips
|
tips.DefaultTips = nickname + " " + cn.GroupCreated.DefaultTips.Tips
|
||||||
case constant.GroupInfoSetNotification:
|
case constant.GroupInfoSetNotification:
|
||||||
|
tips.DefaultTips = nickname + " " + cn.GroupInfoSet.DefaultTips.Tips
|
||||||
case constant.JoinGroupApplicationNotification:
|
case constant.JoinGroupApplicationNotification:
|
||||||
|
tips.DefaultTips = nickname + " " + cn.JoinGroupApplication.DefaultTips.Tips
|
||||||
case constant.MemberQuitNotification:
|
case constant.MemberQuitNotification:
|
||||||
case constant.GroupApplicationAcceptedNotification:
|
tips.DefaultTips = nickname + " " + cn.MemberQuit.DefaultTips.Tips
|
||||||
case constant.GroupApplicationRejectedNotification:
|
case constant.GroupApplicationAcceptedNotification: //
|
||||||
case constant.GroupOwnerTransferredNotification:
|
tips.DefaultTips = toNickname + " " + cn.GroupApplicationAccepted.DefaultTips.Tips
|
||||||
case constant.MemberKickedNotification:
|
case constant.GroupApplicationRejectedNotification: //
|
||||||
case constant.MemberInvitedNotification:
|
tips.DefaultTips = toNickname + " " + cn.GroupApplicationRejected.DefaultTips.Tips
|
||||||
|
case constant.GroupOwnerTransferredNotification: //
|
||||||
|
tips.DefaultTips = toNickname + " " + cn.GroupOwnerTransferred.DefaultTips.Tips
|
||||||
|
case constant.MemberKickedNotification: //
|
||||||
|
tips.DefaultTips = toNickname + " " + cn.MemberKicked.DefaultTips.Tips
|
||||||
|
case constant.MemberInvitedNotification: //
|
||||||
|
tips.DefaultTips = toNickname + " " + cn.MemberInvited.DefaultTips.Tips
|
||||||
default:
|
default:
|
||||||
log.Error(operationID, "contentType failed ", contentType)
|
log.Error(operationID, "contentType failed ", contentType)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user