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
91228c9a
Commit
91228c9a
authored
Jul 01, 2020
by
李洪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
冲突
parent
fb9b837d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
main.go
sevice/im_chat_room/main.go
+0
-0
main.go
sevice/im_configure/main.go
+1
-1
im_user.go
sevice/im_user/im_user.go
+1
-0
im_user_db.go
sevice/im_user/im_user_db.go
+12
-2
No files found.
sevice/im_chat_room/main.go
View file @
91228c9a
sevice/im_configure/main.go
View file @
91228c9a
...
...
@@ -52,6 +52,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
in
*
pb
.
GetAllRequest
)
(
reply
*
pb
.
GetAllReply
,
err
error
)
{
reply
=
&
pb
.
GetAllReply
{}
configs
,
err
:=
GetConfigureAll
()
if
err
!=
nil
{
return
...
...
@@ -60,7 +61,6 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
return
}
for
_
,
v
:=
range
configs
{
reply
.
GetAll
=
append
(
reply
.
GetAll
,
&
pb
.
GetAllOneReply
{
Reply
:
&
pb
.
Public
{
CompanyUserId
:
v
.
CompanyUserId
,
...
...
sevice/im_user/im_user.go
View file @
91228c9a
...
...
@@ -34,6 +34,7 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest)
Name
:
in
.
GetName
(),
Mobile
:
in
.
GetMobile
(),
Code
:
in
.
GetCode
(),
Platfrom
:
in
.
GetPlatfrom
(),
}
// 参数验证是否合法
...
...
sevice/im_user/im_user_db.go
View file @
91228c9a
package
im_user
import
(
"bytes"
"crypto/md5"
"encoding/hex"
"errors"
...
...
@@ -8,6 +9,8 @@ import (
"im-microservice/db"
"im-microservice/helper"
"im-microservice/pb"
"math/rand"
"time"
"github.com/astaxie/beego/orm"
"github.com/segmentio/ksuid"
...
...
@@ -17,10 +20,17 @@ const (
u_table_name
=
"im_user"
)
func
CreateCaptcha
()
string
{
return
fmt
.
Sprintf
(
"%04v"
,
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int31n
(
10000
))
}
func
createAccid
()
string
{
id
:=
ksuid
.
New
()
var
buffer
bytes
.
Buffer
kid
:=
ksuid
.
New
()
buffer
.
WriteString
(
kid
.
String
())
buffer
.
WriteString
(
CreateCaptcha
())
h
:=
md5
.
New
()
h
.
Write
([]
byte
(
id
.
String
()))
h
.
Write
([]
byte
(
buffer
.
String
()))
return
hex
.
EncodeToString
(
h
.
Sum
(
nil
))
}
...
...
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