Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
4d172ec4
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,发现更多精彩内容 >>
提交
4d172ec4
编写于
1月 14, 2022
作者:
W
wenxu12345
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor code
上级
6f411e96
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
129 addition
and
126 deletion
+129
-126
internal/rpc/group/group.go
internal/rpc/group/group.go
+1
-1
internal/rpc/msg/group_notification.go
internal/rpc/msg/group_notification.go
+111
-100
pkg/base_info/group_api_struct.go
pkg/base_info/group_api_struct.go
+8
-8
pkg/common/log/logrus.go
pkg/common/log/logrus.go
+9
-17
未找到文件。
internal/rpc/group/group.go
浏览文件 @
4d172ec4
...
@@ -141,7 +141,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
...
@@ -141,7 +141,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
resp
.
ErrMsg
=
constant
.
ErrDB
.
ErrMsg
resp
.
ErrMsg
=
constant
.
ErrDB
.
ErrMsg
return
resp
,
nil
return
resp
,
nil
}
}
chat
.
GroupCreatedNotification
(
req
.
OperationID
,
req
.
OpUserID
,
req
.
OwnerUserID
,
groupId
,
okUserIDList
)
chat
.
GroupCreatedNotification
(
req
.
OperationID
,
req
.
OpUserID
,
groupId
,
okUserIDList
)
utils
.
CopyStructFields
(
resp
.
GroupInfo
,
group
)
utils
.
CopyStructFields
(
resp
.
GroupInfo
,
group
)
resp
.
GroupInfo
.
MemberCount
,
err
=
imdb
.
GetGroupMemberNumByGroupID
(
groupId
)
resp
.
GroupInfo
.
MemberCount
,
err
=
imdb
.
GetGroupMemberNumByGroupID
(
groupId
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
internal/rpc/msg/group_notification.go
浏览文件 @
4d172ec4
package
msg
package
msg
import
(
import
(
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/constant"
imdb
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
imdb
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/log"
...
@@ -72,19 +73,12 @@ func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.Gro
...
@@ -72,19 +73,12 @@ func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.Gro
//}
//}
//创建群后调用
//创建群后调用
func
GroupCreatedNotification
(
operationID
,
opUserID
,
OwnerUserID
,
groupID
string
,
initMemberList
[]
string
)
{
func
GroupCreatedNotification
(
operationID
,
opUserID
,
groupID
string
,
initMemberList
[]
string
)
{
var
n
NotificationMsg
n
.
SendID
=
opUserID
n
.
RecvID
=
groupID
n
.
ContentType
=
constant
.
GroupCreatedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
GroupCreatedTips
:=
open_im_sdk
.
GroupCreatedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
GroupCreatedTips
:=
open_im_sdk
.
GroupCreatedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
Creator
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
Creator
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
if
err
:=
setOpUserInfo
(
GroupCreatedTips
.
Creator
.
UserID
,
groupID
,
GroupCreatedTips
.
Creator
);
err
!=
nil
{
if
err
:=
setOpUserInfo
(
GroupCreatedTips
.
Creator
.
UserID
,
groupID
,
GroupCreatedTips
.
Creator
);
err
!=
nil
{
log
.
NewError
(
operationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
GroupCreatedTips
.
Creator
.
UserID
,
groupID
,
GroupCreatedTips
.
Creator
)
log
.
NewError
(
operationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
GroupCreatedTips
.
Creator
.
UserID
,
groupID
,
GroupCreatedTips
.
Creator
)
return
}
}
err
:=
setGroupInfo
(
groupID
,
GroupCreatedTips
.
Group
)
err
:=
setGroupInfo
(
groupID
,
GroupCreatedTips
.
Group
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -99,6 +93,13 @@ func GroupCreatedNotification(operationID, opUserID, OwnerUserID, groupID string
...
@@ -99,6 +93,13 @@ func GroupCreatedNotification(operationID, opUserID, OwnerUserID, groupID string
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
GroupCreatedTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
GroupCreatedTips
)
tips
.
DefaultTips
=
config
.
Config
.
Notification
.
GroupCreated
.
DefaultTips
.
Tips
tips
.
DefaultTips
=
config
.
Config
.
Notification
.
GroupCreated
.
DefaultTips
.
Tips
var
n
NotificationMsg
n
.
SendID
=
opUserID
n
.
RecvID
=
groupID
n
.
ContentType
=
constant
.
GroupCreatedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
log
.
NewInfo
(
operationID
,
"Notification "
,
n
)
log
.
NewInfo
(
operationID
,
"Notification "
,
n
)
Notification
(
&
n
)
Notification
(
&
n
)
...
@@ -114,13 +115,6 @@ func GroupCreatedNotification(operationID, opUserID, OwnerUserID, groupID string
...
@@ -114,13 +115,6 @@ func GroupCreatedNotification(operationID, opUserID, OwnerUserID, groupID string
// OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"`
// OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"`
//申请进群后调用
//申请进群后调用
func
JoinApplicationNotification
(
req
*
pbGroup
.
JoinGroupReq
)
{
func
JoinApplicationNotification
(
req
*
pbGroup
.
JoinGroupReq
)
{
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
JoinApplicationNotification
n
.
SessionType
=
constant
.
SingleChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
JoinGroupApplicationTips
:=
open_im_sdk
.
JoinGroupApplicationTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
Applicant
:
&
open_im_sdk
.
PublicUserInfo
{}}
JoinGroupApplicationTips
:=
open_im_sdk
.
JoinGroupApplicationTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
Applicant
:
&
open_im_sdk
.
PublicUserInfo
{}}
err
:=
setGroupInfo
(
req
.
GroupID
,
JoinGroupApplicationTips
.
Group
)
err
:=
setGroupInfo
(
req
.
GroupID
,
JoinGroupApplicationTips
.
Group
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -139,6 +133,12 @@ func JoinApplicationNotification(req *pbGroup.JoinGroupReq) {
...
@@ -139,6 +133,12 @@ func JoinApplicationNotification(req *pbGroup.JoinGroupReq) {
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
JoinGroupApplicationTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
JoinGroupApplicationTips
)
tips
.
DefaultTips
=
"JoinGroupApplicationTips"
tips
.
DefaultTips
=
"JoinGroupApplicationTips"
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
JoinApplicationNotification
n
.
SessionType
=
constant
.
SingleChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
managerList
,
err
:=
imdb
.
GetOwnerManagerByGroupID
(
req
.
GroupID
)
managerList
,
err
:=
imdb
.
GetOwnerManagerByGroupID
(
req
.
GroupID
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -160,24 +160,29 @@ func JoinApplicationNotification(req *pbGroup.JoinGroupReq) {
...
@@ -160,24 +160,29 @@ func JoinApplicationNotification(req *pbGroup.JoinGroupReq) {
//}
//}
//处理进群请求后调用
//处理进群请求后调用
func
ApplicationProcessedNotification
(
req
*
pbGroup
.
GroupApplicationResponseReq
)
{
func
ApplicationProcessedNotification
(
req
*
pbGroup
.
GroupApplicationResponseReq
)
{
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
ApplicationProcessedNotification
n
.
SessionType
=
constant
.
SingleChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
RecvID
=
req
.
FromUserID
ApplicationProcessedTips
:=
open_im_sdk
.
ApplicationProcessedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
ApplicationProcessedTips
:=
open_im_sdk
.
ApplicationProcessedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
req
.
GroupID
,
ApplicationProcessedTips
.
Group
)
if
err
:=
setGroupInfo
(
req
.
GroupID
,
ApplicationProcessedTips
.
Group
);
err
!=
nil
{
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
ApplicationProcessedTips
.
OpUser
)
log
.
NewError
(
req
.
OperationID
,
"setGroupInfo failed "
,
err
.
Error
(),
req
.
GroupID
,
ApplicationProcessedTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
ApplicationProcessedTips
.
OpUser
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setOpUserInfo failed"
,
req
.
OpUserID
,
req
.
GroupID
,
ApplicationProcessedTips
.
OpUser
)
return
}
ApplicationProcessedTips
.
Reason
=
req
.
HandledMsg
ApplicationProcessedTips
.
Reason
=
req
.
HandledMsg
ApplicationProcessedTips
.
Result
=
req
.
HandleResult
ApplicationProcessedTips
.
Result
=
req
.
HandleResult
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
ApplicationProcessedTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
ApplicationProcessedTips
)
tips
.
DefaultTips
=
"ApplicationProcessedNotification"
tips
.
DefaultTips
=
"ApplicationProcessedNotification"
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
ApplicationProcessedNotification
n
.
SessionType
=
constant
.
SingleChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
RecvID
=
req
.
FromUserID
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
Notification
(
&
n
)
Notification
(
&
n
)
}
}
...
@@ -189,24 +194,32 @@ func ApplicationProcessedNotification(req *pbGroup.GroupApplicationResponseReq)
...
@@ -189,24 +194,32 @@ func ApplicationProcessedNotification(req *pbGroup.GroupApplicationResponseReq)
//}
//}
//被邀请进群后调用
//被邀请进群后调用
func
MemberInvitedNotification
(
operationID
,
groupID
,
opUserID
,
reason
string
,
invitedUserIDList
[]
string
)
{
func
MemberInvitedNotification
(
operationID
,
groupID
,
opUserID
,
reason
string
,
invitedUserIDList
[]
string
)
{
var
n
NotificationMsg
n
.
SendID
=
opUserID
n
.
ContentType
=
constant
.
MemberInvitedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
ApplicationProcessedTips
:=
open_im_sdk
.
MemberInvitedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
ApplicationProcessedTips
:=
open_im_sdk
.
MemberInvitedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
groupID
,
ApplicationProcessedTips
.
Group
)
if
err
:=
setGroupInfo
(
groupID
,
ApplicationProcessedTips
.
Group
);
err
!=
nil
{
setOpUserInfo
(
opUserID
,
groupID
,
ApplicationProcessedTips
.
OpUser
)
log
.
Error
(
operationID
,
"setGroupInfo failed "
,
err
.
Error
(),
groupID
,
ApplicationProcessedTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
opUserID
,
groupID
,
ApplicationProcessedTips
.
OpUser
);
err
!=
nil
{
log
.
Error
(
operationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
opUserID
,
groupID
,
ApplicationProcessedTips
.
OpUser
)
return
}
for
_
,
v
:=
range
invitedUserIDList
{
for
_
,
v
:=
range
invitedUserIDList
{
var
groupMemberInfo
open_im_sdk
.
GroupMemberFullInfo
var
groupMemberInfo
open_im_sdk
.
GroupMemberFullInfo
setGroupMemberInfo
(
groupID
,
v
,
&
groupMemberInfo
)
if
err
:=
setGroupMemberInfo
(
groupID
,
v
,
&
groupMemberInfo
);
err
!=
nil
{
log
.
Error
(
operationID
,
"setGroupMemberInfo faield "
,
err
.
Error
(),
groupID
)
continue
}
ApplicationProcessedTips
.
InvitedUserList
=
append
(
ApplicationProcessedTips
.
InvitedUserList
,
&
groupMemberInfo
)
ApplicationProcessedTips
.
InvitedUserList
=
append
(
ApplicationProcessedTips
.
InvitedUserList
,
&
groupMemberInfo
)
}
}
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
ApplicationProcessedTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
ApplicationProcessedTips
)
tips
.
DefaultTips
=
"MemberInvitedNotification"
tips
.
DefaultTips
=
"MemberInvitedNotification"
var
n
NotificationMsg
n
.
SendID
=
opUserID
n
.
ContentType
=
constant
.
MemberInvitedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
RecvID
=
groupID
n
.
RecvID
=
groupID
Notification
(
&
n
)
Notification
(
&
n
)
...
@@ -220,33 +233,42 @@ func MemberInvitedNotification(operationID, groupID, opUserID, reason string, in
...
@@ -220,33 +233,42 @@ func MemberInvitedNotification(operationID, groupID, opUserID, reason string, in
//}
//}
//被踢后调用
//被踢后调用
func
MemberKickedNotification
(
req
*
pbGroup
.
KickGroupMemberReq
,
kickedUserIDList
[]
string
)
{
func
MemberKickedNotification
(
req
*
pbGroup
.
KickGroupMemberReq
,
kickedUserIDList
[]
string
)
{
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
MemberKickedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
MemberKickedTips
:=
open_im_sdk
.
MemberKickedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
MemberKickedTips
:=
open_im_sdk
.
MemberKickedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
req
.
GroupID
,
MemberKickedTips
.
Group
)
if
err
:=
setGroupInfo
(
req
.
GroupID
,
MemberKickedTips
.
Group
);
err
!=
nil
{
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberKickedTips
.
OpUser
)
log
.
Error
(
req
.
OperationID
,
"setGroupInfo failed "
,
err
.
Error
(),
req
.
GroupID
,
MemberKickedTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberKickedTips
.
OpUser
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
req
.
OpUserID
,
req
.
GroupID
,
MemberKickedTips
.
OpUser
)
return
}
for
_
,
v
:=
range
kickedUserIDList
{
for
_
,
v
:=
range
kickedUserIDList
{
var
groupMemberInfo
open_im_sdk
.
GroupMemberFullInfo
var
groupMemberInfo
open_im_sdk
.
GroupMemberFullInfo
setGroupMemberInfo
(
req
.
GroupID
,
v
,
&
groupMemberInfo
)
if
err
:=
setGroupMemberInfo
(
req
.
GroupID
,
v
,
&
groupMemberInfo
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setGroupMemberInfo failed "
,
err
.
Error
(),
req
.
GroupID
,
v
)
continue
}
MemberKickedTips
.
KickedUserList
=
append
(
MemberKickedTips
.
KickedUserList
,
&
groupMemberInfo
)
MemberKickedTips
.
KickedUserList
=
append
(
MemberKickedTips
.
KickedUserList
,
&
groupMemberInfo
)
}
}
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberKickedTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberKickedTips
)
tips
.
DefaultTips
=
"MemberKickedNotification"
tips
.
DefaultTips
=
"MemberKickedNotification"
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
MemberKickedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
RecvID
=
req
.
GroupID
n
.
RecvID
=
req
.
GroupID
Notification
(
&
n
)
Notification
(
&
n
)
for
_
,
v
:=
range
kickedUserIDList
{
for
_
,
v
:=
range
kickedUserIDList
{
n
.
SessionType
=
constant
.
SingleChatType
m
:=
n
n
.
RecvID
=
v
m
.
SessionType
=
constant
.
SingleChatType
Notification
(
&
n
)
m
.
RecvID
=
v
Notification
(
&
m
)
}
}
}
}
...
@@ -258,49 +280,29 @@ func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList
...
@@ -258,49 +280,29 @@ func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList
//群信息改变后掉用
//群信息改变后掉用
func
GroupInfoChangedNotification
(
operationID
,
opUserID
,
groupID
string
,
changedType
int32
)
{
func
GroupInfoChangedNotification
(
operationID
,
opUserID
,
groupID
string
,
changedType
int32
)
{
var
n
NotificationMsg
n
.
SendID
=
opUserID
n
.
ContentType
=
constant
.
GroupInfoChangedNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
GroupInfoChangedTips
:=
open_im_sdk
.
GroupInfoChangedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
GroupInfoChangedTips
:=
open_im_sdk
.
GroupInfoChangedTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
OpUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
groupID
,
GroupInfoChangedTips
.
Group
)
if
err
:=
setGroupInfo
(
groupID
,
GroupInfoChangedTips
.
Group
);
err
!=
nil
{
setOpUserInfo
(
opUserID
,
groupID
,
GroupInfoChangedTips
.
OpUser
)
log
.
Error
(
operationID
,
"setGroupInfo failed "
,
err
.
Error
(),
groupID
,
GroupInfoChangedTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
opUserID
,
groupID
,
GroupInfoChangedTips
.
OpUser
);
err
!=
nil
{
log
.
Error
(
operationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
opUserID
,
groupID
,
GroupInfoChangedTips
.
OpUser
)
return
}
GroupInfoChangedTips
.
ChangedType
=
changedType
GroupInfoChangedTips
.
ChangedType
=
changedType
var
tips
open_im_sdk
.
TipsComm
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
GroupInfoChangedTips
)
tips
.
Detail
,
_
=
json
.
Marshal
(
GroupInfoChangedTips
)
tips
.
DefaultTips
=
"GroupInfoChangedNotification"
tips
.
DefaultTips
=
"GroupInfoChangedNotification"
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
RecvID
=
groupID
Notification
(
&
n
)
}
/*
func GroupInfoChangedNotification(operationID string, changedType int32, group *immysql.Group, opUser *immysql.GroupMember) {
var
n
NotificationMsg
var
n
NotificationMsg
n.SendID = opUser.UserID
n
.
SendID
=
opUserID
n.RecvID = group.GroupID
n
.
ContentType
=
constant
.
GroupInfoChangedNotification
n.ContentType = constant.ChangeGroupInfoTip
n
.
SessionType
=
constant
.
GroupChatType
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
operationID
n
.
OperationID
=
operationID
var groupInfoChanged open_im_sdk.GroupInfoChangedTips
groupInfoChanged.Group = &open_im_sdk.GroupInfo{}
utils.CopyStructFields(groupInfoChanged.Group, group)
groupInfoChanged.OpUser = &open_im_sdk.GroupMemberFullInfo{}
utils.CopyStructFields(groupInfoChanged.OpUser, opUser)
groupInfoChanged.ChangedType = changedType
var tips open_im_sdk.TipsComm
tips.Detail, _ = json.Marshal(groupInfoChanged)
tips.DefaultTips = config.Config.Notification.GroupInfoChanged.DefaultTips.Tips
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
Notification(&n, false)
n
.
RecvID
=
groupID
Notification
(
&
n
)
}
}
*/
//message MemberLeaveTips{
//message MemberLeaveTips{
// GroupInfo Group = 1;
// GroupInfo Group = 1;
...
@@ -310,27 +312,33 @@ func GroupInfoChangedNotification(operationID string, changedType int32, group *
...
@@ -310,27 +312,33 @@ func GroupInfoChangedNotification(operationID string, changedType int32, group *
//群成员退群后调用
//群成员退群后调用
func
MemberLeaveNotification
(
req
*
pbGroup
.
QuitGroupReq
)
{
func
MemberLeaveNotification
(
req
*
pbGroup
.
QuitGroupReq
)
{
MemberLeaveTips
:=
open_im_sdk
.
MemberLeaveTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
LeaverUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
if
err
:=
setGroupInfo
(
req
.
GroupID
,
MemberLeaveTips
.
Group
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setGroupInfo failed "
,
err
.
Error
(),
req
.
GroupID
,
MemberLeaveTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
LeaverUser
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
LeaverUser
)
return
}
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberLeaveTips
)
tips
.
DefaultTips
=
"MemberLeaveNotification"
var
n
NotificationMsg
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
MemberLeaveNotification
n
.
ContentType
=
constant
.
MemberLeaveNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
OperationID
=
req
.
OperationID
MemberLeaveTips
:=
open_im_sdk
.
MemberLeaveTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
LeaverUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
req
.
GroupID
,
MemberLeaveTips
.
Group
)
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
LeaverUser
)
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberLeaveTips
)
tips
.
DefaultTips
=
"MemberLeaveNotification"
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
RecvID
=
req
.
GroupID
n
.
RecvID
=
req
.
GroupID
Notification
(
&
n
)
Notification
(
&
n
)
m
:=
n
n
.
SessionType
=
constant
.
SingleChatType
n
.
SessionType
=
constant
.
SingleChatType
n
.
RecvID
=
req
.
OpUserID
n
.
RecvID
=
req
.
OpUserID
Notification
(
&
n
)
Notification
(
&
m
)
}
}
//message MemberEnterTips{
//message MemberEnterTips{
...
@@ -340,22 +348,25 @@ func MemberLeaveNotification(req *pbGroup.QuitGroupReq) {
...
@@ -340,22 +348,25 @@ func MemberLeaveNotification(req *pbGroup.QuitGroupReq) {
//}
//}
//群成员主动申请进群,管理员同意后调用,
//群成员主动申请进群,管理员同意后调用,
func
MemberEnterNotification
(
req
*
pbGroup
.
GroupApplicationResponseReq
)
{
func
MemberEnterNotification
(
req
*
pbGroup
.
GroupApplicationResponseReq
)
{
MemberLeaveTips
:=
open_im_sdk
.
MemberEnterTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
EntrantUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
if
err
:=
setGroupInfo
(
req
.
GroupID
,
MemberLeaveTips
.
Group
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setGroupInfo failed "
,
err
.
Error
(),
req
.
GroupID
,
MemberLeaveTips
.
Group
)
return
}
if
err
:=
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
EntrantUser
);
err
!=
nil
{
log
.
Error
(
req
.
OperationID
,
"setOpUserInfo failed "
,
err
.
Error
(),
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
EntrantUser
)
return
}
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberLeaveTips
)
tips
.
DefaultTips
=
"MemberEnterNotification"
var
n
NotificationMsg
var
n
NotificationMsg
n
.
SendID
=
req
.
OpUserID
n
.
SendID
=
req
.
OpUserID
n
.
ContentType
=
constant
.
MemberEnterNotification
n
.
ContentType
=
constant
.
MemberEnterNotification
n
.
SessionType
=
constant
.
GroupChatType
n
.
SessionType
=
constant
.
GroupChatType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
MsgFrom
=
constant
.
SysMsgType
n
.
OperationID
=
req
.
OperationID
n
.
OperationID
=
req
.
OperationID
MemberLeaveTips
:=
open_im_sdk
.
MemberEnterTips
{
Group
:
&
open_im_sdk
.
GroupInfo
{},
EntrantUser
:
&
open_im_sdk
.
GroupMemberFullInfo
{}}
setGroupInfo
(
req
.
GroupID
,
MemberLeaveTips
.
Group
)
setOpUserInfo
(
req
.
OpUserID
,
req
.
GroupID
,
MemberLeaveTips
.
EntrantUser
)
var
tips
open_im_sdk
.
TipsComm
tips
.
Detail
,
_
=
json
.
Marshal
(
MemberLeaveTips
)
tips
.
DefaultTips
=
"MemberEnterNotification"
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
Content
,
_
=
json
.
Marshal
(
tips
)
n
.
RecvID
=
req
.
GroupID
n
.
RecvID
=
req
.
GroupID
Notification
(
&
n
)
Notification
(
&
n
)
}
}
pkg/base_info/group_api_struct.go
浏览文件 @
4d172ec4
...
@@ -54,7 +54,7 @@ type GetJoinedGroupListReq struct {
...
@@ -54,7 +54,7 @@ type GetJoinedGroupListReq struct {
}
}
type
GetJoinedGroupListResp
struct
{
type
GetJoinedGroupListResp
struct
{
CommResp
CommResp
GroupInfoList
[]
*
open_im_sdk
.
GroupInfo
GroupInfoList
[]
*
open_im_sdk
.
GroupInfo
`json:"-"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
}
}
...
@@ -66,9 +66,9 @@ type GetGroupMemberListReq struct {
...
@@ -66,9 +66,9 @@ type GetGroupMemberListReq struct {
}
}
type
GetGroupMemberListResp
struct
{
type
GetGroupMemberListResp
struct
{
CommResp
CommResp
NextSeq
int32
`json:"nextSeq"`
NextSeq
int32
`json:"nextSeq"`
MemberList
[]
*
open_im_sdk
.
GroupMemberFullInfo
MemberList
[]
*
open_im_sdk
.
GroupMemberFullInfo
`json:"-"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
}
}
type
GetGroupAllMemberReq
struct
{
type
GetGroupAllMemberReq
struct
{
...
@@ -90,7 +90,7 @@ type CreateGroupReq struct {
...
@@ -90,7 +90,7 @@ type CreateGroupReq struct {
}
}
type
CreateGroupResp
struct
{
type
CreateGroupResp
struct
{
CommResp
CommResp
GroupInfo
open_im_sdk
.
GroupInfo
GroupInfo
open_im_sdk
.
GroupInfo
`jason:-`
Data
map
[
string
]
interface
{}
`json:"data"`
Data
map
[
string
]
interface
{}
`json:"data"`
}
}
...
@@ -100,8 +100,8 @@ type GetGroupApplicationListReq struct {
...
@@ -100,8 +100,8 @@ type GetGroupApplicationListReq struct {
}
}
type
GetGroupApplicationListResp
struct
{
type
GetGroupApplicationListResp
struct
{
CommResp
CommResp
GroupRequestList
[]
*
open_im_sdk
.
GroupRequest
GroupRequestList
[]
*
open_im_sdk
.
GroupRequest
`json:"-"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
}
}
type
GetGroupInfoReq
struct
{
type
GetGroupInfoReq
struct
{
...
@@ -110,7 +110,7 @@ type GetGroupInfoReq struct {
...
@@ -110,7 +110,7 @@ type GetGroupInfoReq struct {
}
}
type
GetGroupInfoResp
struct
{
type
GetGroupInfoResp
struct
{
CommResp
CommResp
GroupInfoList
[]
*
open_im_sdk
.
GroupInfo
GroupInfoList
[]
*
open_im_sdk
.
GroupInfo
`json:"-"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
}
}
...
...
pkg/common/log/logrus.go
浏览文件 @
4d172ec4
...
@@ -88,33 +88,25 @@ func initRotateLogs(rotationTime time.Duration, maxRemainNum uint, level string,
...
@@ -88,33 +88,25 @@ func initRotateLogs(rotationTime time.Duration, maxRemainNum uint, level string,
}
}
}
}
//Deprecated
func
Info
(
OperationID
string
,
args
...
interface
{})
{
func
Info
(
token
,
OperationID
,
format
string
,
args
...
interface
{})
{
logger
.
WithFields
(
logrus
.
Fields
{
logger
.
WithFields
(
logrus
.
Fields
{
"PID"
:
logger
.
Pid
,
"OperationID"
:
OperationID
,
"OperationID"
:
OperationID
,
})
.
Infof
(
format
,
args
...
)
"PID"
:
logger
.
Pid
,
})
.
Infoln
(
args
)
}
}
//Deprecated
func
Error
(
OperationID
string
,
args
...
interface
{})
{
func
Error
(
token
,
OperationID
,
format
string
,
args
...
interface
{})
{
logger
.
WithFields
(
logrus
.
Fields
{
logger
.
WithFields
(
logrus
.
Fields
{
"PID"
:
logger
.
Pid
,
"OperationID"
:
OperationID
,
"OperationID"
:
OperationID
,
})
.
Errorf
(
format
,
args
...
)
"PID"
:
logger
.
Pid
,
})
.
Errorln
(
args
)
}
}
//Deprecated
func
Debug
(
OperationID
string
,
args
...
interface
{})
{
func
Debug
(
token
,
OperationID
,
format
string
,
args
...
interface
{})
{
logger
.
WithFields
(
logrus
.
Fields
{
logger
.
WithFields
(
logrus
.
Fields
{
"PID"
:
logger
.
Pid
,
"OperationID"
:
OperationID
,
"OperationID"
:
OperationID
,
})
.
Debugf
(
format
,
args
...
)
"PID"
:
logger
.
Pid
,
})
.
Debugln
(
args
)
}
}
//Deprecated
//Deprecated
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录