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
44a625ac
Commit
44a625ac
authored
Sep 10, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3e8a66eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
15 deletions
+51
-15
survey.go
api/mobile/survey.go
+7
-15
moc.go
model/moc.go
+7
-0
moc.go
service/moc.go
+37
-0
No files found.
api/mobile/survey.go
View file @
44a625ac
...
...
@@ -15,11 +15,6 @@ import (
"time"
)
var
Moc
=
map
[
int
]
string
{
1
:
"直接留资"
,
2
:
"转介绍留资"
,
}
func
GetSurveyUserList
(
c
*
gin
.
Context
)
{
var
req
request
.
GetSurveyUserListReq
_
=
c
.
ShouldBindJSON
(
&
req
)
...
...
@@ -121,6 +116,8 @@ func ExportSurveyUserExcel(c *gin.Context) {
var
req
request
.
GetSurveyUserListReq
_
=
c
.
ShouldBindQuery
(
&
req
)
mocData
:=
service
.
GetMoc
(
1
)
req
.
PageSize
=
99999
req
.
Status
=
1
...
...
@@ -169,13 +166,6 @@ func ExportSurveyUserExcel(c *gin.Context) {
optionData
+=
v2
.
OptionValue
+
" * "
+
strconv
.
Itoa
(
v2
.
OptionNum
)
+
"; "
}
isReference
:=
"直接留资"
moc
:=
""
if
v
.
MocId
==
1
{
moc
=
"短信"
}
url
:=
global
.
GVA_CONFIG
.
Common
.
Url
+
"?"
+
v
.
Vcode
a
:=
strconv
.
Itoa
(
k
+
3
)
...
...
@@ -197,8 +187,8 @@ func ExportSurveyUserExcel(c *gin.Context) {
f
.
SetCellValue
(
fileName
,
"P"
+
a
,
""
)
f
.
SetCellValue
(
fileName
,
"Q"
+
a
,
v
.
Reference
)
f
.
SetCellValue
(
fileName
,
"R"
+
a
,
v
.
ReferenceMobile
)
f
.
SetCellValue
(
fileName
,
"S"
+
a
,
isReference
)
f
.
SetCellValue
(
fileName
,
"T"
+
a
,
moc
)
f
.
SetCellValue
(
fileName
,
"S"
+
a
,
mocData
[
v
.
MocId
]
)
f
.
SetCellValue
(
fileName
,
"T"
+
a
,
"短信"
)
f
.
SetCellValue
(
fileName
,
"U"
+
a
,
url
)
}
...
...
@@ -220,6 +210,8 @@ func ExportMocDataExcel(c *gin.Context) {
var
req
request
.
GetSurveyUserListReq
_
=
c
.
ShouldBindQuery
(
&
req
)
mocData
:=
service
.
GetMoc
(
1
)
fileName
:=
"数据统计"
+
time
.
Now
()
.
Format
(
"20060102"
)
f
:=
excelize
.
NewFile
()
// Create a new sheet.
...
...
@@ -237,7 +229,7 @@ func ExportMocDataExcel(c *gin.Context) {
f
.
SetCellValue
(
fileName
,
"J1"
,
"留资率"
)
f
.
SetCellValue
(
fileName
,
"K1"
,
"获客单价"
)
for
k
,
v
:=
range
Moc
{
for
k
,
v
:=
range
mocData
{
req
.
MocId
=
k
req
.
Status
=
1
surveyCount
:=
service
.
GetSurveyUserCount
(
req
)
//留资数量
...
...
model/moc.go
0 → 100644
View file @
44a625ac
package
model
type
Moc
struct
{
Id
int
`gorm:"type:int(255)" json:"id"`
Name
string
`gorm:"type:string(255)" json:"name"`
MocType
int
`gorm:"type:int(255)" json:"moc_type"`
}
service/moc.go
0 → 100644
View file @
44a625ac
package
service
import
(
"gin-vue-admin/global"
"gin-vue-admin/model"
"strconv"
)
func
GetMoc
(
mocType
int
)
map
[
int
]
string
{
list
:=
make
([]
model
.
Moc
,
0
)
table
:=
" moc "
//table := " survey_log as sl left join customer_user as cu on sl.user_id=cu.id "
field
:=
" id, name "
conditions
:=
""
if
mocType
!=
0
{
conditions
+=
" AND moc_type = "
+
strconv
.
Itoa
(
mocType
)
}
sqlStr2
:=
"SELECT "
+
field
+
" FROM "
+
table
+
" WHERE 1>0 "
+
conditions
global
.
GVA_DB
.
Raw
(
sqlStr2
)
.
Scan
(
&
list
)
if
global
.
GVA_DB
.
Error
!=
nil
{
return
nil
}
reply
:=
make
(
map
[
int
]
string
,
0
)
for
_
,
v
:=
range
list
{
reply
[
v
.
Id
]
=
v
.
Name
}
return
reply
}
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