Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dt_analysis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
dt_analysis
Commits
fbe19fe5
Commit
fbe19fe5
authored
Sep 10, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
04352d23
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
survey.go
api/mobile/survey.go
+2
-2
config.yaml
config.yaml
+1
-1
config.yaml
online/config.yaml
+1
-1
ipaddr.go
service/ipaddr.go
+4
-4
No files found.
api/mobile/survey.go
View file @
fbe19fe5
...
...
@@ -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
...
...
config.yaml
View file @
fbe19fe5
...
...
@@ -116,7 +116,7 @@ encrypt:
key
:
"
75SIQyfvwHDU0GbO"
common
:
type
:
"
2"
url
:
"
dt.
pet-dbc
.cn"
url
:
"
dt.
bk-pet
.cn"
sms
:
smsname
:
"
dbc"
...
...
online/config.yaml
View file @
fbe19fe5
...
...
@@ -116,7 +116,7 @@ encrypt:
key
:
"
75SIQyfvwHDU0GbO"
common
:
type
:
"
2"
url
:
"
dt.
pet-dbc
.cn"
url
:
"
dt.
bk-pet
.cn"
sms
:
smsname
:
"
dbc"
...
...
service/ipaddr.go
View file @
fbe19fe5
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment