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
04352d23
Commit
04352d23
authored
Sep 10, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
20d48647
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
25 deletions
+59
-25
customer_user.go
api/mobile/customer_user.go
+48
-23
config.yaml
config.yaml
+1
-1
customer_user.go
model/request/customer_user.go
+1
-0
config.yaml
online/config.yaml
+1
-1
customer_user.go
service/customer_user.go
+8
-0
No files found.
api/mobile/customer_user.go
View file @
04352d23
...
...
@@ -31,28 +31,41 @@ func GetCustomerUserList(c *gin.Context) {
}
func
ExportMsgExcel
(
c
*
gin
.
Context
)
{
var
req
request
.
GetCustomerUserListReq
_
=
c
.
ShouldBindQuery
(
&
req
)
reqData
:=
request
.
GetCustomerUserListReq
{}
_
=
c
.
ShouldBindQuery
(
&
reqData
)
reqData
.
MocId
=
1
fileName
:=
"用户短链列表"
+
time
.
Now
()
.
Format
(
"20060102"
)
//region := []string{"广东", "福建", "江西", "安徽", "广西", "新疆", "天津", "山西", "贵州", "吉林", "北京", "上海", "黑龙江"}
regionIn
:=
"'广东','福建','江西','安徽','广西','新疆','天津','山西','贵州','吉林','北京','上海','黑龙江'"
f
:=
excelize
.
NewFile
()
codeList
:=
service
.
GetVcodeList
(
reqData
.
MocId
)
//for _, v := range region {
req
:=
request
.
GetCustomerUserListReq
{}
req
.
RegionIn
=
regionIn
//req.UserType = 2
req
.
PageSize
=
99999
_
,
list
,
_
:=
service
.
GetCustomerUserList
(
req
)
codeList
:=
service
.
GetVcodeList
(
req
.
MocId
)
fileName
:=
"用户短链列表"
+
time
.
Now
()
.
Format
(
"20060102"
)
f
:=
excelize
.
NewFile
()
sheetName
:=
"用户短链列表"
// Create a new sheet.
index
:=
f
.
NewSheet
(
file
Name
)
index
:=
f
.
NewSheet
(
sheet
Name
)
f
.
SetCellValue
(
fileName
,
"A1"
,
"用户ID"
)
f
.
SetCellValue
(
fileName
,
"B1"
,
"用户名称"
)
f
.
SetCellValue
(
fileName
,
"C1"
,
"省"
)
f
.
SetCellValue
(
fileName
,
"D1"
,
"市"
)
f
.
SetCellValue
(
fileName
,
"E1"
,
"区"
)
f
.
SetCellValue
(
fileName
,
"F1"
,
"工作人员"
)
f
.
SetCellValue
(
fileName
,
"G1"
,
"工作人员电话"
)
f
.
SetCellValue
(
fileName
,
"H1"
,
"短链"
)
f
.
SetCellValue
(
sheetName
,
"A1"
,
"用户ID"
)
f
.
SetCellValue
(
sheetName
,
"B1"
,
"用户名称"
)
f
.
SetCellValue
(
sheetName
,
"C1"
,
"省"
)
f
.
SetCellValue
(
sheetName
,
"D1"
,
"市"
)
f
.
SetCellValue
(
sheetName
,
"E1"
,
"区"
)
f
.
SetCellValue
(
sheetName
,
"F1"
,
"工作人员"
)
f
.
SetCellValue
(
sheetName
,
"G1"
,
"工作人员电话"
)
f
.
SetCellValue
(
sheetName
,
"H1"
,
"是否识别"
)
f
.
SetCellValue
(
sheetName
,
"I1"
,
"短链"
)
for
k
,
v
:=
range
list
{
url
:=
""
...
...
@@ -63,19 +76,27 @@ func ExportMsgExcel(c *gin.Context) {
url
=
global
.
GVA_CONFIG
.
Common
.
Url
+
"/"
+
service
.
GetVcode
(
v
.
Id
,
req
.
MocId
)
}
userType
:=
"未识别"
if
v
.
UserType
==
1
{
userType
=
"已识别"
}
a
:=
strconv
.
Itoa
(
k
+
2
)
f
.
SetCellValue
(
fileName
,
"A"
+
a
,
v
.
Id
)
f
.
SetCellValue
(
fileName
,
"B"
+
a
,
v
.
UserName
)
f
.
SetCellValue
(
fileName
,
"C"
+
a
,
v
.
Region
)
f
.
SetCellValue
(
fileName
,
"D"
+
a
,
v
.
City
)
f
.
SetCellValue
(
fileName
,
"E"
+
a
,
v
.
Zone
)
f
.
SetCellValue
(
fileName
,
"F"
+
a
,
v
.
WorkerName
)
f
.
SetCellValue
(
fileName
,
"G"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
fileName
,
"H"
+
a
,
url
)
f
.
SetCellValue
(
sheetName
,
"A"
+
a
,
v
.
Id
)
f
.
SetCellValue
(
sheetName
,
"B"
+
a
,
v
.
UserName
)
f
.
SetCellValue
(
sheetName
,
"C"
+
a
,
v
.
Region
)
f
.
SetCellValue
(
sheetName
,
"D"
+
a
,
v
.
City
)
f
.
SetCellValue
(
sheetName
,
"E"
+
a
,
v
.
Zone
)
f
.
SetCellValue
(
sheetName
,
"F"
+
a
,
v
.
WorkerName
)
f
.
SetCellValue
(
sheetName
,
"G"
+
a
,
v
.
WorkerMobile
)
f
.
SetCellValue
(
sheetName
,
"H"
+
a
,
userType
)
f
.
SetCellValue
(
sheetName
,
"I"
+
a
,
url
)
}
// Set active sheet of the workbook.
f
.
SetActiveSheet
(
index
)
//}
// Save xlsx file by the given path.
if
err
:=
f
.
SaveAs
(
"./"
+
fileName
+
".csv"
);
err
!=
nil
{
fmt
.
Println
(
err
)
...
...
@@ -87,3 +108,7 @@ func ExportMsgExcel(c *gin.Context) {
c
.
File
(
"./"
+
fileName
+
".csv"
)
return
}
func
msgExcel
(
req
request
.
GetCustomerUserListReq
)
{
}
config.yaml
View file @
04352d23
...
...
@@ -116,7 +116,7 @@ encrypt:
key
:
"
75SIQyfvwHDU0GbO"
common
:
type
:
"
2"
url
:
"
https://t
dt.pet-dbc.cn"
url
:
"
dt.pet-dbc.cn"
sms
:
smsname
:
"
dbc"
...
...
model/request/customer_user.go
View file @
04352d23
...
...
@@ -5,6 +5,7 @@ type GetCustomerUserListReq struct {
MocId
int
`gorm:"type:int(255)" json:"moc_id"`
UserName
string
`gorm:"type:string(255)" json:"user_name"`
Region
string
`gorm:"type:string(255)" json:"region"`
RegionIn
string
`gorm:"type:string(255)" json:"region_in"`
City
string
`gorm:"type:string(255)" json:"city"`
Zone
string
`gorm:"type:string(255)" json:"zone"`
Address
string
`gorm:"type:string(255)" json:"address"`
...
...
online/config.yaml
View file @
04352d23
...
...
@@ -116,7 +116,7 @@ encrypt:
key
:
"
75SIQyfvwHDU0GbO"
common
:
type
:
"
2"
url
:
"
https://dt.pet-dbc.cn/
"
url
:
"
dt.pet-dbc.cn
"
sms
:
smsname
:
"
dbc"
...
...
service/customer_user.go
View file @
04352d23
...
...
@@ -29,10 +29,18 @@ func GetCustomerUserList(req request.GetCustomerUserListReq) (error, []request.G
orderby
:=
" id asc "
if
req
.
UserType
!=
0
{
conditions
+=
" AND user_type = "
+
strconv
.
Itoa
(
req
.
UserType
)
}
if
req
.
UserName
!=
""
{
conditions
+=
" AND user_name like '%"
+
req
.
UserName
+
"%'"
}
if
req
.
RegionIn
!=
""
{
conditions
+=
" AND region in ("
+
req
.
RegionIn
+
")"
}
if
req
.
Region
!=
""
{
conditions
+=
" AND region like '%"
+
req
.
Region
+
"%'"
}
...
...
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