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
38b232e1
Commit
38b232e1
authored
Jul 03, 2020
by
Li Feifei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.offcncloud.com/lff58407/im-microservice
into develop
parents
f48c57a6
0a75f2bf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
41 deletions
+42
-41
db_struct.go
db/db_struct.go
+1
-1
im_user.pb.go
pb/im_user.pb.go
+17
-18
im_user.go
sevice/im_user/im_user.go
+16
-14
im_user_db.go
sevice/im_user/im_user_db.go
+5
-5
im_user.proto
u-proto/im_user.proto
+3
-3
No files found.
db/db_struct.go
View file @
38b232e1
...
@@ -52,6 +52,6 @@ type ImUser struct {
...
@@ -52,6 +52,6 @@ type ImUser struct {
Createtime
string
Createtime
string
Updatetime
string
Updatetime
string
LoginStatus
int64
LoginStatus
int64
Platf
ro
m
string
Platf
or
m
string
Edition
string
Edition
string
}
}
pb/im_user.pb.go
View file @
38b232e1
...
@@ -8,15 +8,14 @@ package pb
...
@@ -8,15 +8,14 @@ package pb
import
(
import
(
context
"context"
context
"context"
reflect
"reflect"
sync
"sync"
proto
"github.com/golang/protobuf/proto"
proto
"github.com/golang/protobuf/proto"
grpc
"google.golang.org/grpc"
grpc
"google.golang.org/grpc"
codes
"google.golang.org/grpc/codes"
codes
"google.golang.org/grpc/codes"
status
"google.golang.org/grpc/status"
status
"google.golang.org/grpc/status"
protoreflect
"google.golang.org/protobuf/reflect/protoreflect"
protoreflect
"google.golang.org/protobuf/reflect/protoreflect"
protoimpl
"google.golang.org/protobuf/runtime/protoimpl"
protoimpl
"google.golang.org/protobuf/runtime/protoimpl"
reflect
"reflect"
sync
"sync"
)
)
const
(
const
(
...
@@ -40,7 +39,7 @@ type ImUserRequest struct {
...
@@ -40,7 +39,7 @@ type ImUserRequest struct {
Name
string
`protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
Name
string
`protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
Mobile
string
`protobuf:"bytes,3,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Mobile
string
`protobuf:"bytes,3,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Code
string
`protobuf:"bytes,4,opt,name=Code,proto3" json:"Code,omitempty"`
Code
string
`protobuf:"bytes,4,opt,name=Code,proto3" json:"Code,omitempty"`
Platf
rom
string
`protobuf:"bytes,5,opt,name=Platfrom,proto3" json:"Platfro
m,omitempty"`
Platf
orm
string
`protobuf:"bytes,5,opt,name=Platform,proto3" json:"Platfor
m,omitempty"`
}
}
func
(
x
*
ImUserRequest
)
Reset
()
{
func
(
x
*
ImUserRequest
)
Reset
()
{
...
@@ -103,9 +102,9 @@ func (x *ImUserRequest) GetCode() string {
...
@@ -103,9 +102,9 @@ func (x *ImUserRequest) GetCode() string {
return
""
return
""
}
}
func
(
x
*
ImUserRequest
)
GetPlatf
ro
m
()
string
{
func
(
x
*
ImUserRequest
)
GetPlatf
or
m
()
string
{
if
x
!=
nil
{
if
x
!=
nil
{
return
x
.
Platf
ro
m
return
x
.
Platf
or
m
}
}
return
""
return
""
}
}
...
@@ -387,7 +386,7 @@ type ImUserOneReply struct {
...
@@ -387,7 +386,7 @@ type ImUserOneReply struct {
Createtime
string
`protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Createtime
string
`protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Updatetime
string
`protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
Updatetime
string
`protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
LoginStatus
int64
`protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
LoginStatus
int64
`protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
Platf
rom
string
`protobuf:"bytes,12,opt,name=Platfrom,proto3" json:"Platfro
m,omitempty"`
Platf
orm
string
`protobuf:"bytes,12,opt,name=Platform,proto3" json:"Platfor
m,omitempty"`
Edition
string
`protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
Edition
string
`protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
}
}
...
@@ -500,9 +499,9 @@ func (x *ImUserOneReply) GetLoginStatus() int64 {
...
@@ -500,9 +499,9 @@ func (x *ImUserOneReply) GetLoginStatus() int64 {
return
0
return
0
}
}
func
(
x
*
ImUserOneReply
)
GetPlatf
ro
m
()
string
{
func
(
x
*
ImUserOneReply
)
GetPlatf
or
m
()
string
{
if
x
!=
nil
{
if
x
!=
nil
{
return
x
.
Platf
ro
m
return
x
.
Platf
or
m
}
}
return
""
return
""
}
}
...
@@ -531,7 +530,7 @@ type ImUserListRequest struct {
...
@@ -531,7 +530,7 @@ type ImUserListRequest struct {
Createtime
string
`protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Createtime
string
`protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Updatetime
string
`protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
Updatetime
string
`protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
LoginStatus
int64
`protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
LoginStatus
int64
`protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
Platf
rom
string
`protobuf:"bytes,12,opt,name=Platfrom,proto3" json:"Platfro
m,omitempty"`
Platf
orm
string
`protobuf:"bytes,12,opt,name=Platform,proto3" json:"Platfor
m,omitempty"`
Edition
string
`protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
Edition
string
`protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
}
}
...
@@ -644,9 +643,9 @@ func (x *ImUserListRequest) GetLoginStatus() int64 {
...
@@ -644,9 +643,9 @@ func (x *ImUserListRequest) GetLoginStatus() int64 {
return
0
return
0
}
}
func
(
x
*
ImUserListRequest
)
GetPlatf
ro
m
()
string
{
func
(
x
*
ImUserListRequest
)
GetPlatf
or
m
()
string
{
if
x
!=
nil
{
if
x
!=
nil
{
return
x
.
Platf
ro
m
return
x
.
Platf
or
m
}
}
return
""
return
""
}
}
...
@@ -727,8 +726,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
...
@@ -727,8 +726,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
0x6f
,
0x62
,
0x69
,
0x6c
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x4d
,
0x6f
,
0x62
,
0x6f
,
0x62
,
0x69
,
0x6c
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x4d
,
0x6f
,
0x62
,
0x69
,
0x6c
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x43
,
0x6f
,
0x64
,
0x65
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x69
,
0x6c
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x43
,
0x6f
,
0x64
,
0x65
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x43
,
0x6f
,
0x64
,
0x65
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x09
,
0x52
,
0x04
,
0x43
,
0x6f
,
0x64
,
0x65
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
6f
,
0x72
,
0x6d
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x22
,
0x23
,
0x0a
,
0x0b
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x52
,
0x65
,
0x70
,
0x
6f
,
0x72
,
0x6d
,
0x22
,
0x23
,
0x0a
,
0x0b
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x6c
,
0x79
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x41
,
0x63
,
0x63
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x41
,
0x63
,
0x63
,
0x69
,
0x64
,
0x22
,
0x4c
,
0x0a
,
0x10
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x09
,
0x52
,
0x05
,
0x41
,
0x63
,
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
,
0x65
,
0x72
,
0x4f
,
0x75
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
...
@@ -768,8 +767,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
...
@@ -768,8 +767,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
0x65
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x20
,
0x0a
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x65
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x20
,
0x0a
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x18
,
0x0b
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x61
,
0x74
,
0x75
,
0x73
,
0x18
,
0x0b
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x18
,
0x0c
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
6f
,
0x72
,
0x6d
,
0x18
,
0x0c
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x0d
,
0x
6f
,
0x72
,
0x6d
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x0d
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x22
,
0x87
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x22
,
0x87
,
0x03
,
0x0a
,
0x11
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4c
,
0x69
,
0x73
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x0a
,
0x11
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4c
,
0x69
,
0x73
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x18
,
0x01
,
0x20
,
0x65
,
0x73
,
0x74
,
0x12
,
0x22
,
0x0a
,
0x06
,
0x43
,
0x6f
,
0x6d
,
0x6d
,
0x6f
,
0x6e
,
0x18
,
0x01
,
0x20
,
...
@@ -792,8 +791,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
...
@@ -792,8 +791,8 @@ var file_u_proto_im_user_proto_rawDesc = []byte{
0x01
,
0x28
,
0x09
,
0x52
,
0x0a
,
0x55
,
0x70
,
0x64
,
0x61
,
0x74
,
0x65
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0a
,
0x55
,
0x70
,
0x64
,
0x61
,
0x74
,
0x65
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x20
,
0x0a
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x18
,
0x0b
,
0x20
,
0x0a
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x18
,
0x0b
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x0b
,
0x4c
,
0x6f
,
0x67
,
0x69
,
0x6e
,
0x53
,
0x74
,
0x61
,
0x74
,
0x75
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x18
,
0x0c
,
0x20
,
0x73
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
6f
,
0x72
,
0x6d
,
0x18
,
0x0c
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
72
,
0x6f
,
0x6d
,
0x12
,
0x18
,
0x0a
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x50
,
0x6c
,
0x61
,
0x74
,
0x66
,
0x
6f
,
0x72
,
0x6d
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x0d
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x0d
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x22
,
0x5f
,
0x0a
,
0x0f
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x45
,
0x64
,
0x69
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x22
,
0x5f
,
0x0a
,
0x0f
,
0x49
,
0x6d
,
0x55
,
0x73
,
0x65
,
0x72
,
0x4c
,
0x69
,
0x73
,
0x74
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x12
,
0x26
,
0x0a
,
0x04
,
0x4c
,
0x69
,
0x72
,
0x4c
,
0x69
,
0x73
,
0x74
,
0x52
,
0x65
,
0x70
,
0x6c
,
0x79
,
0x12
,
0x26
,
0x0a
,
0x04
,
0x4c
,
0x69
,
...
...
sevice/im_user/im_user.go
View file @
38b232e1
...
@@ -2,10 +2,11 @@ package im_user
...
@@ -2,10 +2,11 @@ package im_user
import
(
import
(
"context"
"context"
"errors"
"im-microservice/db"
"im-microservice/db"
"im-microservice/helper"
"im-microservice/helper"
"im-microservice/pb"
"im-microservice/pb"
"google.golang.org/grpc/status"
)
)
type
ImUserServer
struct
{
type
ImUserServer
struct
{
...
@@ -16,7 +17,7 @@ type ImUser struct {
...
@@ -16,7 +17,7 @@ type ImUser struct {
Name
string
`validate:"required"`
Name
string
`validate:"required"`
Mobile
string
`validate:"required,numeric,len=11"`
Mobile
string
`validate:"required,numeric,len=11"`
Code
string
`validate:"required"`
Code
string
`validate:"required"`
Platf
ro
m
string
`validate:"required"`
Platf
or
m
string
`validate:"required"`
}
}
type
ImUserSet
struct
{
type
ImUserSet
struct
{
...
@@ -34,7 +35,7 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
...
@@ -34,7 +35,7 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
Name
:
in
.
GetName
(),
Name
:
in
.
GetName
(),
Mobile
:
in
.
GetMobile
(),
Mobile
:
in
.
GetMobile
(),
Code
:
in
.
GetCode
(),
Code
:
in
.
GetCode
(),
Platf
rom
:
in
.
GetPlatfro
m
(),
Platf
orm
:
in
.
GetPlatfor
m
(),
}
}
// 参数验证是否合法
// 参数验证是否合法
...
@@ -49,18 +50,19 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
...
@@ -49,18 +50,19 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
}
}
//对比验证码
//对比验证码
if
cache_code
!=
imUser
.
Code
{
if
cache_code
!=
imUser
.
Code
{
err
=
errors
.
New
(
"验证码不匹配"
)
err
=
status
.
Error
(
302
,
"验证码不匹配"
)
return
return
}
}
reply
=
&
pb
.
ImUserReply
{}
reply
=
&
pb
.
ImUserReply
{}
// 是否已经注册过, 如果已经注册返回用户信息
// 是否已经注册过, 如果已经注册返回用户信息
if
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
);
c_user
.
Accid
!=
""
{
if
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
);
c_user
.
Accid
!=
""
{
reply
.
Accid
=
c_user
.
Accid
err
=
status
.
Error
(
10438
,
"手机号已注册"
)
return
return
}
}
// 企业用户注册失败
// 企业用户注册失败
c_user
,
err
:=
CreateImUser
(
imUser
.
Name
,
imUser
.
Mobile
)
c_user
,
err
:=
CreateImUser
(
imUser
.
Name
,
imUser
.
Mobile
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
status
.
Error
(
500
,
"注册失败"
)
return
return
}
}
reply
.
Accid
=
c_user
.
Accid
reply
.
Accid
=
c_user
.
Accid
...
@@ -73,7 +75,7 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
...
@@ -73,7 +75,7 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
Name
:
in
.
GetName
(),
Name
:
in
.
GetName
(),
Mobile
:
in
.
GetMobile
(),
Mobile
:
in
.
GetMobile
(),
Code
:
in
.
GetCode
(),
Code
:
in
.
GetCode
(),
Platf
rom
:
in
.
GetPlatfro
m
(),
Platf
orm
:
in
.
GetPlatfor
m
(),
}
}
// 参数验证是否合法
// 参数验证是否合法
...
@@ -88,18 +90,18 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
...
@@ -88,18 +90,18 @@ func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (r
}
}
//对比验证码
//对比验证码
if
cache_code
!=
imUser
.
Code
{
if
cache_code
!=
imUser
.
Code
{
err
=
errors
.
New
(
"验证码不匹配"
)
err
=
status
.
Error
(
302
,
"验证码不匹配"
)
return
return
}
}
reply
=
&
pb
.
ImUserReply
{}
reply
=
&
pb
.
ImUserReply
{}
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
)
c_user
,
_
:=
GetImUserByMobile
(
imUser
.
Mobile
)
if
c_user
.
Accid
==
""
{
if
c_user
.
Accid
==
""
{
err
=
errors
.
New
(
"用户不存在"
)
err
=
status
.
Error
(
404
,
"用户不存在"
)
return
return
}
}
//更新用户登录时间
//更新用户登录时间
if
res
,
_
:=
SaveUpdatetime
(
imUser
.
Mobile
,
imUser
.
Platf
ro
m
);
res
!=
1
{
if
res
,
_
:=
SaveUpdatetime
(
imUser
.
Mobile
,
imUser
.
Platf
or
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户登录时间更新失败"
)
err
=
status
.
Error
(
500
,
"用户登录时间更新失败"
)
return
return
}
}
reply
.
Accid
=
c_user
.
Accid
reply
.
Accid
=
c_user
.
Accid
...
@@ -118,7 +120,7 @@ func (u *ImUserServer) ImUserLoginOut(ctx context.Context, in *pb.ImUserOutReque
...
@@ -118,7 +120,7 @@ func (u *ImUserServer) ImUserLoginOut(ctx context.Context, in *pb.ImUserOutReque
m
:=
make
(
map
[
string
]
interface
{})
m
:=
make
(
map
[
string
]
interface
{})
m
[
"login_status"
]
=
0
m
[
"login_status"
]
=
0
if
res
,
_
:=
UpdateImUser
(
imUserOut
.
Accid
,
m
);
res
!=
1
{
if
res
,
_
:=
UpdateImUser
(
imUserOut
.
Accid
,
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户更改登录状态信息失败"
)
err
=
status
.
Error
(
500
,
"用户更改登录状态信息失败"
)
return
return
}
}
reply
=
&
pb
.
ImUserSetReply
{}
reply
=
&
pb
.
ImUserSetReply
{}
...
@@ -134,7 +136,7 @@ func (u *ImUserServer) ImUserForbiddenWords(ctx context.Context, in *pb.ImUserSe
...
@@ -134,7 +136,7 @@ func (u *ImUserServer) ImUserForbiddenWords(ctx context.Context, in *pb.ImUserSe
m
:=
make
(
map
[
string
]
interface
{})
m
:=
make
(
map
[
string
]
interface
{})
m
[
"mute_estoppel"
]
=
mute
m
[
"mute_estoppel"
]
=
mute
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户禁言失败"
)
err
=
status
.
Error
(
500
,
"用户禁言失败"
)
return
return
}
}
reply
=
&
pb
.
ImUserSetReply
{}
reply
=
&
pb
.
ImUserSetReply
{}
...
@@ -150,7 +152,7 @@ func (u *ImUserServer) ImUserForbiddenAV(ctx context.Context, in *pb.ImUserSetRe
...
@@ -150,7 +152,7 @@ func (u *ImUserServer) ImUserForbiddenAV(ctx context.Context, in *pb.ImUserSetRe
m
:=
make
(
map
[
string
]
interface
{})
m
:=
make
(
map
[
string
]
interface
{})
m
[
"mute_audio_video"
]
=
mute
m
[
"mute_audio_video"
]
=
mute
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
if
res
,
_
:=
UpdateImUser
(
in
.
GetAccid
(),
m
);
res
!=
1
{
err
=
errors
.
New
(
"用户禁言
失败"
)
err
=
status
.
Error
(
500
,
"用户禁音视频
失败"
)
return
return
}
}
...
@@ -189,7 +191,7 @@ func getImUser(imuser db.ImUser) *pb.ImUserOneReply {
...
@@ -189,7 +191,7 @@ func getImUser(imuser db.ImUser) *pb.ImUserOneReply {
Createtime
:
imuser
.
Createtime
,
Createtime
:
imuser
.
Createtime
,
Updatetime
:
imuser
.
Updatetime
,
Updatetime
:
imuser
.
Updatetime
,
LoginStatus
:
int64
(
imuser
.
LoginStatus
),
LoginStatus
:
int64
(
imuser
.
LoginStatus
),
Platf
rom
:
imuser
.
Platfro
m
,
Platf
orm
:
imuser
.
Platfor
m
,
Edition
:
imuser
.
Edition
,
Edition
:
imuser
.
Edition
,
}
}
}
}
...
...
sevice/im_user/im_user_db.go
View file @
38b232e1
...
@@ -62,12 +62,12 @@ func CreateImUser(name string, mobile string) (db.ImUser, error) {
...
@@ -62,12 +62,12 @@ func CreateImUser(name string, mobile string) (db.ImUser, error) {
}
}
//用户登录更新登录信息
//用户登录更新登录信息
func
SaveUpdatetime
(
mobile
string
,
platf
ro
m
string
)
(
int64
,
error
)
{
func
SaveUpdatetime
(
mobile
string
,
platf
or
m
string
)
(
int64
,
error
)
{
updatetime
:=
helper
.
GetNowTime
()
updatetime
:=
helper
.
GetNowTime
()
orm_params
:=
make
(
orm
.
Params
)
orm_params
:=
make
(
orm
.
Params
)
orm_params
[
"login_status"
]
=
1
orm_params
[
"login_status"
]
=
1
orm_params
[
"updatetime"
]
=
updatetime
orm_params
[
"updatetime"
]
=
updatetime
orm_params
[
"platf
rom"
]
=
platfro
m
orm_params
[
"platf
orm"
]
=
platfor
m
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"mobile"
,
mobile
)
.
Update
(
orm_params
)
res
,
err
:=
db
.
MysqlClient
.
QueryTable
(
u_table_name
)
.
Filter
(
"mobile"
,
mobile
)
.
Update
(
orm_params
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
...
@@ -119,7 +119,7 @@ func GetImUserList(request *pb.ImUserListRequest) (results map[string]interface{
...
@@ -119,7 +119,7 @@ func GetImUserList(request *pb.ImUserListRequest) (results map[string]interface{
mute_audio_video
=
request
.
GetMuteAudioVideo
()
mute_audio_video
=
request
.
GetMuteAudioVideo
()
ext
=
request
.
GetExt
()
ext
=
request
.
GetExt
()
login_status
=
request
.
GetLoginStatus
()
login_status
=
request
.
GetLoginStatus
()
platf
rom
=
request
.
GetPlatfro
m
()
platf
orm
=
request
.
GetPlatfor
m
()
page
=
request
.
GetPage
()
page
=
request
.
GetPage
()
edition
=
request
.
GetEdition
()
edition
=
request
.
GetEdition
()
)
)
...
@@ -148,8 +148,8 @@ func GetImUserList(request *pb.ImUserListRequest) (results map[string]interface{
...
@@ -148,8 +148,8 @@ func GetImUserList(request *pb.ImUserListRequest) (results map[string]interface{
if
login_status
!=
0
{
if
login_status
!=
0
{
count_db
=
count_db
.
Filter
(
"login_status"
,
login_status
)
count_db
=
count_db
.
Filter
(
"login_status"
,
login_status
)
}
}
if
platf
ro
m
!=
""
{
if
platf
or
m
!=
""
{
count_db
=
count_db
.
Filter
(
"platf
rom"
,
platfro
m
)
count_db
=
count_db
.
Filter
(
"platf
orm"
,
platfor
m
)
}
}
if
edition
!=
""
{
if
edition
!=
""
{
count_db
=
count_db
.
Filter
(
"edition"
,
edition
)
count_db
=
count_db
.
Filter
(
"edition"
,
edition
)
...
...
u-proto/im_user.proto
View file @
38b232e1
...
@@ -10,7 +10,7 @@ message ImUserRequest {
...
@@ -10,7 +10,7 @@ message ImUserRequest {
string
Name
=
2
;
string
Name
=
2
;
string
Mobile
=
3
;
string
Mobile
=
3
;
string
Code
=
4
;
string
Code
=
4
;
string
Platf
ro
m
=
5
;
string
Platf
or
m
=
5
;
}
}
message
ImUserReply
{
message
ImUserReply
{
...
@@ -51,7 +51,7 @@ message ImUserOneReply {
...
@@ -51,7 +51,7 @@ message ImUserOneReply {
string
Createtime
=
9
;
string
Createtime
=
9
;
string
Updatetime
=
10
;
string
Updatetime
=
10
;
int64
LoginStatus
=
11
;
int64
LoginStatus
=
11
;
string
Platf
ro
m
=
12
;
string
Platf
or
m
=
12
;
string
Edition
=
13
;
string
Edition
=
13
;
}
}
...
@@ -68,7 +68,7 @@ message ImUserListRequest {
...
@@ -68,7 +68,7 @@ message ImUserListRequest {
string
Createtime
=
9
;
string
Createtime
=
9
;
string
Updatetime
=
10
;
string
Updatetime
=
10
;
int64
LoginStatus
=
11
;
int64
LoginStatus
=
11
;
string
Platf
ro
m
=
12
;
string
Platf
or
m
=
12
;
string
Edition
=
13
;
string
Edition
=
13
;
}
}
...
...
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