Refactor code

pull/141/head
wenxu12345 3 years ago
parent e4b6b18712
commit b2c2c1247b

@ -9,6 +9,7 @@ import (
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"encoding/json"
"github.com/golang/protobuf/proto"
)
//message MemberInfoChangedTips{
@ -75,7 +76,11 @@ func FriendApplicationProcessedNotification(req *pbFriend.AddFriendResponseReq)
}
var tips open_im_sdk.TipsComm
tips.Detail, _ = json.Marshal(FriendApplicationProcessedTips)
tips.Detail, err = proto.Marshal(&FriendApplicationProcessedTips)
if err != nil {
log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), FriendApplicationProcessedTips)
return
}
tips.DefaultTips = fromUserNickname + " FriendApplicationProcessedNotification " + toUserNickname
var n NotificationMsg
@ -86,6 +91,11 @@ func FriendApplicationProcessedNotification(req *pbFriend.AddFriendResponseReq)
n.MsgFrom = constant.SysMsgType
n.OperationID = req.CommID.OperationID
n.Content, _ = json.Marshal(tips)
n.Content, err = proto.Marshal(&tips)
if err != nil {
log.Error(req.CommID.OperationID, "Marshal failed ", err.Error(), tips)
return
}
Notification(&n)
}

@ -232,7 +232,7 @@ func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType i
type NotificationMsg struct {
SendID string
RecvID string
Content []byte
Content []byte // open_im_sdk.TipsComm
MsgFrom int32
ContentType int32
SessionType int32

@ -45,6 +45,7 @@ const (
GroupMsg = 201
//SysRelated
FriendApplicationProcessedNotification = 1201 //AcceptFriendApplicationTip = 201
FriendApplicationAddedNotification = 1202 //AddFriendTip = 202
FriendAddedNotification = 1203

@ -75,8 +75,8 @@ message BlackInfo{
}
message GroupRequest{
string userID = 1;
string groupID = 2;
PublicUserInfo userInfo = 1;
GroupInfo groupInfo = 2;
string handleResult = 3;
string reqMsg = 4;
string handleMsg = 5;
@ -312,6 +312,7 @@ message FriendApplicationAddedTips{
//FromUserID accept or reject ToUserID
message FriendApplicationProcessedTips{
FromToUserID fromToUserID = 1;
int32 handleResult = 2;
}
// FromUserID Added a friend ToUserID

Loading…
Cancel
Save