Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
e74e963b
O
Open-IM-Server
项目概览
zhaominxu
/
Open-IM-Server
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Open-IM-Server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e74e963b
编写于
7月 05, 2021
作者:
落凡尘.
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Annotation push on server
上级
483e96fb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
65 deletion
+52
-65
src/rpc/group/group/create_group.go
src/rpc/group/group/create_group.go
+11
-14
src/rpc/group/group/join_group.go
src/rpc/group/group/join_group.go
+17
-20
src/rpc/group/group/quti_group.go
src/rpc/group/group/quti_group.go
+12
-16
src/rpc/group/group/set_group_info.go
src/rpc/group/group/set_group_info.go
+12
-15
未找到文件。
src/rpc/group/group/create_group.go
浏览文件 @
e74e963b
...
...
@@ -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
}
src/rpc/group/group/join_group.go
浏览文件 @
e74e963b
...
...
@@ -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
...
...
src/rpc/group/group/quti_group.go
浏览文件 @
e74e963b
...
...
@@ -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
}
src/rpc/group/group/set_group_info.go
浏览文件 @
e74e963b
...
...
@@ -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
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录