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
afa23e56
Commit
afa23e56
authored
Sep 02, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
25b805b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
survey.go
api/mobile/survey.go
+14
-4
survey.go
model/survey.go
+8
-0
No files found.
api/mobile/survey.go
View file @
afa23e56
package
mobile
import
(
"fmt"
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/model/request"
...
...
@@ -24,12 +23,18 @@ func CreateSurveyUser(c *gin.Context) {
var
req
request
.
CreateSurveyUserReq
_
=
c
.
ShouldBindJSON
(
&
req
)
ipData
,
_
:=
service
.
GetIpaddr
(
c
.
ClientIP
())
SurveyUser
:=
model
.
SurveyUser
{
SurveyId
:
1
,
UserId
:
req
.
UserId
,
Contacts
:
req
.
Contacts
,
ContactsMobile
:
req
.
ContactsMobile
,
CreateTime
:
utils
.
NowTime
(),
Country
:
ipData
.
Country
,
Area
:
ipData
.
Area
,
Region
:
ipData
.
Region
,
City
:
ipData
.
City
,
}
_
,
surveyUserId
:=
service
.
CreateSurveyUser
(
SurveyUser
)
...
...
@@ -47,9 +52,14 @@ func CreateSurveyLog(c *gin.Context) {
var
req
model
.
SurveyLog
_
=
c
.
ShouldBindJSON
(
&
req
)
//ipData, _ := service.GetIpaddr(c.ClientIP())
ipData
,
_
:=
service
.
GetIpaddr
(
"125.34.219.138"
)
fmt
.
Println
(
ipData
)
ipData
,
_
:=
service
.
GetIpaddr
(
c
.
ClientIP
())
//ipData, _ := service.GetIpaddr("125.34.219.138")
//fmt.Println(ipData)
req
.
Country
=
ipData
.
Country
req
.
Area
=
ipData
.
Area
req
.
Region
=
ipData
.
Region
req
.
City
=
ipData
.
City
req
.
CreateTime
=
utils
.
NowTime
()
if
err
:=
service
.
CreateSurveyLog
(
req
);
err
!=
nil
{
...
...
model/survey.go
View file @
afa23e56
...
...
@@ -8,6 +8,10 @@ type SurveyUser struct {
Contacts
string
`gorm:"type:string(255)" json:"contacts"`
ContactsMobile
string
`gorm:"type:string(255)" json:"contacts_mobile"`
CreateTime
string
`gorm:"type:string(255)" json:"create_time"`
Country
string
`gorm:"type:string(255)" json:"country"`
Area
string
`gorm:"type:string(255)" json:"area"`
Region
string
`gorm:"type:string(255)" json:"region"`
City
string
`gorm:"type:string(255)" json:"city"`
}
type
SurveyUserData
struct
{
...
...
@@ -24,4 +28,8 @@ type SurveyLog struct {
UserId
int
`gorm:"type:int(255)" json:"user_id"`
Page
int
`gorm:"type:int(255)" json:"page"`
CreateTime
string
`gorm:"type:string(255)" json:"create_time"`
Country
string
`gorm:"type:string(255)" json:"country"`
Area
string
`gorm:"type:string(255)" json:"area"`
Region
string
`gorm:"type:string(255)" json:"region"`
City
string
`gorm:"type:string(255)" json:"city"`
}
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