Commit 25f446c8f757608efca9ff2b9dc27cffb97365fe

Authored by 王家文
1 parent bc483c81
Exists in master and in 1 other branch dev-wjw

fix🐛:id算法优化

service/roomrank/player.go
@@ -8,7 +8,7 @@ import ( @@ -8,7 +8,7 @@ import (
8 "apigame/util/util-lx/lxalilog" 8 "apigame/util/util-lx/lxalilog"
9 "apigame/util/util-lx/lxtime" 9 "apigame/util/util-lx/lxtime"
10 "apigame/util/utstring" 10 "apigame/util/utstring"
11 - "github.com/google/uuid" 11 + "apigame/util/utuuid"
12 ) 12 )
13 13
14 func tryInitPlayer(gameId string, player *Player) { 14 func tryInitPlayer(gameId string, player *Player) {
@@ -49,7 +49,7 @@ func LoadPlayer(gameId string, playerUid int64, topType int) (player *Player) { @@ -49,7 +49,7 @@ func LoadPlayer(gameId string, playerUid int64, topType int) (player *Player) {
49 func NewRoomRobot(gameId string, robotConfigId int, userType int) *RoomPlayer { 49 func NewRoomRobot(gameId string, robotConfigId int, userType int) *RoomPlayer {
50 d := &RoomPlayer{ 50 d := &RoomPlayer{
51 //Uid: rand.Int63(), 51 //Uid: rand.Int63(),
52 - Uid: int64(uuid.New().ID()), 52 + Uid: int64(utuuid.GetUint32()),
53 Name: svcommon.GetName(gameId), 53 Name: svcommon.GetName(gameId),
54 Icon: svcommon.GetAvatar(gameId), 54 Icon: svcommon.GetAvatar(gameId),
55 Score: 0, 55 Score: 0,
util/utuuid/uuid.go 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +package utuuid
  2 +
  3 +import "github.com/google/uuid"
  4 +
  5 +func GetUint32() uint32 {
  6 + return uuid.New().ID()
  7 +}