Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
dc3e69f2
Commit
dc3e69f2
authored
Jun 08, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
反馈数据导出
parent
e11cbd31
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
SourceController.php
backend/controllers/SourceController.php
+14
-1
feedback.php
backend/views/source/feedback.php
+9
-1
No files found.
backend/controllers/SourceController.php
View file @
dc3e69f2
...
...
@@ -294,7 +294,20 @@ class SourceController extends BaseController
}
}
$this
->
error
(
'删除成功'
,
'/admin/source/feedback'
);
}
elseif
(
$operation
==
2
)
{
//导出csv
$data
=
Feedback
::
find
()
->
select
([
'connect'
,
'content'
,
'type'
,
'create_at'
])
->
asArray
()
->
all
();
$handle
=
fopen
(
'php://temp'
,
'rw'
);
fputcsv
(
$handle
,
[
'联系方式'
,
'反馈内容'
,
'反馈类型'
,
'反馈时间'
]);
foreach
(
$data
as
$item
)
{
//todo 类型转换
if
(
$item
[
'type'
]
==
0
)
{
$item
[
'type'
]
=
'默认'
;
}
fputcsv
(
$handle
,
$item
);
}
Yii
::
$app
->
response
->
sendStreamAsFile
(
$handle
,
'feedback.csv'
);
Yii
::
$app
->
response
->
send
();
}
}
return
$this
->
render
(
'feedback'
);
...
...
backend/views/source/feedback.php
View file @
dc3e69f2
...
...
@@ -29,13 +29,21 @@
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"submit1"
>
查询
</button>
<button
class=
"layui-btn"
>
导出cvs
</button>
</div>
</form>
</div>
<div
class=
"layui-col-md3"
>
<div
style=
"float: right;"
>
<a
href=
"/admin/source/feedback?operation=2"
>
<button
class=
"layui-btn"
>
导出cvs
</button>
</a>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md8"
>
<table
class=
"layui-table"
id=
"table1"
></table>
</div>
</div>
<script>
var
form
=
layui
.
form
;
...
...
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