feat 修改usn类型为string

This commit is contained in:
2026-01-11 16:16:27 +08:00
parent 1b893cad87
commit 11141edcda
17 changed files with 1019 additions and 43 deletions

View File

@@ -1,9 +1,9 @@
package stream_client
import (
"common/log"
"common/net/grpc/service"
"context"
"git.hlsq.asia/mmorpg/service-common/log"
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
"strconv"
@@ -23,7 +23,7 @@ type gatewayStream struct {
stream grpc.ClientStream
}
func findGatewayBySID(sid int64, fun GatewayFun) (*gatewayStream, error) {
func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
key := gatewayKey(sid, fun)
if v, ok := gatewayServer.Load(key); ok {
@@ -54,7 +54,7 @@ func findGatewayBySID(sid int64, fun GatewayFun) (*gatewayStream, error) {
return ss, nil
}
func SendMessageToGateway(sid int64, fun GatewayFun, msg proto.Message, re ...bool) error {
func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...bool) error {
ss, err := findGatewayBySID(sid, fun)
if err != nil {
return err
@@ -79,6 +79,6 @@ func SendMessageToGateway(sid int64, fun GatewayFun, msg proto.Message, re ...bo
return nil
}
func gatewayKey(sid int64, fun GatewayFun) string {
return strconv.FormatInt(sid, 10) + "-" + strconv.Itoa(int(fun))
func gatewayKey(sid string, fun GatewayFun) string {
return sid + "-" + strconv.Itoa(int(fun))
}