feat 修改usn类型为string

This commit is contained in:
2026-01-11 16:16:18 +08:00
parent f5e3acd4d6
commit 48e178e853
6 changed files with 28 additions and 30 deletions

View File

@@ -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))
}