Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
17b96dd7
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,发现更多精彩内容 >>
提交
17b96dd7
编写于
1月 15, 2022
作者:
W
wenxu12345
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor code
上级
b2c2c124
变更
8
展开全部
显示空白变更内容
内联
并排
Showing
8 changed file
with
348 addition
and
318 deletion
+348
-318
cmd/open_im_api/main.go
cmd/open_im_api/main.go
+9
-7
internal/api/friend/friend.go
internal/api/friend/friend.go
+2
-2
internal/rpc/group/group.go
internal/rpc/group/group.go
+14
-1
pkg/common/db/mysql_model/im_mysql_model/group_model.go
pkg/common/db/mysql_model/im_mysql_model/group_model.go
+2
-1
pkg/common/utils/utils.go
pkg/common/utils/utils.go
+4
-0
pkg/proto/group/group.pb.go
pkg/proto/group/group.pb.go
+113
-113
pkg/proto/group/group.proto
pkg/proto/group/group.proto
+9
-9
pkg/proto/sdk_ws/ws.pb.go
pkg/proto/sdk_ws/ws.pb.go
+195
-185
未找到文件。
cmd/open_im_api/main.go
浏览文件 @
17b96dd7
...
...
@@ -26,7 +26,7 @@ func main() {
userRouterGroup
:=
r
.
Group
(
"/user"
)
{
userRouterGroup
.
POST
(
"/update_user_info"
,
user
.
UpdateUserInfo
)
//1
userRouterGroup
.
POST
(
"/get_user
_info"
,
user
.
GetUsersInfo
)
//1
userRouterGroup
.
POST
(
"/get_user
s_info"
,
user
.
GetUsersInfo
)
//1
userRouterGroup
.
POST
(
"/get_self_user_info"
,
user
.
GetSelfUserInfo
)
//1
}
//friend routing group
...
...
@@ -34,17 +34,19 @@ func main() {
{
// friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo)
friendRouterGroup
.
POST
(
"/add_friend"
,
friend
.
AddFriend
)
//1
friendRouterGroup
.
POST
(
"/delete_friend"
,
friend
.
DeleteFriend
)
//1
friendRouterGroup
.
POST
(
"/get_friend_apply_list"
,
friend
.
GetFriendApplyList
)
//1
friendRouterGroup
.
POST
(
"/get_self_apply_list"
,
friend
.
GetSelfApplyList
)
//1
friendRouterGroup
.
POST
(
"/get_friend_list"
,
friend
.
GetFriendList
)
//1
friendRouterGroup
.
POST
(
"/add_blacklist"
,
friend
.
AddBlacklist
)
//1
friendRouterGroup
.
POST
(
"/get_blacklist"
,
friend
.
GetBlacklist
)
//1
friendRouterGroup
.
POST
(
"/remove_blacklist"
,
friend
.
RemoveBlacklist
)
//1
friendRouterGroup
.
POST
(
"/delete_friend"
,
friend
.
DeleteFriend
)
//1
friendRouterGroup
.
POST
(
"/add_friend_response"
,
friend
.
AddFriendResponse
)
//1
friendRouterGroup
.
POST
(
"/set_friend_remark"
,
friend
.
SetFriendRemark
)
//1
friendRouterGroup
.
POST
(
"/is_friend"
,
friend
.
IsFriend
)
//1
friendRouterGroup
.
POST
(
"/add_black"
,
friend
.
AddBlack
)
//1
friendRouterGroup
.
POST
(
"/get_black_list"
,
friend
.
GetBlacklist
)
//1
friendRouterGroup
.
POST
(
"/remove_black"
,
friend
.
RemoveBlack
)
//1
friendRouterGroup
.
POST
(
"/import_friend"
,
friend
.
ImportFriend
)
//1
friendRouterGroup
.
POST
(
"/is_friend"
,
friend
.
IsFriend
)
//1
}
//group related routing group
groupRouterGroup
:=
r
.
Group
(
"/group"
)
...
...
internal/api/friend/friend.go
浏览文件 @
17b96dd7
...
...
@@ -16,7 +16,7 @@ import (
"strings"
)
func
AddBlack
list
(
c
*
gin
.
Context
)
{
func
AddBlack
(
c
*
gin
.
Context
)
{
params
:=
api
.
AddBlacklistReq
{}
if
err
:=
c
.
BindJSON
(
&
params
);
err
!=
nil
{
log
.
NewError
(
"0"
,
"BindJSON failed "
,
err
.
Error
())
...
...
@@ -257,7 +257,7 @@ func SetFriendRemark(c *gin.Context) {
c
.
JSON
(
http
.
StatusOK
,
resp
)
}
func
RemoveBlack
list
(
c
*
gin
.
Context
)
{
func
RemoveBlack
(
c
*
gin
.
Context
)
{
params
:=
api
.
RemoveBlackListReq
{}
if
err
:=
c
.
BindJSON
(
&
params
);
err
!=
nil
{
log
.
NewError
(
"0"
,
"BindJSON failed "
,
err
.
Error
())
...
...
internal/rpc/group/group.go
浏览文件 @
17b96dd7
...
...
@@ -407,8 +407,21 @@ func (s *groupServer) GetGroupApplicationList(_ context.Context, req *pbGroup.Ge
log
.
NewDebug
(
req
.
OperationID
,
"GetGroupApplicationList reply "
,
reply
)
resp
:=
pbGroup
.
GetGroupApplicationListResp
{}
for
_
,
v
:=
range
reply
{
var
node
open_im_sdk
.
GroupRequest
node
:=
open_im_sdk
.
GroupRequest
{
UserInfo
:
&
open_im_sdk
.
PublicUserInfo
{},
GroupInfo
:
&
open_im_sdk
.
GroupInfo
{}}
group
,
err
:=
imdb
.
GetGroupInfoByGroupID
(
v
.
GroupID
)
if
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"GetGroupInfoByGroupID failed "
,
err
.
Error
(),
v
.
GroupID
)
continue
}
user
,
err
:=
imdb
.
GetUserByUserID
(
v
.
UserID
)
if
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"GetUserByUserID failed "
,
err
.
Error
(),
v
.
UserID
)
continue
}
cp
.
GroupRequestDBCopyOpenIM
(
&
node
,
&
v
)
cp
.
UserDBCopyOpenIMPublic
(
node
.
UserInfo
,
user
)
cp
.
GroupDBCopyOpenIM
(
node
.
GroupInfo
,
group
)
log
.
NewDebug
(
req
.
OperationID
,
"node "
,
node
,
"v "
,
v
)
resp
.
GroupRequestList
=
append
(
resp
.
GroupRequestList
,
&
node
)
}
...
...
pkg/common/db/mysql_model/im_mysql_model/group_model.go
浏览文件 @
17b96dd7
...
...
@@ -2,6 +2,7 @@ package im_mysql_model
import
(
"Open_IM/pkg/common/db"
"Open_IM/pkg/utils"
"time"
)
...
...
@@ -37,7 +38,7 @@ func InsertIntoGroup(groupInfo db.Group) error {
func
GetGroupInfoByGroupID
(
groupId
string
)
(
*
db
.
Group
,
error
)
{
dbConn
,
err
:=
db
.
DB
.
MysqlDB
.
DefaultGormDB
()
if
err
!=
nil
{
return
nil
,
err
return
nil
,
utils
.
Wrap
(
err
,
""
)
}
var
groupInfo
db
.
Group
err
=
dbConn
.
Table
(
"groups"
)
.
Where
(
"group_id=?"
,
groupId
)
.
Find
(
&
groupInfo
)
.
Error
...
...
pkg/common/utils/utils.go
浏览文件 @
17b96dd7
...
...
@@ -114,6 +114,10 @@ func BlackDBCopyOpenIM(dst *open_im_sdk.BlackInfo, src *db.Black) {
}
}
func
UserDBCopyOpenIMPublic
(
dst
*
open_im_sdk
.
PublicUserInfo
,
src
*
db
.
User
)
{
utils
.
CopyStructFields
(
dst
,
src
)
}
//
//func PublicUserDBCopyOpenIM(dst *open_im_sdk.PublicUserInfo, src *db.User){
//
...
...
pkg/proto/group/group.pb.go
浏览文件 @
17b96dd7
此差异已折叠。
点击以展开。
pkg/proto/group/group.proto
浏览文件 @
17b96dd7
...
...
@@ -16,7 +16,7 @@ message GroupAddMemberInfo{
message
CreateGroupReq
{
repeated
GroupAddMemberInfo
InitMemberList
=
1
;
open_im_sdk
.GroupInfo
GroupInfo
=
2
;
server_api_params
.GroupInfo
GroupInfo
=
2
;
string
OperationID
=
3
;
string
OpUserID
=
4
;
//app manager or group owner
string
OwnerUserID
=
5
;
//owner
...
...
@@ -24,7 +24,7 @@ message CreateGroupReq{
message
CreateGroupResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
open_im_sdk
.GroupInfo
GroupInfo
=
3
;
server_api_params
.GroupInfo
GroupInfo
=
3
;
}
...
...
@@ -36,12 +36,12 @@ message GetGroupsInfoReq{
message
GetGroupsInfoResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupInfo
GroupInfoList
=
3
;
repeated
server_api_params
.GroupInfo
GroupInfoList
=
3
;
}
message
SetGroupInfoReq
{
open_im_sdk
.GroupInfo
GroupInfo
=
1
;
server_api_params
.GroupInfo
GroupInfo
=
1
;
string
OpUserID
=
2
;
//app manager or group owner
string
OperationID
=
3
;
}
...
...
@@ -58,7 +58,7 @@ message GetGroupApplicationListReq {
message
GetGroupApplicationListResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupRequest
GroupRequestList
=
3
;
repeated
server_api_params
.GroupRequest
GroupRequestList
=
3
;
}
...
...
@@ -120,7 +120,7 @@ message GetGroupMemberListReq {
message
GetGroupMemberListResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupMemberFullInfo
memberList
=
3
;
repeated
server_api_params
.GroupMemberFullInfo
memberList
=
3
;
int32
nextSeq
=
4
;
}
...
...
@@ -135,7 +135,7 @@ message GetGroupMembersInfoReq {
message
GetGroupMembersInfoResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupMemberFullInfo
memberList
=
3
;
repeated
server_api_params
.GroupMemberFullInfo
memberList
=
3
;
}
message
KickGroupMemberReq
{
...
...
@@ -166,7 +166,7 @@ message GetJoinedGroupListReq {
message
GetJoinedGroupListResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupInfo
GroupList
=
3
;
repeated
server_api_params
.GroupInfo
GroupList
=
3
;
}
...
...
@@ -192,7 +192,7 @@ message GetGroupAllMemberReq {
message
GetGroupAllMemberResp
{
int32
ErrCode
=
1
;
string
ErrMsg
=
2
;
repeated
open_im_sdk
.GroupMemberFullInfo
memberList
=
3
;
repeated
server_api_params
.GroupMemberFullInfo
memberList
=
3
;
}
...
...
pkg/proto/sdk_ws/ws.pb.go
浏览文件 @
17b96dd7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录