From ed45d1a643647d60c4d430a4c5710719d8f7a17b Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Tue, 22 Aug 2023 15:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#40=20uint=20=E7=B1=BB=E5=9E=8B=E6=BA=A2?= =?UTF-8?q?=E5=87=BA=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/super/parse.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/super/parse.go b/utils/super/parse.go index 187e1af..4dea241 100644 --- a/utils/super/parse.go +++ b/utils/super/parse.go @@ -1,6 +1,7 @@ package super import ( + "math" "strconv" "strings" ) @@ -32,6 +33,11 @@ func StringToUint64(value string) uint64 { // StringToUint 字符串转换为 uint func StringToUint(value string) uint { result, _ := strconv.ParseUint(value, 10, 64) + if result > math.MaxUint { + return math.MaxUint + } else if result < math.MaxUint { + return 0 + } return uint(result) }