Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
40ed7258
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,发现更多精彩内容 >>
提交
40ed7258
编写于
12月 29, 2021
作者:
programor_guo
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
上级
abd91260
b0c05fd8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
28 deletion
+28
-28
internal/api/group/group.go
internal/api/group/group.go
+3
-3
internal/rpc/group/group.go
internal/rpc/group/group.go
+10
-10
pkg/base_info/group_api_struct.go
pkg/base_info/group_api_struct.go
+6
-8
pkg/base_info/public_struct.go
pkg/base_info/public_struct.go
+9
-7
未找到文件。
internal/api/group/group.go
浏览文件 @
40ed7258
...
...
@@ -244,16 +244,16 @@ func CreateGroup(c *gin.Context) {
client
:=
rpc
.
NewGroupClient
(
etcdConn
)
RpcResp
,
err
:=
client
.
CreateGroup
(
context
.
Background
(),
req
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"CreateGroup failed"
,
err
.
Error
(),
req
.
String
())
log
.
NewError
(
req
.
OperationID
,
"CreateGroup failed
"
,
err
.
Error
(),
req
.
String
())
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"errCode"
:
500
,
"errMsg"
:
"call rpc server failed"
})
return
}
resp
:=
api
.
CreateGroupResp
{
CommResp
:
api
.
CommResp
{
ErrCode
:
RpcResp
.
ErrCode
,
ErrMsg
:
RpcResp
.
ErrMsg
}}
if
RpcResp
.
ErrCode
==
0
{
utils
.
CopyStructFields
(
&
resp
.
GroupInfo
,
&
RpcResp
.
GroupInfo
)
utils
.
CopyStructFields
(
&
resp
.
GroupInfo
,
RpcResp
.
GroupInfo
)
}
log
.
NewInfo
(
req
.
OperationID
,
"
InviteUserToGroup api return "
,
RpcR
esp
)
log
.
NewInfo
(
req
.
OperationID
,
"
CreateGroup api return "
,
r
esp
)
c
.
JSON
(
http
.
StatusOK
,
resp
)
}
...
...
internal/rpc/group/group.go
浏览文件 @
40ed7258
...
...
@@ -111,7 +111,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
for
_
,
user
:=
range
req
.
InitMemberList
{
us
,
err
:=
im_mysql_model
.
GetUserByUserID
(
user
.
UserID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindUserByU
ID failed "
,
err
.
Error
(),
user
.
UserID
)
log
.
NewError
(
req
.
OperationID
,
"
GetUserByUser
ID failed "
,
err
.
Error
(),
user
.
UserID
)
continue
}
if
user
.
RoleLevel
==
constant
.
GroupOwner
{
...
...
@@ -133,7 +133,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
}
}
resp
:=
&
pbGroup
.
CreateGroupResp
{}
resp
:=
&
pbGroup
.
CreateGroupResp
{
GroupInfo
:
&
open_im_sdk
.
GroupInfo
{}
}
group
,
err
:=
im_mysql_model
.
GetGroupInfoByGroupID
(
groupId
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"GetGroupInfoByGroupID failed "
,
err
.
Error
(),
groupId
)
...
...
@@ -143,7 +143,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
}
chat
.
GroupCreatedNotification
(
req
.
OperationID
,
req
.
OpUserID
,
req
.
OwnerUserID
,
groupId
,
okUserIDList
)
utils
.
CopyStructFields
(
resp
.
GroupInfo
,
group
)
resp
.
GroupInfo
.
MemberCount
=
uint32
(
imdb
.
GetGroupMemberNumByGroupID
(
groupId
)
)
resp
.
GroupInfo
.
MemberCount
=
imdb
.
GetGroupMemberNumByGroupID
(
groupId
)
resp
.
GroupInfo
.
OwnerUserID
=
req
.
OwnerUserID
log
.
NewInfo
(
req
.
OperationID
,
"rpc CreateGroup return "
,
resp
.
String
())
...
...
@@ -195,7 +195,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
_
,
err
:=
imdb
.
GetGroupInfoByGroupID
(
req
.
GroupID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindGroupInfoByGroupId
failed "
,
req
.
GroupID
,
err
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupInfoByGroupID
failed "
,
req
.
GroupID
,
err
)
return
&
pbGroup
.
InviteUserToGroupResp
{
ErrCode
:
constant
.
ErrAccess
.
ErrCode
,
ErrMsg
:
constant
.
ErrAccess
.
ErrMsg
},
nil
}
//
...
...
@@ -209,7 +209,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
resultNode
.
Result
=
0
toUserInfo
,
err
:=
imdb
.
GetUserByUserID
(
v
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindUserByU
ID failed "
,
err
.
Error
(),
v
)
log
.
NewError
(
req
.
OperationID
,
"
GetUserByUser
ID failed "
,
err
.
Error
(),
v
)
resultNode
.
Result
=
-
1
resp
.
Id2ResultList
=
append
(
resp
.
Id2ResultList
,
&
resultNode
)
continue
...
...
@@ -253,7 +253,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
if
err
!=
nil
{
resp
.
ErrCode
=
constant
.
ErrDB
.
ErrCode
resp
.
ErrMsg
=
constant
.
ErrDB
.
ErrMsg
log
.
NewError
(
req
.
OperationID
,
"
FindGroupMemberListByGroupId
failed,"
,
err
.
Error
(),
req
.
GroupID
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupMemberListByGroupID
failed,"
,
err
.
Error
(),
req
.
GroupID
)
return
&
resp
,
nil
}
...
...
@@ -411,7 +411,7 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
for
_
,
groupID
:=
range
req
.
GroupIDList
{
groupInfoFromMysql
,
err
:=
im_mysql_model
.
GetGroupInfoByGroupID
(
groupID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindGroupInfoByGroupId
failed "
,
err
.
Error
(),
groupID
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupInfoByGroupID
failed "
,
err
.
Error
(),
groupID
)
continue
}
var
groupInfo
open_im_sdk
.
GroupInfo
...
...
@@ -482,7 +482,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
_
,
err
:=
imdb
.
GetGroupMemberInfoByGroupIDAndUserID
(
req
.
GroupID
,
req
.
OpUserID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindGroupMemberInfoByGroupIdAndUserId
failed"
,
err
.
Error
(),
req
.
GroupID
,
req
.
OpUserID
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupMemberInfoByGroupIDAndUserID
failed"
,
err
.
Error
(),
req
.
GroupID
,
req
.
OpUserID
)
return
&
pbGroup
.
QuitGroupResp
{
CommonResp
:
&
pbGroup
.
CommonResp
{
ErrCode
:
constant
.
ErrDB
.
ErrCode
,
ErrMsg
:
constant
.
ErrDB
.
ErrMsg
}},
nil
}
...
...
@@ -509,7 +509,7 @@ func hasAccess(req *pbGroup.SetGroupInfoReq) bool {
}
groupUserInfo
,
err
:=
im_mysql_model
.
GetGroupMemberInfoByGroupIDAndUserID
(
req
.
GroupInfo
.
GroupID
,
req
.
OpUserID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindGroupMemberInfoByGroupIdAndUserId
failed, "
,
err
.
Error
(),
req
.
GroupInfo
.
GroupID
,
req
.
OpUserID
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupMemberInfoByGroupIDAndUserID
failed, "
,
err
.
Error
(),
req
.
GroupInfo
.
GroupID
,
req
.
OpUserID
)
return
false
}
...
...
@@ -528,7 +528,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
group
,
err
:=
im_mysql_model
.
GetGroupInfoByGroupID
(
req
.
GroupInfo
.
GroupID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindGroupInfoByGroupId
failed "
,
err
.
Error
(),
req
.
GroupInfo
.
GroupID
)
log
.
NewError
(
req
.
OperationID
,
"
GetGroupInfoByGroupID
failed "
,
err
.
Error
(),
req
.
GroupInfo
.
GroupID
)
return
&
pbGroup
.
SetGroupInfoResp
{
CommonResp
:
&
pbGroup
.
CommonResp
{
ErrCode
:
constant
.
ErrDB
.
ErrCode
,
ErrMsg
:
constant
.
ErrAccess
.
ErrMsg
}},
nil
}
...
...
pkg/base_info/group_api_struct.go
浏览文件 @
40ed7258
...
...
@@ -76,15 +76,13 @@ type GetGroupAllMemberResp struct {
}
type
CreateGroupReq
struct
{
MemberList
[]
*
GroupAddMemberInfo
`json:"memberList" binding:"required"`
GroupName
string
`json:"groupName"`
Introduction
string
`json:"introduction"`
Notification
string
`json:"notification"`
FaceUrl
string
`json:"faceUrl"`
OperationID
string
`json:"operationID" binding:"required"`
GroupType
int32
`json:"groupType"`
Ex
string
`json:"ex"`
MemberList
[]
*
GroupAddMemberInfo
`json:"memberList" binding:"required"`
OwnerUserID
string
`json:"ownerUserID" binding:"required"`
GroupName
string
`json:"groupName"`
GroupType
int32
`json:"groupType"`
OperationID
string
`json:"operationID" binding:"required"`
}
type
CreateGroupResp
struct
{
CommResp
GroupInfo
open_im_sdk
.
GroupInfo
`json:"data"`
...
...
pkg/base_info/public_struct.go
浏览文件 @
40ed7258
...
...
@@ -27,23 +27,25 @@ func SetErrCodeMsg(c *gin.Context, status int) *CommResp {
return
&
resp
}
//
//GroupName string `json:"groupName"`
// Introduction string `json:"introduction"`
// Notification string `json:"notification"`
// FaceUrl string `json:"faceUrl"`
// OperationID string `json:"operationID" binding:"required"`
// GroupType int32 `json:"groupType"`
// Ex string `json:"ex"`
//type GroupInfo struct {
// GroupID string `json:"groupID"`
// GroupName string `json:"groupName"`
// Notification string `json:"notification"`
// Introduction string `json:"introduction"`
// FaceUrl string `json:"faceUrl"`
// OperationID string `json:"operationID"`
// OwnerUserID string `json:"ownerUserID"`
// CreateTime int64 `json:"createTime"`
// MemberCount uint32 `json:"memberCount"`
// Ex string `json:"ex"`
// Status int32 `json:"status"`
// CreatorUserID string `json:"creatorUserID"`
// GroupType int32 `json:"groupType"`
//}
//
//type GroupMemberFullInfo struct {
// GroupID string `json:"groupID"`
// UserID string `json:"userID"`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录