From 48ddddb6803d755ed90f8040608f97393f85dd7c Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AE=89=E5=85=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/gamedata/reader.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/server/gamedata/reader.go b/src/server/gamedata/reader.go index ec15a45d..1c62982d 100644 --- a/src/server/gamedata/reader.go +++ b/src/server/gamedata/reader.go @@ -184,7 +184,7 @@ func GetStringValue(a interface{}, key string) string { if v == nil { return "" } - return v.(string) + String(v) } return "" } @@ -237,3 +237,22 @@ func Int(a interface{}) int { } return 0 } + +func String(a interface{}) string { + if a == nil { + return "" + } + switch v := a.(type) { + case int: + return strconv.Itoa(v) + case int32: + return strconv.Itoa(int(v)) + case int64: + return strconv.Itoa(int(v)) + case float64: + return strconv.FormatFloat(v, 'f', -1, 64) + case string: + return v + } + return "" +}