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_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"encoding/json" "encoding/json"
"github.com/golang/protobuf/proto"
) )
//message MemberInfoChangedTips{ //message MemberInfoChangedTips{
@ -75,7 +76,11 @@ func FriendApplicationProcessedNotification(req *pbFriend.AddFriendResponseReq)
} }
var tips open_im_sdk.TipsComm 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 tips.DefaultTips = fromUserNickname + " FriendApplicationProcessedNotification " + toUserNickname
var n NotificationMsg var n NotificationMsg
@ -86,6 +91,11 @@ func FriendApplicationProcessedNotification(req *pbFriend.AddFriendResponseReq)
n.MsgFrom = constant.SysMsgType n.MsgFrom = constant.SysMsgType
n.OperationID = req.CommID.OperationID n.OperationID = req.CommID.OperationID
n.Content, _ = json.Marshal(tips) 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) Notification(&n)
} }

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

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

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

Loading…
Cancel
Save