增加服务端版本

This commit is contained in:
hahwu 2025-05-30 15:19:40 +08:00
parent 6c95148a63
commit 2ff05589c5
3 changed files with 5 additions and 1 deletions

View File

@ -50,6 +50,7 @@ var Server struct {
Partition int Partition int
KafkaHost string KafkaHost string
KafkaPort string KafkaPort string
Version string
} }
func init() { func init() {

View File

@ -33,5 +33,6 @@
"RemoteAddr":"host.docker.internal:9001", "RemoteAddr":"host.docker.internal:9001",
"Partition":3, "Partition":3,
"KafkaHost":"kafka-server-2", "KafkaHost":"kafka-server-2",
"KafkaPort":"9092" "KafkaPort":"9092",
"Version":"1.0.0"
} }

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"server/GoUtil" "server/GoUtil"
"server/conf"
Msg "server/game/mod/msg" Msg "server/game/mod/msg"
"server/gamedata" "server/gamedata"
"server/msg" "server/msg"
@ -105,6 +106,7 @@ func ReqServerInfo(args []interface{}) error {
if err == nil && len(cpuPercent) > 0 { if err == nil && len(cpuPercent) > 0 {
res["CPU"] = fmt.Sprintf("%.2f%%", cpuPercent[0]) res["CPU"] = fmt.Sprintf("%.2f%%", cpuPercent[0])
} }
res["Version"] = conf.Server.Version
AdminPlayerBack(a, res) AdminPlayerBack(a, res)
return nil return nil
} }