Annotation push on server

pull/4/head
away 4 years ago
parent 483e96fbe3
commit e74e963b8a

@ -5,10 +5,7 @@ import (
"Open_IM/src/common/constant"
"Open_IM/src/common/db/mysql_model/im_mysql_model"
"Open_IM/src/common/log"
pbChat "Open_IM/src/proto/chat"
pbGroup "Open_IM/src/proto/group"
"Open_IM/src/push/content_struct"
"Open_IM/src/push/logic"
"Open_IM/src/utils"
"context"
"github.com/skiffer-git/grpc-etcdv3/getcdv3"
@ -97,17 +94,17 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
log.ErrorByArgs("pull %s to group %s failed,err=%s", user.Uid, groupId, err.Error())
}
}
//Push message when create group chat
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: groupId,
Content: content_struct.NewContentStructString(0, "", req.String()),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType, //Notification message identification
ContentType: constant.CreateGroupTip, //Add friend flag
SessionType: constant.GroupChatType,
OperationID: req.OperationID,
})
////Push message when create group chat
//logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
// SendID: claims.UID,
// RecvID: groupId,
// Content: content_struct.NewContentStructString(0, "", req.String()),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType, //Notification message identification
// ContentType: constant.CreateGroupTip, //Add friend flag
// SessionType: constant.GroupChatType,
// OperationID: req.OperationID,
//})
log.Info(req.Token, req.OperationID, "rpc create group success return")
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
}

@ -5,10 +5,7 @@ import (
"Open_IM/src/common/constant"
"Open_IM/src/common/db/mysql_model/im_mysql_model"
"Open_IM/src/common/log"
pbChat "Open_IM/src/proto/chat"
pbGroup "Open_IM/src/proto/group"
"Open_IM/src/push/content_struct"
"Open_IM/src/push/logic"
"Open_IM/src/utils"
"context"
)
@ -40,23 +37,23 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error())
return &pbGroup.CommonResp{ErrorCode: config.ErrJoinGroupApplication.ErrCode, ErrorMsg: config.ErrJoinGroupApplication.ErrMsg}, nil
}
//Find the the group owner
groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator)
if err != nil {
log.Error(req.Token, req.OperationID, "find group creator failed", err.Error())
} else {
//Push message when join group chat
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: groupCreatorInfo[0].Uid,
Content: content_struct.NewContentStructString(0, "", req.String()),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType,
ContentType: constant.JoinGroupTip,
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
})
}
////Find the the group owner
//groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator)
//if err != nil {
// log.Error(req.Token, req.OperationID, "find group creator failed", err.Error())
//} else {
// //Push message when join group chat
// logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
// SendID: claims.UID,
// RecvID: groupCreatorInfo[0].Uid,
// Content: content_struct.NewContentStructString(0, "", req.String()),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType,
// ContentType: constant.JoinGroupTip,
// SessionType: constant.SingleChatType,
// OperationID: req.OperationID,
// })
//}
log.Info(req.Token, req.OperationID, "rpc join group success return")
return &pbGroup.CommonResp{}, nil

@ -2,15 +2,11 @@ package group
import (
"Open_IM/src/common/config"
"Open_IM/src/common/constant"
"Open_IM/src/common/db/mysql_model/im_mysql_model"
"Open_IM/src/common/log"
pbChat "Open_IM/src/proto/chat"
pbGroup "Open_IM/src/proto/group"
"Open_IM/src/push/logic"
"Open_IM/src/utils"
"context"
"encoding/json"
)
func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.CommonResp, error) {
@ -33,18 +29,18 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
log.ErrorByArgs("this user exit the group failed,err=%s", err.Error())
return &pbGroup.CommonResp{ErrorCode: config.ErrQuitGroup.ErrCode, ErrorMsg: config.ErrQuitGroup.ErrMsg}, nil
}
//Push message when quit group chat
jsonInfo, _ := json.Marshal(req)
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: req.GroupID,
Content: string(jsonInfo),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType,
ContentType: constant.QuitGroupTip,
SessionType: constant.GroupChatType,
OperationID: req.OperationID,
})
////Push message when quit group chat
//jsonInfo, _ := json.Marshal(req)
//logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
// SendID: claims.UID,
// RecvID: req.GroupID,
// Content: string(jsonInfo),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType,
// ContentType: constant.QuitGroupTip,
// SessionType: constant.GroupChatType,
// OperationID: req.OperationID,
//})
log.Info(req.Token, req.OperationID, "rpc quit group is success return")
return &pbGroup.CommonResp{}, nil
}

@ -5,12 +5,9 @@ import (
"Open_IM/src/common/constant"
"Open_IM/src/common/db/mysql_model/im_mysql_model"
"Open_IM/src/common/log"
pbChat "Open_IM/src/proto/chat"
pbGroup "Open_IM/src/proto/group"
"Open_IM/src/push/logic"
"Open_IM/src/utils"
"context"
"encoding/json"
)
func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.CommonResp, error) {
@ -34,17 +31,17 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil {
return &pbGroup.CommonResp{ErrorCode: config.ErrSetGroupInfo.ErrCode, ErrorMsg: config.ErrSetGroupInfo.ErrMsg}, nil
}
//Push message when set group info
jsonInfo, _ := json.Marshal(req)
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: req.GroupID,
Content: string(jsonInfo),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType,
ContentType: constant.SetGroupInfoTip,
SessionType: constant.GroupChatType,
OperationID: req.OperationID,
})
////Push message when set group info
//jsonInfo, _ := json.Marshal(req)
//logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
// SendID: claims.UID,
// RecvID: req.GroupID,
// Content: string(jsonInfo),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType,
// ContentType: constant.SetGroupInfoTip,
// SessionType: constant.GroupChatType,
// OperationID: req.OperationID,
//})
return &pbGroup.CommonResp{}, nil
}

Loading…
Cancel
Save