diff --git a/common/id.go b/common/id.go new file mode 100644 index 0000000..2673f16 --- /dev/null +++ b/common/id.go @@ -0,0 +1,9 @@ +package common + +import "github.com/bwmarrin/snowflake" + +var IdNode, _ = snowflake.NewNode(int64(GetSelfSrvId())) + +func GetId() int64 { + return IdNode.Generate().Int64() +} diff --git a/worldsrv/tmmatch.go b/worldsrv/tmmatch.go index bc23dc5..ab10cd3 100644 --- a/worldsrv/tmmatch.go +++ b/worldsrv/tmmatch.go @@ -20,7 +20,7 @@ import ( ) func getSortId() int64 { - return time.Now().UnixMilli() + return common.GetId() } type TmPlayer struct {