|
|
|
@ -12,23 +12,6 @@ import (
|
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
//message MemberInfoChangedTips{
|
|
|
|
|
// int32 ChangeType = 1; //1:info changed; 2:mute
|
|
|
|
|
// GroupMemberFullInfo OpUser = 2; //who do this
|
|
|
|
|
// GroupMemberFullInfo FinalInfo = 3; //
|
|
|
|
|
// uint64 MuteTime = 4;
|
|
|
|
|
// GroupInfo Group = 5;
|
|
|
|
|
//}
|
|
|
|
|
//func MemberInfoChangedNotification(operationID string, group *immysql.Group, opUser *immysql.GroupMember, userFinalInfo *immysql.GroupMember) {
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//message FriendApplicationAddedTips{
|
|
|
|
|
// PublicUserInfo OpUser = 1; //user1
|
|
|
|
|
// FriendApplication Application = 2;
|
|
|
|
|
// PublicUserInfo OpedUser = 3; //user2
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
func getFromToUserNickname(fromUserID, toUserID string) (string, string, error) {
|
|
|
|
|
from, err := imdb.GetUserByUserID(fromUserID)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -59,8 +42,7 @@ func friendNotification(commID *pbFriend.CommID, contentType int32, m proto.Mess
|
|
|
|
|
cn := config.Config.Notification
|
|
|
|
|
switch contentType {
|
|
|
|
|
case constant.FriendApplicationNotification:
|
|
|
|
|
|
|
|
|
|
tips.DefaultTips = fromUserNickname + cn.FriendApplicationAdded.DefaultTips.Tips
|
|
|
|
|
tips.DefaultTips = fromUserNickname + cn.FriendApplication.DefaultTips.Tips
|
|
|
|
|
case constant.FriendApplicationApprovedNotification:
|
|
|
|
|
tips.DefaultTips = fromUserNickname + cn.FriendApplicationApproved.DefaultTips.Tips
|
|
|
|
|
case constant.FriendApplicationRejectedNotification:
|
|
|
|
@ -70,7 +52,7 @@ func friendNotification(commID *pbFriend.CommID, contentType int32, m proto.Mess
|
|
|
|
|
case constant.FriendDeletedNotification:
|
|
|
|
|
tips.DefaultTips = cn.FriendDeleted.DefaultTips.Tips + toUserNickname
|
|
|
|
|
case constant.FriendRemarkSetNotification:
|
|
|
|
|
tips.DefaultTips = fromUserNickname + cn.FriendInfoChanged.DefaultTips.Tips
|
|
|
|
|
tips.DefaultTips = fromUserNickname + cn.FriendRemarkSet.DefaultTips.Tips
|
|
|
|
|
case constant.BlackAddedNotification:
|
|
|
|
|
tips.DefaultTips = cn.BlackAdded.DefaultTips.Tips + toUserNickname
|
|
|
|
|
case constant.BlackDeletedNotification:
|
|
|
|
@ -96,37 +78,10 @@ func friendNotification(commID *pbFriend.CommID, contentType int32, m proto.Mess
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FriendApplicationNotification(req *pbFriend.AddFriendReq) {
|
|
|
|
|
log.Info(req.CommID.OperationID, utils.GetSelfFuncName(), "args: ", req.String())
|
|
|
|
|
var FriendApplicationTips open_im_sdk.FriendApplicationTips
|
|
|
|
|
FriendApplicationTips := open_im_sdk.FriendApplicationTips{FromToUserID: &open_im_sdk.FromToUserID{}}
|
|
|
|
|
FriendApplicationTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
FriendApplicationTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
friendNotification(req.CommID, constant.FriendApplicationNotification, &FriendApplicationTips)
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&friendApplicationAddedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), friendApplicationAddedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " FriendApplicationAddedNotification " + toUserNickname
|
|
|
|
|
//
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = req.CommID.FromUserID
|
|
|
|
|
//n.RecvID = req.CommID.ToUserID
|
|
|
|
|
//n.ContentType = constant.FriendApplicationAddedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = req.CommID.OperationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FriendApplicationApprovedNotification(req *pbFriend.AddFriendResponseReq) {
|
|
|
|
@ -134,35 +89,7 @@ func FriendApplicationApprovedNotification(req *pbFriend.AddFriendResponseReq) {
|
|
|
|
|
FriendApplicationApprovedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
FriendApplicationApprovedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
FriendApplicationApprovedTips.HandleMsg = req.HandleMsg
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
friendNotification(req.CommID, constant.FriendApplicationApprovedNotification, &FriendApplicationApprovedTips)
|
|
|
|
|
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " FriendApplicationProcessedNotification " + toUserNickname
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&friendApplicationProcessedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), friendApplicationProcessedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = req.CommID.FromUserID
|
|
|
|
|
//n.RecvID = req.CommID.ToUserID
|
|
|
|
|
//n.ContentType = constant.FriendApplicationProcessedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = req.CommID.OperationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FriendApplicationRejectedNotification(req *pbFriend.AddFriendResponseReq) {
|
|
|
|
@ -170,55 +97,11 @@ func FriendApplicationRejectedNotification(req *pbFriend.AddFriendResponseReq) {
|
|
|
|
|
FriendApplicationApprovedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
FriendApplicationApprovedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
FriendApplicationApprovedTips.HandleMsg = req.HandleMsg
|
|
|
|
|
|
|
|
|
|
friendNotification(req.CommID, constant.FriendApplicationRejectedNotification, &FriendApplicationApprovedTips)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//func FriendApplicationProcessedNotification(req *pbFriend.AddFriendResponseReq) {
|
|
|
|
|
// var friendApplicationProcessedTips open_im_sdk.FriendApplicationProcessedTips
|
|
|
|
|
// friendApplicationProcessedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
// friendApplicationProcessedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
// friendApplicationProcessedTips.HandleResult = req.HandleResult
|
|
|
|
|
// //fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// //if err != nil {
|
|
|
|
|
// // log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// // return
|
|
|
|
|
// //}
|
|
|
|
|
// if friendApplicationProcessedTips.HandleResult == 1 {
|
|
|
|
|
// friendNotification(req.CommID, constant.FriendApplicationApprovedNotification, &friendApplicationProcessedTips)
|
|
|
|
|
// } else if friendApplicationProcessedTips.HandleResult == -1 {
|
|
|
|
|
// friendNotification(req.CommID, constant.FriendApplicationRejectedNotification, &friendApplicationProcessedTips)
|
|
|
|
|
// } else {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "HandleResult failed ", friendApplicationProcessedTips.HandleResult)
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //var tips open_im_sdk.TipsComm
|
|
|
|
|
// //tips.DefaultTips = fromUserNickname + " FriendApplicationProcessedNotification " + toUserNickname
|
|
|
|
|
// //tips.Detail, err = proto.Marshal(&friendApplicationProcessedTips)
|
|
|
|
|
// //if err != nil {
|
|
|
|
|
// // log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), friendApplicationProcessedTips.String())
|
|
|
|
|
// // return
|
|
|
|
|
// //}
|
|
|
|
|
// //
|
|
|
|
|
// //var n NotificationMsg
|
|
|
|
|
// //n.SendID = req.CommID.FromUserID
|
|
|
|
|
// //n.RecvID = req.CommID.ToUserID
|
|
|
|
|
// //n.ContentType = constant.FriendApplicationProcessedNotification
|
|
|
|
|
// //n.SessionType = constant.SingleChatType
|
|
|
|
|
// //n.MsgFrom = constant.SysMsgType
|
|
|
|
|
// //n.OperationID = req.CommID.OperationID
|
|
|
|
|
// //n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
// //if err != nil {
|
|
|
|
|
// // log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// // return
|
|
|
|
|
// //}
|
|
|
|
|
// //Notification(&n)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
func FriendAddedNotification(operationID, opUserID, fromUserID, toUserID string) {
|
|
|
|
|
var friendAddedTips open_im_sdk.FriendAddedTips
|
|
|
|
|
friendAddedTips := open_im_sdk.FriendAddedTips{Friend: &open_im_sdk.FriendInfo{}, OpUser: &open_im_sdk.PublicUserInfo{}}
|
|
|
|
|
user, err := imdb.GetUserByUserID(opUserID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(operationID, "GetUserByUserID failed ", err.Error(), opUserID)
|
|
|
|
@ -233,210 +116,39 @@ func FriendAddedNotification(operationID, opUserID, fromUserID, toUserID string)
|
|
|
|
|
utils2.FriendDBCopyOpenIM(friendAddedTips.Friend, friend)
|
|
|
|
|
commID := pbFriend.CommID{FromUserID: fromUserID, ToUserID: toUserID, OpUserID: opUserID, OperationID: operationID}
|
|
|
|
|
friendNotification(&commID, constant.FriendAddedNotification, &friendAddedTips)
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(fromUserID, toUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "getFromToUserNickname failed ", err.Error(), fromUserID, toUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " FriendAddedNotification " + toUserNickname
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&friendAddedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), friendAddedTips)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = fromUserID
|
|
|
|
|
//n.RecvID = toUserID
|
|
|
|
|
//n.ContentType = constant.FriendAddedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = operationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//message FriendDeletedTips{
|
|
|
|
|
// FriendInfo Friend = 1;
|
|
|
|
|
//}
|
|
|
|
|
func FriendDeletedNotification(req *pbFriend.DeleteFriendReq) {
|
|
|
|
|
var friendDeletedTips open_im_sdk.FriendDeletedTips
|
|
|
|
|
friendDeletedTips := open_im_sdk.FriendDeletedTips{FromToUserID: &open_im_sdk.FromToUserID{}}
|
|
|
|
|
friendDeletedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
friendDeletedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
friendNotification(req.CommID, constant.FriendDeletedNotification, &friendDeletedTips)
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " FriendDeletedNotification " + toUserNickname
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&friendDeletedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), friendDeletedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = req.CommID.FromUserID
|
|
|
|
|
//n.RecvID = req.CommID.ToUserID
|
|
|
|
|
//n.ContentType = constant.FriendDeletedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = req.CommID.OperationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//message FriendInfoChangedTips{
|
|
|
|
|
// FriendInfo Friend = 1;
|
|
|
|
|
// PublicUserInfo OpUser = 2;
|
|
|
|
|
// uint64 OperationTime = 3;
|
|
|
|
|
//}
|
|
|
|
|
func FriendRemarkSetNotification(operationID, opUserID, fromUserID, toUserID string) {
|
|
|
|
|
var friendInfoChangedTips open_im_sdk.FriendInfoChangedTips
|
|
|
|
|
friendInfoChangedTips := open_im_sdk.FriendInfoChangedTips{FromToUserID: &open_im_sdk.FromToUserID{}}
|
|
|
|
|
friendInfoChangedTips.FromToUserID.FromUserID = fromUserID
|
|
|
|
|
friendInfoChangedTips.FromToUserID.ToUserID = toUserID
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(fromUserID, toUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "getFromToUserNickname failed ", fromUserID, toUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
commID := pbFriend.CommID{FromUserID: fromUserID, ToUserID: toUserID, OpUserID: opUserID, OperationID: operationID}
|
|
|
|
|
friendNotification(&commID, constant.FriendRemarkSetNotification, &friendInfoChangedTips)
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " FriendDeletedNotification " + toUserNickname
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&friendInfoChangedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), friendInfoChangedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = fromUserID
|
|
|
|
|
//n.RecvID = toUserID
|
|
|
|
|
//n.ContentType = constant.FriendInfoChangedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = operationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func BlackAddedNotification(req *pbFriend.AddBlacklistReq) {
|
|
|
|
|
var blackAddedTips open_im_sdk.BlackAddedTips
|
|
|
|
|
blackAddedTips := open_im_sdk.BlackAddedTips{FromToUserID: &open_im_sdk.FromToUserID{}}
|
|
|
|
|
blackAddedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
blackAddedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " BlackAddedNotification " + toUserNickname
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&blackAddedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), blackAddedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
friendNotification(req.CommID, constant.BlackAddedNotification, &blackAddedTips)
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = req.CommID.FromUserID
|
|
|
|
|
//n.RecvID = req.CommID.ToUserID
|
|
|
|
|
//n.ContentType = constant.BlackAddedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = req.CommID.OperationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//message BlackDeletedTips{
|
|
|
|
|
// BlackInfo Black = 1;
|
|
|
|
|
//}
|
|
|
|
|
func BlackDeletedNotification(req *pbFriend.RemoveBlacklistReq) {
|
|
|
|
|
var blackDeletedTips open_im_sdk.BlackDeletedTips
|
|
|
|
|
blackDeletedTips := open_im_sdk.BlackDeletedTips{FromToUserID: &open_im_sdk.FromToUserID{}}
|
|
|
|
|
blackDeletedTips.FromToUserID.FromUserID = req.CommID.FromUserID
|
|
|
|
|
blackDeletedTips.FromToUserID.ToUserID = req.CommID.ToUserID
|
|
|
|
|
//fromUserNickname, toUserNickname, err := getFromToUserNickname(req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "getFromToUserNickname failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&blackDeletedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), blackDeletedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
friendNotification(req.CommID, constant.BlackDeletedNotification, &blackDeletedTips)
|
|
|
|
|
//tips.DefaultTips = fromUserNickname + " BlackDeletedNotification " + toUserNickname
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = req.CommID.FromUserID
|
|
|
|
|
//n.RecvID = req.CommID.ToUserID
|
|
|
|
|
//n.ContentType = constant.BlackDeletedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = req.CommID.OperationID
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//message SelfInfoUpdatedTips{
|
|
|
|
|
// UserInfo SelfUserInfo = 1;
|
|
|
|
|
// PublicUserInfo OpUser = 2;
|
|
|
|
|
// uint64 OperationTime = 3;
|
|
|
|
|
//}
|
|
|
|
|
func UserInfoUpdatedNotification(operationID, userID string, needNotifiedUserID string) {
|
|
|
|
|
var selfInfoUpdatedTips open_im_sdk.UserInfoUpdatedTips
|
|
|
|
|
selfInfoUpdatedTips.UserID = userID
|
|
|
|
|
selfInfoUpdatedTips := open_im_sdk.UserInfoUpdatedTips{UserID: userID}
|
|
|
|
|
commID := pbFriend.CommID{FromUserID: userID, ToUserID: userID, OpUserID: needNotifiedUserID, OperationID: operationID}
|
|
|
|
|
friendNotification(&commID, constant.UserInfoUpdatedNotification, &selfInfoUpdatedTips)
|
|
|
|
|
//u, err := imdb.GetUserByUserID(userID)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.NewError(operationID, "FindUserByUID failed ", err.Error(), userID)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var tips open_im_sdk.TipsComm
|
|
|
|
|
//tips.Detail, err = proto.Marshal(&selfInfoUpdatedTips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), selfInfoUpdatedTips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//var n NotificationMsg
|
|
|
|
|
//n.SendID = userID
|
|
|
|
|
//n.RecvID = userID
|
|
|
|
|
//n.ContentType = constant.SelfInfoUpdatedNotification
|
|
|
|
|
//n.SessionType = constant.SingleChatType
|
|
|
|
|
//n.MsgFrom = constant.SysMsgType
|
|
|
|
|
//n.OperationID = operationID
|
|
|
|
|
//
|
|
|
|
|
//tips.DefaultTips = u.Nickname + " SelfInfoUpdatedNotification "
|
|
|
|
|
//n.Content, err = proto.Marshal(&tips)
|
|
|
|
|
//if err != nil {
|
|
|
|
|
// log.Error(operationID, "Marshal failed ", err.Error(), tips.String())
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//Notification(&n)
|
|
|
|
|
}
|
|
|
|
|