正在显示
7 个修改的文件
包含
44 行增加
和
6 行删除
@@ -193,4 +193,40 @@ class Study extends Backend | @@ -193,4 +193,40 @@ class Study extends Backend | ||
193 | $this->success(); | 193 | $this->success(); |
194 | } | 194 | } |
195 | 195 | ||
196 | + /** | ||
197 | + * 批量下载 | ||
198 | + */ | ||
199 | + public function download($ids) | ||
200 | + { | ||
201 | + $list = $this->model->where('id ', 'in', $ids)->select(); | ||
202 | + $zip = new \ZipArchive; | ||
203 | + $filename = 'tmp/' . date('Ymd',time()) . '_u' . $this->auth->id . '_reports.zip'; | ||
204 | + if ($zip->open($filename,\ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE){ | ||
205 | + foreach ($list as $publish) { | ||
206 | + $filepath = 'uploads' . 'l' . $publish->file; | ||
207 | + if (!file_exists($filepath)) { | ||
208 | + $this->error($publish->code . '文件未找到'); | ||
209 | + }else { | ||
210 | + $zip->addFile($filepath, basename($filepath)); | ||
211 | + } | ||
212 | + } | ||
213 | + } | ||
214 | + //打包zip | ||
215 | + $zip->close(); | ||
216 | + if (!file_exists($filename)) { | ||
217 | + $this->error('创建下载文件失败!'); | ||
218 | + } | ||
219 | + Header("Cache-Control : public"); | ||
220 | + Header("Content-type: application/octet-stream"); | ||
221 | + // Header("Content-type: application/zip"); | ||
222 | + header("Content-Transfer-Encoding : binary"); | ||
223 | + Header("Accept-Length: " . filesize($filename)); | ||
224 | + Header( "Cache-Control : public"); | ||
225 | + Header( "Content-type: application/octet-stream");//Header( "Content-type: application/zip"); | ||
226 | + header( "Content-Transfer-Encoding: binary"); | ||
227 | + Header( "Accept-Length: " . filesize($filename)); | ||
228 | + Header("Content-Disposition: attachment; filename=" . basename($filename));//输出文件内容 | ||
229 | + readfile($filename);flush(); | ||
230 | + // return json(0); | ||
231 | + } | ||
196 | } | 232 | } |
@@ -21,5 +21,6 @@ return [ | @@ -21,5 +21,6 @@ return [ | ||
21 | 'Updatetime' => '更新时间', | 21 | 'Updatetime' => '更新时间', |
22 | 'Grade.name' => '班级名称', | 22 | 'Grade.name' => '班级名称', |
23 | 'School.title' => '校区名称', | 23 | 'School.title' => '校区名称', |
24 | - 'Team.title' => '战队昵称' | 24 | + 'Team.title' => '战队昵称', |
25 | + 'Download' => '批量下载' | ||
25 | ]; | 26 | ]; |
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('study/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | 10 | <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('study/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> |
11 | <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('你的权限规则')?'':'hide'}" title="导入" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> 导入</a> | 11 | <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('你的权限规则')?'':'hide'}" title="导入" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> 导入</a> |
12 | <a href="javascript:;" class="btn btn-success btn-export {:$auth->check('study/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i> {:__('Export')}</a> | 12 | <a href="javascript:;" class="btn btn-success btn-export {:$auth->check('study/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i> {:__('Export')}</a> |
13 | + <a href="javascript:;" class="btn btn-success btn-download {:$auth->check('study/download')?'':'hide'}" title="{:__('Download')}" id="btn-download-file"><i class="fa fa-download"></i> {:__('Download')}</a> | ||
13 | 14 | ||
14 | <div class="dropdown btn-group {:$auth->check('study/multi')?'':'hide'}"> | 15 | <div class="dropdown btn-group {:$auth->check('study/multi')?'':'hide'}"> |
15 | <ul class="dropdown-menu text-left" role="menu"> | 16 | <ul class="dropdown-menu text-left" role="menu"> |
@@ -29,7 +29,7 @@ class Screen extends Api | @@ -29,7 +29,7 @@ class Screen extends Api | ||
29 | public function index(){ | 29 | public function index(){ |
30 | $time = time(); | 30 | $time = time(); |
31 | $list = []; | 31 | $list = []; |
32 | - $data = db('data_screen')->find(); | 32 | + $data = db('screen')->find(); |
33 | $list['images'] = cdnurl($data['images'],true); | 33 | $list['images'] = cdnurl($data['images'],true); |
34 | if ($data['starttime']<=$time || $data['endtime']>=$time){ | 34 | if ($data['starttime']<=$time || $data['endtime']>=$time){ |
35 | $times = $data['endtime'] - $time; | 35 | $times = $data['endtime'] - $time; |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | "ext-bcmath": "*", | 32 | "ext-bcmath": "*", |
33 | "txthinking/mailer": "^2.0", | 33 | "txthinking/mailer": "^2.0", |
34 | "phpoffice/phpexcel": "^1.8", | 34 | "phpoffice/phpexcel": "^1.8", |
35 | - "tinymeng/code": "^2.0" | 35 | + "tinymeng/code": "^2.0", |
36 | }, | 36 | }, |
37 | "config": { | 37 | "config": { |
38 | "preferred-install": "dist", | 38 | "preferred-install": "dist", |
@@ -4935,7 +4935,7 @@ | @@ -4935,7 +4935,7 @@ | ||
4935 | 4935 | ||
4936 | </div> | 4936 | </div> |
4937 | <div class="col-md-6" align="right"> | 4937 | <div class="col-md-6" align="right"> |
4938 | - Generated on 2023-03-11 09:49:30 <a href="./" target="_blank">校园活动</a> | 4938 | + Generated on 2023-03-11 13:32:27 <a href="./" target="_blank">校园活动</a> |
4939 | </div> | 4939 | </div> |
4940 | </div> | 4940 | </div> |
4941 | 4941 |
@@ -16,7 +16,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -16,7 +16,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
16 | }); | 16 | }); |
17 | 17 | ||
18 | var table = $("#table"); | 18 | var table = $("#table"); |
19 | - | ||
20 | //导出功能 | 19 | //导出功能 |
21 | $(document).on("click", ".btn-export", function () { | 20 | $(document).on("click", ".btn-export", function () { |
22 | var ids = Table.api.selectedids(table); | 21 | var ids = Table.api.selectedids(table); |
@@ -104,10 +103,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -104,10 +103,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
104 | formatter: Table.api.formatter.operate} | 103 | formatter: Table.api.formatter.operate} |
105 | ] | 104 | ] |
106 | ] | 105 | ] |
107 | - }); | 106 | + }), |
108 | 107 | ||
109 | // 为表格绑定事件 | 108 | // 为表格绑定事件 |
110 | Table.api.bindevent(table); | 109 | Table.api.bindevent(table); |
110 | + | ||
111 | }, | 111 | }, |
112 | add: function () { | 112 | add: function () { |
113 | Controller.api.bindevent(); | 113 | Controller.api.bindevent(); |
-
请 注册 或 登录 后发表评论