From bb36010ca00e84d8d6ef2031ca03860dfc1ba08b Mon Sep 17 00:00:00 2001 From: wangsiyuan <2392948297@qq.com> Date: Mon, 5 Jun 2023 17:19:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20MysqlQuery.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改为配置文件连接 --- modules/MysqlQuery.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/MysqlQuery.go b/modules/MysqlQuery.go index 2bccf27..a1ab48d 100644 --- a/modules/MysqlQuery.go +++ b/modules/MysqlQuery.go @@ -13,9 +13,9 @@ type IpInformation struct { TimeZone string `json:"Time_Zone"` } -func MysqlQuery(ip string) IpInformation { +func MysqlQuery(ip string, dsn string) IpInformation { // 连接到MySQL数据库 - db, err := sql.Open("mysql", "root:990821@tcp(192.168.2.20:3306)/checkip") + db, err := sql.Open("mysql", dsn) if err != nil { log.Fatal(err) }