Commit 91228c9a by 李洪

冲突

parent fb9b837d
...@@ -105,4 +105,4 @@ func (cr *ImChatRoomService) All(ctx context.Context, ...@@ -105,4 +105,4 @@ func (cr *ImChatRoomService) All(ctx context.Context,
reply.Paginate.TotalCount = results["total_count"].(int64) reply.Paginate.TotalCount = results["total_count"].(int64)
reply.Paginate.TotalPage = results["total_page"].(int64) reply.Paginate.TotalPage = results["total_page"].(int64)
return return
} }
\ No newline at end of file
...@@ -52,6 +52,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context, ...@@ -52,6 +52,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
in *pb.GetAllRequest) (reply *pb.GetAllReply, err error) { in *pb.GetAllRequest) (reply *pb.GetAllReply, err error) {
reply = &pb.GetAllReply{} reply = &pb.GetAllReply{}
configs, err := GetConfigureAll() configs, err := GetConfigureAll()
if err != nil { if err != nil {
return return
...@@ -60,7 +61,6 @@ func (cs *ConfigureSevice) Select(ctx context.Context, ...@@ -60,7 +61,6 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
return return
} }
for _, v := range configs { for _, v := range configs {
reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{ reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{
Reply: &pb.Public{ Reply: &pb.Public{
CompanyUserId: v.CompanyUserId, CompanyUserId: v.CompanyUserId,
......
...@@ -34,6 +34,7 @@ func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest) ...@@ -34,6 +34,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(),
Platfrom: in.GetPlatfrom(),
} }
// 参数验证是否合法 // 参数验证是否合法
......
package im_user package im_user
import ( import (
"bytes"
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"errors" "errors"
...@@ -8,6 +9,8 @@ import ( ...@@ -8,6 +9,8 @@ import (
"im-microservice/db" "im-microservice/db"
"im-microservice/helper" "im-microservice/helper"
"im-microservice/pb" "im-microservice/pb"
"math/rand"
"time"
"github.com/astaxie/beego/orm" "github.com/astaxie/beego/orm"
"github.com/segmentio/ksuid" "github.com/segmentio/ksuid"
...@@ -17,10 +20,17 @@ const ( ...@@ -17,10 +20,17 @@ const (
u_table_name = "im_user" u_table_name = "im_user"
) )
func CreateCaptcha() string {
return fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000))
}
func createAccid() string { func createAccid() string {
id := ksuid.New() var buffer bytes.Buffer
kid := ksuid.New()
buffer.WriteString(kid.String())
buffer.WriteString(CreateCaptcha())
h := md5.New() h := md5.New()
h.Write([]byte(id.String())) h.Write([]byte(buffer.String()))
return hex.EncodeToString(h.Sum(nil)) return hex.EncodeToString(h.Sum(nil))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment