Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
f5829677
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,发现更多精彩内容 >>
提交
f5829677
编写于
12月 30, 2021
作者:
programor_guo
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
上级
68985e9e
7c3e429f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
10 deletion
+25
-10
cmd/open_im_api/main.go
cmd/open_im_api/main.go
+1
-1
internal/rpc/group/group.go
internal/rpc/group/group.go
+5
-2
pkg/common/db/mysql_model/im_mysql_model/group_member_model.go
...ommon/db/mysql_model/im_mysql_model/group_member_model.go
+1
-1
pkg/common/db/mysql_model/im_mysql_model/group_request_model.go
...mmon/db/mysql_model/im_mysql_model/group_request_model.go
+17
-5
pkg/common/db/mysql_model/im_mysql_model/model_struct.go
pkg/common/db/mysql_model/im_mysql_model/model_struct.go
+1
-1
未找到文件。
cmd/open_im_api/main.go
浏览文件 @
f5829677
...
...
@@ -50,7 +50,7 @@ func main() {
groupRouterGroup
.
POST
(
"/create_group"
,
group
.
CreateGroup
)
//1
groupRouterGroup
.
POST
(
"/set_group_info"
,
group
.
SetGroupInfo
)
//1
groupRouterGroup
.
POST
(
"join_group"
,
group
.
JoinGroup
)
groupRouterGroup
.
POST
(
"/quit_group"
,
group
.
QuitGroup
)
groupRouterGroup
.
POST
(
"/quit_group"
,
group
.
QuitGroup
)
//1
groupRouterGroup
.
POST
(
"/group_application_response"
,
group
.
ApplicationGroupResponse
)
groupRouterGroup
.
POST
(
"/transfer_group"
,
group
.
TransferGroupOwner
)
groupRouterGroup
.
POST
(
"/get_group_applicationList"
,
group
.
GetGroupApplicationList
)
...
...
internal/rpc/group/group.go
浏览文件 @
f5829677
...
...
@@ -453,12 +453,15 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
log
.
NewInfo
(
req
.
OperationID
,
"JoinGroup args "
,
req
.
String
())
_
,
err
:=
imdb
.
GetUserByUserID
(
req
.
OpUserID
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"
FindUserByU
ID failed "
,
err
.
Error
(),
req
.
OpUserID
)
log
.
NewError
(
req
.
OperationID
,
"
GetUserByUser
ID failed "
,
err
.
Error
(),
req
.
OpUserID
)
return
&
pbGroup
.
JoinGroupResp
{
CommonResp
:
&
pbGroup
.
CommonResp
{
ErrCode
:
constant
.
ErrDB
.
ErrCode
,
ErrMsg
:
constant
.
ErrDB
.
ErrMsg
}},
nil
}
var
groupRequest
imdb
.
GroupRequest
utils
.
CopyStructFields
(
&
groupRequest
,
req
)
groupRequest
.
UserID
=
req
.
OpUserID
groupRequest
.
ReqMsg
=
req
.
ReqMessage
groupRequest
.
GroupID
=
req
.
GroupID
err
=
imdb
.
UpdateGroupRequest
(
groupRequest
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"UpdateGroupRequest "
,
err
.
Error
(),
groupRequest
)
...
...
pkg/common/db/mysql_model/im_mysql_model/group_member_model.go
浏览文件 @
f5829677
...
...
@@ -116,7 +116,7 @@ func GetOwnerManagerByGroupID(groupID string) ([]GroupMember, error) {
return
nil
,
err
}
var
groupMemberList
[]
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and role_level>
0"
,
groupID
)
.
Find
(
&
groupMemberList
)
.
Error
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and role_level>
?"
,
groupID
,
constant
.
GroupOrdinaryUsers
)
.
Find
(
&
groupMemberList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
pkg/common/db/mysql_model/im_mysql_model/group_request_model.go
浏览文件 @
f5829677
...
...
@@ -3,6 +3,7 @@ package im_mysql_model
import
(
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
"Open_IM/pkg/utils"
"time"
)
...
...
@@ -23,11 +24,17 @@ func UpdateGroupRequest(groupRequest GroupRequest) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"group_request"
)
.
Where
(
"group_id=? and user_id=?"
,
groupRequest
.
GroupID
,
groupRequest
.
UserID
)
.
Update
(
&
groupRequest
)
.
Error
if
err
!=
nil
{
return
err
if
groupRequest
.
HandledTime
.
Unix
()
<
0
{
groupRequest
.
HandledTime
=
utils
.
UnixSecondToTime
(
0
)
}
//RowsAffected
if
dbConn
.
Table
(
"group_request"
)
.
Where
(
"group_id=? and user_id=?"
,
groupRequest
.
GroupID
,
groupRequest
.
UserID
)
.
Update
(
&
groupRequest
)
.
RowsAffected
==
0
{
return
InsertIntoGroupRequest
(
groupRequest
)
}
else
{
return
nil
}
return
nil
}
func
InsertIntoGroupRequest
(
toInsertInfo
GroupRequest
)
error
{
...
...
@@ -35,7 +42,12 @@ func InsertIntoGroupRequest(toInsertInfo GroupRequest) error {
if
err
!=
nil
{
return
err
}
toInsertInfo
.
HandledTime
=
time
.
Now
()
toInsertInfo
.
ReqTime
=
time
.
Now
()
if
toInsertInfo
.
HandledTime
.
Unix
()
<
0
{
toInsertInfo
.
HandledTime
=
utils
.
UnixSecondToTime
(
0
)
}
err
=
dbConn
.
Table
(
"group_request"
)
.
Create
(
&
toInsertInfo
)
.
Error
if
err
!=
nil
{
return
err
...
...
pkg/common/db/mysql_model/im_mysql_model/model_struct.go
浏览文件 @
f5829677
...
...
@@ -118,7 +118,7 @@ type GroupRequest struct {
GroupID
string
`gorm:"column:group_id;primaryKey;"`
HandleResult
int32
`gorm:"column:handle_result"`
ReqMsg
string
`gorm:"column:req_msg"`
HandledMsg
string
`gorm:"column:handle
d
_msg"`
HandledMsg
string
`gorm:"column:handle_msg"`
ReqTime
time
.
Time
`gorm:"column:req_time"`
HandleUserID
string
`gorm:"column:handle_user_id"`
HandledTime
time
.
Time
`gorm:"column:handle_time"`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录