Commit fbe19fe5 authored by haoyanbin's avatar haoyanbin

1

parent 04352d23
...@@ -92,8 +92,8 @@ func CreateSurveyLog(c *gin.Context) { ...@@ -92,8 +92,8 @@ func CreateSurveyLog(c *gin.Context) {
var req model.SurveyLog var req model.SurveyLog
_ = c.ShouldBindJSON(&req) _ = c.ShouldBindJSON(&req)
ipData, _ := service.GetIpaddr(c.ClientIP()) //ipData, _ := service.GetIpaddr(c.ClientIP())
//ipData, _ := service.GetIpaddr("125.34.219.138") ipData, _ := service.GetIpaddr("125.34.219.138")
//fmt.Println(ipData) //fmt.Println(ipData)
req.Country = ipData.Country req.Country = ipData.Country
......
...@@ -116,7 +116,7 @@ encrypt: ...@@ -116,7 +116,7 @@ encrypt:
key: "75SIQyfvwHDU0GbO" key: "75SIQyfvwHDU0GbO"
common: common:
type: "2" type: "2"
url: "dt.pet-dbc.cn" url: "dt.bk-pet.cn"
sms: sms:
smsname: "dbc" smsname: "dbc"
......
...@@ -116,7 +116,7 @@ encrypt: ...@@ -116,7 +116,7 @@ encrypt:
key: "75SIQyfvwHDU0GbO" key: "75SIQyfvwHDU0GbO"
common: common:
type: "2" type: "2"
url: "dt.pet-dbc.cn" url: "dt.bk-pet.cn"
sms: sms:
smsname: "dbc" smsname: "dbc"
......
...@@ -18,18 +18,18 @@ func GetIpaddr(ip string) (utils.IpData, string) { ...@@ -18,18 +18,18 @@ func GetIpaddr(ip string) (utils.IpData, string) {
d, _ := time.ParseDuration("-6h") d, _ := time.ParseDuration("-6h")
beforetime := nowtime.Add(d) beforetime := nowtime.Add(d).Format("2006-01-02 15:04:05")
data := new(model.Ipaddr) data := new(model.Ipaddr)
table := " ipaddr " table := " ipaddr "
field := " id, mobile, code, status " field := " id, ip, code, data "
sqlStr := "SELECT " + field + sqlStr := "SELECT " + field +
" FROM " + table + " 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 " " 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 { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment