Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
c2342642
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,发现更多精彩内容 >>
提交
c2342642
编写于
1月 19, 2022
作者:
programor_guo
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
上级
de524392
83e842d1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
14 deletion
+21
-14
internal/api/group/group.go
internal/api/group/group.go
+6
-3
internal/api/user/user.go
internal/api/user/user.go
+2
-3
internal/rpc/group/group.go
internal/rpc/group/group.go
+2
-1
pkg/base_info/group_api_struct.go
pkg/base_info/group_api_struct.go
+8
-4
pkg/base_info/user_api_struct.go
pkg/base_info/user_api_struct.go
+2
-2
pkg/common/db/mysql.go
pkg/common/db/mysql.go
+1
-1
未找到文件。
internal/api/group/group.go
浏览文件 @
c2342642
...
...
@@ -245,8 +245,9 @@ func CreateGroup(c *gin.Context) {
c
.
JSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"errCode"
:
400
,
"errMsg"
:
err
.
Error
()})
return
}
req
:=
&
rpc
.
CreateGroupReq
{}
utils
.
CopyStructFields
(
req
,
&
params
)
req
:=
&
rpc
.
CreateGroupReq
{
GroupInfo
:
&
open_im_sdk
.
GroupInfo
{}}
utils
.
CopyStructFields
(
req
.
GroupInfo
,
&
params
)
for
_
,
v
:=
range
params
.
MemberList
{
req
.
InitMemberList
=
append
(
req
.
InitMemberList
,
&
rpc
.
GroupAddMemberInfo
{
UserID
:
v
.
UserID
,
RoleLevel
:
v
.
RoleLevel
})
}
...
...
@@ -257,6 +258,8 @@ func CreateGroup(c *gin.Context) {
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"errCode"
:
500
,
"errMsg"
:
"GetUserIDFromToken failed"
})
return
}
req
.
OwnerUserID
=
req
.
OpUserID
req
.
OperationID
=
params
.
OperationID
log
.
NewInfo
(
req
.
OperationID
,
"CreateGroup args "
,
req
.
String
())
etcdConn
:=
getcdv3
.
GetConn
(
config
.
Config
.
Etcd
.
EtcdSchema
,
strings
.
Join
(
config
.
Config
.
Etcd
.
EtcdAddr
,
","
),
config
.
Config
.
RpcRegisterName
.
OpenImGroupName
)
...
...
@@ -447,7 +450,7 @@ func SetGroupInfo(c *gin.Context) {
return
}
req
:=
&
rpc
.
SetGroupInfoReq
{
GroupInfo
:
&
open_im_sdk
.
GroupInfo
{}}
utils
.
CopyStructFields
(
req
.
GroupInfo
,
&
params
.
Group
)
utils
.
CopyStructFields
(
req
.
GroupInfo
,
&
params
)
req
.
OperationID
=
params
.
OperationID
var
ok
bool
ok
,
req
.
OpUserID
=
token_verify
.
GetUserIDFromToken
(
c
.
Request
.
Header
.
Get
(
"token"
))
...
...
internal/api/user/user.go
浏览文件 @
c2342642
...
...
@@ -115,13 +115,12 @@ func GetSelfUserInfo(c *gin.Context) {
return
}
if
len
(
RpcResp
.
UserInfoList
)
==
1
{
resp
:=
api
.
GetSelfUserInfoResp
{
CommResp
:
api
.
CommResp
{
ErrCode
:
RpcResp
.
CommonResp
.
ErrCode
,
ErrMsg
:
RpcResp
.
CommonResp
.
ErrMsg
},
UserInfo
List
:
RpcResp
.
UserInfoList
[
0
]}
resp
.
Data
=
jsonData
.
JsonData
List
(
resp
.
UserInfoList
)
resp
:=
api
.
GetSelfUserInfoResp
{
CommResp
:
api
.
CommResp
{
ErrCode
:
RpcResp
.
CommonResp
.
ErrCode
,
ErrMsg
:
RpcResp
.
CommonResp
.
ErrMsg
},
UserInfo
:
RpcResp
.
UserInfoList
[
0
]}
resp
.
Data
=
jsonData
.
JsonData
One
(
resp
.
UserInfo
)
log
.
NewInfo
(
req
.
OperationID
,
"GetUserInfo api return "
,
resp
)
c
.
JSON
(
http
.
StatusOK
,
resp
)
}
else
{
resp
:=
api
.
GetSelfUserInfoResp
{
CommResp
:
api
.
CommResp
{
ErrCode
:
RpcResp
.
CommonResp
.
ErrCode
,
ErrMsg
:
RpcResp
.
CommonResp
.
ErrMsg
}}
resp
.
Data
=
jsonData
.
JsonDataList
(
resp
.
UserInfoList
)
log
.
NewInfo
(
req
.
OperationID
,
"GetUserInfo api return "
,
resp
)
c
.
JSON
(
http
.
StatusOK
,
resp
)
}
...
...
internal/rpc/group/group.go
浏览文件 @
c2342642
...
...
@@ -78,9 +78,10 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
//Time stamp + MD5 to generate group chat id
groupId
:=
utils
.
Md5
(
strconv
.
FormatInt
(
time
.
Now
()
.
UnixNano
(),
10
))
//to group
groupInfo
:=
db
.
Group
{
GroupID
:
groupId
}
groupInfo
:=
db
.
Group
{}
utils
.
CopyStructFields
(
&
groupInfo
,
req
.
GroupInfo
)
groupInfo
.
CreatorUserID
=
req
.
OpUserID
groupInfo
.
GroupID
=
groupId
err
:=
imdb
.
InsertIntoGroup
(
groupInfo
)
if
err
!=
nil
{
log
.
NewError
(
req
.
OperationID
,
"InsertIntoGroup failed, "
,
err
.
Error
(),
groupInfo
)
...
...
pkg/base_info/group_api_struct.go
浏览文件 @
c2342642
package
base_info
import
(
"Open_IM/pkg/common/db"
open_im_sdk
"Open_IM/pkg/proto/sdk_ws"
)
...
...
@@ -90,7 +89,7 @@ type CreateGroupReq struct {
}
type
CreateGroupResp
struct
{
CommResp
GroupInfo
open_im_sdk
.
GroupInfo
`j
ason:-
`
GroupInfo
open_im_sdk
.
GroupInfo
`j
son:"-"
`
Data
map
[
string
]
interface
{}
`json:"data"`
}
...
...
@@ -143,8 +142,13 @@ type QuitGroupResp struct {
}
type
SetGroupInfoReq
struct
{
db
.
Group
OperationID
string
`json:"operationID" binding:"required"`
GroupID
string
`json:"groupID" binding:"required"`
GroupName
string
`json:"groupName"`
Notification
string
`json:"notification"`
Introduction
string
`json:"introduction"`
FaceURL
string
`json:"faceURL"`
Ex
string
`json:"ex"`
OperationID
string
`json:"operationID" binding:"required"`
}
type
SetGroupInfoResp
struct
{
CommResp
...
...
pkg/base_info/user_api_struct.go
浏览文件 @
c2342642
...
...
@@ -29,6 +29,6 @@ type GetSelfUserInfoReq struct {
}
type
GetSelfUserInfoResp
struct
{
CommResp
UserInfo
List
*
open_im_sdk
.
UserInfo
`json:"-"`
Data
[]
map
[
string
]
interface
{}
`json:"data"`
UserInfo
*
open_im_sdk
.
UserInfo
`json:"-"`
Data
map
[
string
]
interface
{}
`json:"data"`
}
pkg/common/db/mysql.go
浏览文件 @
c2342642
...
...
@@ -44,7 +44,7 @@ func initMysqlDB() {
db
.
Close
()
dsn
=
fmt
.
Sprintf
(
"%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local"
,
config
.
Config
.
Mysql
.
DBUserName
,
config
.
Config
.
Mysql
.
DBPassword
,
config
.
Config
.
Mysql
.
DBAddress
[
0
],
config
.
Config
.
Mysql
.
DBDatabaseName
+
"test1"
)
config
.
Config
.
Mysql
.
DBUserName
,
config
.
Config
.
Mysql
.
DBPassword
,
config
.
Config
.
Mysql
.
DBAddress
[
0
],
config
.
Config
.
Mysql
.
DBDatabaseName
)
db
,
err
=
gorm
.
Open
(
"mysql"
,
dsn
)
if
err
!=
nil
{
log
.
NewError
(
"0"
,
"Open failed "
,
err
.
Error
(),
dsn
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录