From fbe19fe5d10135b83a861143db8f698fc17af644 Mon Sep 17 00:00:00 2001
From: haoyanbin <605649647@qq.com>
Date: Sun, 10 Sep 2023 16:06:17 +0800
Subject: [PATCH] 1

---
 api/mobile/survey.go | 4 ++--
 config.yaml          | 2 +-
 online/config.yaml   | 2 +-
 service/ipaddr.go    | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/api/mobile/survey.go b/api/mobile/survey.go
index c1ce3e5..565faa7 100755
--- a/api/mobile/survey.go
+++ b/api/mobile/survey.go
@@ -92,8 +92,8 @@ func CreateSurveyLog(c *gin.Context) {
 	var req model.SurveyLog
 	_ = c.ShouldBindJSON(&req)
 
-	ipData, _ := service.GetIpaddr(c.ClientIP())
-	//ipData, _ := service.GetIpaddr("125.34.219.138")
+	//ipData, _ := service.GetIpaddr(c.ClientIP())
+	ipData, _ := service.GetIpaddr("125.34.219.138")
 	//fmt.Println(ipData)
 
 	req.Country = ipData.Country
diff --git a/config.yaml b/config.yaml
index b37b3d7..fb305c0 100755
--- a/config.yaml
+++ b/config.yaml
@@ -116,7 +116,7 @@ encrypt:
   key: "75SIQyfvwHDU0GbO"
 common:
   type: "2"
-  url: "dt.pet-dbc.cn"
+  url: "dt.bk-pet.cn"
 
 sms:
   smsname: "dbc"
diff --git a/online/config.yaml b/online/config.yaml
index 6af1698..bae4a61 100755
--- a/online/config.yaml
+++ b/online/config.yaml
@@ -116,7 +116,7 @@ encrypt:
   key: "75SIQyfvwHDU0GbO"
 common:
   type: "2"
-  url: "dt.pet-dbc.cn"
+  url: "dt.bk-pet.cn"
 
 sms:
   smsname: "dbc"
diff --git a/service/ipaddr.go b/service/ipaddr.go
index 1e032a3..b234a63 100644
--- a/service/ipaddr.go
+++ b/service/ipaddr.go
@@ -18,18 +18,18 @@ func GetIpaddr(ip string) (utils.IpData, string) {
 
 	d, _ := time.ParseDuration("-6h")
 
-	beforetime := nowtime.Add(d)
+	beforetime := nowtime.Add(d).Format("2006-01-02 15:04:05")
 
 	data := new(model.Ipaddr)
 	table := " ipaddr "
-	field := " id, mobile, code, status "
+	field := " id, ip, code, data "
 
 	sqlStr := "SELECT " + field +
 		" FROM " + table +
-		" WHERE ip = ? and code = 200 and create_time > " +
+		" WHERE ip = '" + ip + "' and code = 200 and create_time > '" + beforetime + "'" +
 		" ORDER BY create_time desc "
 
-	err := global.GVA_DB.Raw(sqlStr, ip, beforetime).Find(&data)
+	err := global.GVA_DB.Raw(sqlStr).Find(&data)
 	if err != nil {
 		fmt.Println(err)
 	}
-- 
2.18.1