feat sn 改成 int64

This commit is contained in:
2026-01-30 11:53:20 +08:00
parent 427fca7ed1
commit 5dc5391b07
20 changed files with 189 additions and 182 deletions

View File

@@ -2,10 +2,10 @@ package grpc_client
import (
"context"
"fmt"
"git.hlsq.asia/mmorpg/service-common/log"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
"strconv"
"sync"
)
@@ -22,7 +22,7 @@ type sceneStream struct {
stream grpc.ClientStream
}
func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
func findSceneBySID(sid int64, fun SceneFun) (*sceneStream, error) {
key := sceneKey(sid, fun)
if v, ok := sceneServer.Load(key); ok {
@@ -53,7 +53,7 @@ func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
return ss, nil
}
func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool) error {
func SendMessageToScene(sid int64, fun SceneFun, msg proto.Message, re ...bool) error {
ss, err := findSceneBySID(sid, fun)
if err != nil {
return err
@@ -78,6 +78,6 @@ func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool)
return nil
}
func sceneKey(sid string, fun SceneFun) string {
return sid + "-" + strconv.Itoa(int(fun))
func sceneKey(sid int64, fun SceneFun) string {
return fmt.Sprintf("%v-%v", sid, fun)
}