From 7fd2270570811c0d29f0d5d87d11bfc4612e0743 Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Sat, 07 Nov 2026 20:30:06 +0800
Subject: [PATCH] feat: 实现用户密码找回功能及相关配套功能

---
 server/handlers/admin.go |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/server/handlers/admin.go b/server/handlers/admin.go
index cd59794..bb55603 100644
--- a/server/handlers/admin.go
+++ b/server/handlers/admin.go
@@ -196,6 +196,7 @@
 		Cover       string `json:"cover"`
 		Description string `json:"description"`
 		FileURL     string `json:"file_url"`
+		LaunchExe   string `json:"launch_exe"`
 	}
 	if err := c.ShouldBindJSON(&req); err != nil || strings.TrimSpace(req.Name) == "" {
 		c.JSON(http.StatusOK, gin.H{"code": 1, "msg": "请填写工具名称"})
@@ -215,6 +216,7 @@
 	tool.Cover = req.Cover
 	tool.Description = req.Description
 	tool.FileURL = req.FileURL
+	tool.LaunchExe = req.LaunchExe
 	if req.ID > 0 {
 		config.DB.Save(&tool)
 	} else {
@@ -231,6 +233,19 @@
 
 // ---------- 游戏管理 ----------
 
+// isPlainNumber 校验非空纯数字(支持小数,如 232.6)
+func isPlainNumber(s string) bool {
+	if s == "" {
+		return false
+	}
+	for _, r := range s {
+		if (r < '0' || r > '9') && r != '.' {
+			return false
+		}
+	}
+	return true
+}
+
 func AdminListGames(c *gin.Context) {
 	var games []models.Game
 	config.DB.Order("id DESC").Find(&games)
@@ -248,6 +263,15 @@
 		c.JSON(http.StatusOK, gin.H{"code": 1, "msg": "请填写游戏名称"})
 		return
 	}
+	// 游戏大小/磁盘占用统一为GB,只允许纯数字(如 232.6)
+	if !isPlainNumber(game.Size) {
+		c.JSON(http.StatusOK, gin.H{"code": 1, "msg": "游戏大小请填写纯数字(单位GB),如 232.6"})
+		return
+	}
+	if !isPlainNumber(game.InstallSize) {
+		c.JSON(http.StatusOK, gin.H{"code": 1, "msg": "磁盘占用请填写纯数字(单位GB),如 411.6"})
+		return
+	}
 	if game.Screenshots == "" {
 		game.Screenshots = "[]"
 	}

--
Gitblit v1.10.0