Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
im-microservice
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Li Feifei
im-microservice
Commits
85d1b88d
Commit
85d1b88d
authored
Jul 01, 2020
by
李洪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户信息
parent
f86d4ced
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
68 deletions
+81
-68
db_struct.go
db/db_struct.go
+1
-1
im_user.pb.go
pb/im_user.pb.go
+24
-24
im_user.go
sevice/im_user/im_user.go
+28
-23
im_user_db.go
sevice/im_user/im_user_db.go
+23
-15
im_user.proto
u-proto/im_user.proto
+5
-5
No files found.
db/db_struct.go
View file @
85d1b88d
...
...
@@ -28,7 +28,7 @@ type ImChatRoom struct {
type
ImUser
struct
{
Id
int64
A
pp
id
string
A
cc
id
string
Appkey
string
Name
string
Mobile
string
...
...
pb/im_user.pb.go
View file @
85d1b88d
...
...
@@ -115,7 +115,7 @@ type ImUserReply struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
A
ppid
string
`protobuf:"bytes,2,opt,name=Appid,proto3" json:"App
id,omitempty"`
A
ccid
string
`protobuf:"bytes,2,opt,name=Accid,proto3" json:"Acc
id,omitempty"`
}
func
(
x
*
ImUserReply
)
Reset
()
{
...
...
@@ -150,9 +150,9 @@ func (*ImUserReply) Descriptor() ([]byte, []int) {
return
file_u_proto_im_user_proto_rawDescGZIP
(),
[]
int
{
1
}
}
func
(
x
*
ImUserReply
)
GetA
pp
id
()
string
{
func
(
x
*
ImUserReply
)
GetA
cc
id
()
string
{
if
x
!=
nil
{
return
x
.
A
pp
id
return
x
.
A
cc
id
}
return
""
}
...
...
@@ -164,7 +164,7 @@ type ImUserOutRequest struct {
unknownFields
protoimpl
.
UnknownFields
Common
*
Common
`protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
A
ppid
string
`protobuf:"bytes,2,opt,name=Appid,proto3" json:"App
id,omitempty"`
A
ccid
string
`protobuf:"bytes,2,opt,name=Accid,proto3" json:"Acc
id,omitempty"`
}
func
(
x
*
ImUserOutRequest
)
Reset
()
{
...
...
@@ -206,9 +206,9 @@ func (x *ImUserOutRequest) GetCommon() *Common {
return
nil
}
func
(
x
*
ImUserOutRequest
)
GetA
pp
id
()
string
{
func
(
x
*
ImUserOutRequest
)
GetA
cc
id
()
string
{
if
x
!=
nil
{
return
x
.
A
pp
id
return
x
.
A
cc
id
}
return
""
}
...
...
@@ -221,7 +221,7 @@ type ImUserSetRequest struct {
Common
*
Common
`protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Mute
bool
`protobuf:"varint,2,opt,name=Mute,proto3" json:"Mute,omitempty"`
A
ppid
string
`protobuf:"bytes,3,opt,name=Appid,proto3" json:"App
id,omitempty"`
A
ccid
string
`protobuf:"bytes,3,opt,name=Accid,proto3" json:"Acc
id,omitempty"`
}
func
(
x
*
ImUserSetRequest
)
Reset
()
{
...
...
@@ -270,9 +270,9 @@ func (x *ImUserSetRequest) GetMute() bool {
return
false
}
func
(
x
*
ImUserSetRequest
)
GetA
pp
id
()
string
{
func
(
x
*
ImUserSetRequest
)
GetA
cc
id
()
string
{
if
x
!=
nil
{
return
x
.
A
pp
id
return
x
.
A
cc
id
}
return
""
}
...
...
@@ -322,7 +322,7 @@ type ImUserOneRequest struct {
unknownFields
protoimpl
.
UnknownFields
Common
*
Common
`protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
A
ppid
string
`protobuf:"bytes,2,opt,name=Appid,proto3" json:"App
id,omitempty"`
A
ccid
string
`protobuf:"bytes,2,opt,name=Accid,proto3" json:"Acc
id,omitempty"`
}
func
(
x
*
ImUserOneRequest
)
Reset
()
{
...
...
@@ -364,9 +364,9 @@ func (x *ImUserOneRequest) GetCommon() *Common {
return
nil
}
func
(
x
*
ImUserOneRequest
)
GetA
pp
id
()
string
{
func
(
x
*
ImUserOneRequest
)
GetA
cc
id
()
string
{
if
x
!=
nil
{
return
x
.
A
pp
id
return
x
.
A
cc
id
}
return
""
}
...
...
@@ -377,7 +377,7 @@ type ImUserOneReply struct {
unknownFields
protoimpl
.
UnknownFields
Id
int64
`protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
A
ppid
string
`protobuf:"bytes,2,opt,name=Appid,proto3" json:"App
id,omitempty"`
A
ccid
string
`protobuf:"bytes,2,opt,name=Accid,proto3" json:"Acc
id,omitempty"`
Name
string
`protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
Mobile
string
`protobuf:"bytes,4,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Disable
int64
`protobuf:"varint,5,opt,name=Disable,proto3" json:"Disable,omitempty"`
...
...
@@ -430,9 +430,9 @@ func (x *ImUserOneReply) GetId() int64 {
return
0
}
func
(
x
*
ImUserOneReply
)
GetA
pp
id
()
string
{
func
(
x
*
ImUserOneReply
)
GetA
cc
id
()
string
{
if
x
!=
nil
{
return
x
.
A
pp
id
return
x
.
A
cc
id
}
return
""
}
...
...
@@ -729,28 +729,28 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
0x09
,
0x52
,
0x04
,
0x43
,
0x6f
,
0x64
,
0x65
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x72
,
0x6f
,
0x6d
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x72
,
0x6f
,
0x6d
,
0x22
,
0x23
,
0x0a
,
0x0b
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x22
,
0x4c
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x6c
,
0x79
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x22
,
0x4c
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4f
,
0x75
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x0a
,
0x2e
,
0x70
,
0x62
,
0x2e
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x52
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x22
,
0x60
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x22
,
0x60
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x53
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x0a
,
0x2e
,
0x70
,
0x62
,
0x2e
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x52
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x4d
,
0x75
,
0x74
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x04
,
0x4d
,
0x75
,
0x74
,
0x65
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x22
,
0x10
,
0x0a
,
0x0e
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x74
,
0x65
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x22
,
0x10
,
0x0a
,
0x0e
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x53
,
0x65
,
0x74
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x22
,
0x4c
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4f
,
0x6e
,
0x65
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x0a
,
0x2e
,
0x70
,
0x62
,
0x2e
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x52
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x22
,
0xf2
,
0x02
,
0x0a
,
0x0e
,
0x49
,
0x6d
,
0x55
,
0x6f
,
0x6e
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x22
,
0xf2
,
0x02
,
0x0a
,
0x0e
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4f
,
0x6e
,
0x65
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x12
,
0x0e
,
0x0a
,
0x02
,
0x49
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x02
,
0x49
,
0x64
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x
70
,
0x70
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x70
,
0x70
,
0x69
,
0x
63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x63
,
0x63
,
0x69
,
0x64
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x4e
,
0x61
,
0x6d
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x4e
,
0x61
,
0x6d
,
0x65
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x4d
,
0x6f
,
0x62
,
0x69
,
0x6c
,
0x65
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x4d
,
0x6f
,
0x62
,
0x69
,
0x6c
,
0x65
,
0x12
,
0x18
,
0x0a
,
...
...
sevice/im_user/im_user.go
View file @
85d1b88d
...
...
@@ -20,12 +20,12 @@ type ImUser struct {
}
type
ImUserSet
struct
{
A
pp
id
string
`validate:"required"`
A
cc
id
string
`validate:"required"`
Mute
bool
`validate:"required"`
}
type
ImUserQ
struct
{
A
pp
id
string
`validate:"required"`
A
cc
id
string
`validate:"required"`
}
//注册
...
...
@@ -53,17 +53,17 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
}
reply
=
&
pb
.
ImUserReply
{}
// 是否已经注册过, 如果已经注册返回用户信息
if
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
);
c_user
.
A
pp
id
!=
""
{
reply
.
A
ppid
=
c_user
.
App
id
if
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
);
c_user
.
A
cc
id
!=
""
{
reply
.
A
ccid
=
c_user
.
Acc
id
return
}
// 企业用户注册失败
c_user
,
err
:=
helper
.
CreateImUser
(
imUser
.
Name
,
imUser
.
Mobile
)
c_user
,
err
:=
CreateImUser
(
imUser
.
Name
,
imUser
.
Mobile
)
if
err
!=
nil
{
return
}
reply
.
A
ppid
=
c_user
.
App
id
reply
.
A
ccid
=
c_user
.
Acc
id
return
}
...
...
@@ -93,7 +93,7 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
}
reply
=
&
pb
.
ImUserReply
{}
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
)
if
c_user
.
A
pp
id
==
""
{
if
c_user
.
A
cc
id
==
""
{
err
=
errors
.
New
(
"用户不存在"
)
return
}
...
...
@@ -102,16 +102,16 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
err
=
errors
.
New
(
"用户登录时间更新失败"
)
return
}
reply
.
A
ppid
=
c_user
.
App
id
reply
.
A
ccid
=
c_user
.
Acc
id
return
}
//用户退出
func
(
u
*
ImUserServer
)
ImUserLoginOut
(
ctx
context
.
Context
,
in
*
pb
.
ImUserOutRequest
)
(
reply
*
pb
.
ImUserSetReply
,
err
error
)
{
imUserOut
:=
&
ImUserQ
{
A
ppid
:
in
.
GetApp
id
(),
A
ccid
:
in
.
GetAcc
id
(),
}
if
res
,
_
:=
SaveLoginOut
(
imUserOut
.
A
pp
id
);
res
!=
1
{
if
res
,
_
:=
SaveLoginOut
(
imUserOut
.
A
cc
id
);
res
!=
1
{
err
=
errors
.
New
(
"用户更改登录状态信息失败"
)
return
}
...
...
@@ -121,26 +121,31 @@ func (u *ImUserServer) ImUserLoginOut(ctx context.Context, in *pb.ImUserOutReque
//用户禁言
func
(
u
*
ImUserServer
)
ImUserForbiddenWords
(
ctx
context
.
Context
,
in
*
pb
.
ImUserSetRequest
)
(
reply
*
pb
.
ImUserSetReply
,
err
error
)
{
imUserSet
:=
&
ImUserSet
{
Appid
:
in
.
GetAppid
(),
Mute
:
in
.
GetMute
(),
var
mute
int64
=
0
if
in
.
GetMute
()
==
true
{
mute
=
1
}
if
res
,
_
:=
SetImUserMute
(
imUserSet
.
Appid
,
"mute_estoppel"
,
imUserSet
.
Mute
);
res
!=
1
{
m
:=
make
(
map
[
string
]
interface
{})
m
[
"mute_estoppel"
]
=
mute
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户禁言失败"
)
return
}
reply
=
&
pb
.
ImUserSetReply
{}
return
}
//用户禁音视频
func
(
u
*
ImUserServer
)
ImUserForbiddenAV
(
ctx
context
.
Context
,
in
*
pb
.
ImUserSetRequest
)
(
reply
*
pb
.
ImUserSetReply
,
err
error
)
{
imUserSet
:=
&
ImUserSet
{
Appid
:
in
.
GetAppid
(),
Mute
:
in
.
GetMute
(),
}
if
res
,
_
:=
SetImUserMute
(
imUserSet
.
Appid
,
"mute_audio_video"
,
imUserSet
.
Mute
);
res
!=
1
{
var
mute
int64
if
in
.
GetMute
()
==
true
{
mute
=
1
}
else
{
mute
=
0
}
m
:=
make
(
map
[
string
]
interface
{})
m
[
"mute_audio_video"
]
=
mute
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户禁言失败"
)
return
}
...
...
@@ -152,14 +157,14 @@ func (u *ImUserServer) ImUserForbiddenAV(ctx context.Context, in *pb.ImUserSetRe
//获取用户信息
func
(
u
*
ImUserServer
)
ImUserOne
(
ctx
context
.
Context
,
in
*
pb
.
ImUserOneRequest
)
(
reply
*
pb
.
ImUserOneReply
,
err
error
)
{
imUserId
:=
&
ImUserQ
{
A
ppid
:
in
.
GetApp
id
(),
A
ccid
:
in
.
GetAcc
id
(),
}
// 参数验证是否合法
if
err
=
helper
.
Valiator
(
imUserId
);
err
!=
nil
{
return
}
reply
=
&
pb
.
ImUserOneReply
{}
c_user
,
err
:=
GetImUserByA
ppid
(
imUserId
.
App
id
)
c_user
,
err
:=
GetImUserByA
ccid
(
imUserId
.
Acc
id
)
if
err
!=
nil
{
return
}
...
...
@@ -170,7 +175,7 @@ func (u *ImUserServer) ImUserOne(ctx context.Context, in *pb.ImUserOneRequest) (
func
getImUser
(
imuser
db
.
ImUser
)
*
pb
.
ImUserOneReply
{
return
&
pb
.
ImUserOneReply
{
Id
:
int64
(
imuser
.
Id
),
A
ppid
:
imuser
.
App
id
,
A
ccid
:
imuser
.
Acc
id
,
Name
:
imuser
.
Name
,
Mobile
:
imuser
.
Mobile
,
Disable
:
int64
(
imuser
.
Disable
),
...
...
sevice/im_user/im_user_db.go
View file @
85d1b88d
...
...
@@ -17,7 +17,7 @@ const (
u_table_name
=
"im_user"
)
func
createA
pp
id
()
string
{
func
createA
cc
id
()
string
{
id
:=
ksuid
.
New
()
h
:=
md5
.
New
()
h
.
Write
([]
byte
(
id
.
String
()))
...
...
@@ -37,9 +37,9 @@ func GetImUserByMobile(mobile string) (db.ImUser, error) {
//im用户注册
func
CreateImUser
(
name
string
,
mobile
string
)
(
db
.
ImUser
,
error
)
{
a
ppid
:=
createApp
id
()
a
ccid
:=
createAcc
id
()
var
c_user
db
.
ImUser
c_user
.
A
ppid
=
app
id
c_user
.
A
ccid
=
acc
id
c_user
.
Name
=
name
c_user
.
Mobile
=
mobile
c_user
.
Createtime
=
helper
.
GetNowTime
()
...
...
@@ -66,25 +66,33 @@ func SaveUpdatetime(mobile string, platfrom string) (int64, error) {
}
//用户退出
func
SaveLoginOut
(
a
pp
id
string
)
(
int64
,
error
)
{
func
SaveLoginOut
(
a
cc
id
string
)
(
int64
,
error
)
{
orm_params
:=
make
(
orm
.
Params
)
orm_params
[
"login_status"
]
=
0
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"a
ppid"
,
app
id
)
.
Update
(
orm_params
)
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"a
ccid"
,
acc
id
)
.
Update
(
orm_params
)
if
err
!=
nil
{
return
0
,
err
}
return
res
,
nil
}
//
用户设置
func
SetImUserMute
(
appid
string
,
field
string
,
mute
bool
)
(
int64
,
error
)
{
//
修改用户信息
func
UpdateImUser
(
accid
string
,
m
map
[
string
]
interface
{}
)
(
int64
,
error
)
{
orm_params
:=
make
(
orm
.
Params
)
if
mute
==
true
{
orm_params
[
field
]
=
1
}
else
{
orm_params
[
field
]
=
0
}
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"appid"
,
appid
)
.
Update
(
orm_params
)
for
k
,
v
:=
range
m
{
switch
v
.
(
type
)
{
case
int
:
i_v
:=
v
.
(
int
)
orm_params
[
k
]
=
i_v
case
string
:
s_v
:=
v
.
(
string
)
orm_params
[
k
]
=
s_v
case
int64
:
c_v
:=
v
.
(
int64
)
orm_params
[
k
]
=
c_v
}
}
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"accid"
,
accid
)
.
Update
(
orm_params
)
if
err
!=
nil
{
return
0
,
err
}
...
...
@@ -92,10 +100,10 @@ func SetImUserMute(appid string, field string, mute bool) (int64, error) {
}
//获取用户信息
func
GetImUserByA
ppid
(
app
id
string
)
(
db
.
ImUser
,
error
)
{
func
GetImUserByA
ccid
(
acc
id
string
)
(
db
.
ImUser
,
error
)
{
var
c_user
db
.
ImUser
fmt
.
Println
(
db
.
MysqlClient
)
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"a
ppid"
,
app
id
)
.
One
(
&
c_user
)
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"a
ccid"
,
acc
id
)
.
One
(
&
c_user
)
if
err
!=
nil
{
return
c_user
,
err
}
...
...
u-proto/im_user.proto
View file @
85d1b88d
...
...
@@ -14,21 +14,21 @@ message ImUserRequest {
}
message
ImUserReply
{
string
A
pp
id
=
2
;
string
A
cc
id
=
2
;
}
//用户退出
message
ImUserOutRequest
{
Common
Common
=
1
;
string
A
pp
id
=
2
;
string
A
cc
id
=
2
;
}
//用户设置禁言,禁音视频
message
ImUserSetRequest
{
Common
Common
=
1
;
bool
Mute
=
2
;
string
A
pp
id
=
3
;
string
A
cc
id
=
3
;
}
message
ImUserSetReply
{}
...
...
@@ -36,12 +36,12 @@ message ImUserSetReply {}
//获取单个用户信息
message
ImUserOneRequest
{
Common
Common
=
1
;
string
A
pp
id
=
2
;
string
A
cc
id
=
2
;
}
message
ImUserOneReply
{
int64
Id
=
1
;
string
A
pp
id
=
2
;
string
A
cc
id
=
2
;
string
Name
=
3
;
string
Mobile
=
4
;
int64
Disable
=
5
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment