正在显示
6 个修改的文件
包含
4 行增加
和
104 行删除
@@ -183,27 +183,6 @@ class Study extends Backend | @@ -183,27 +183,6 @@ class Study extends Backend | ||
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | - public function down_all() | ||
187 | - { | ||
188 | - $data = input(); | ||
189 | - $path_arr = []; | ||
190 | - foreach ($data['data'] as $k => $v) { | ||
191 | - $path_arr[] = public_url() . $v['barcode']; | ||
192 | - } | ||
193 | - makeZip($path_arr); | ||
194 | - $id_arr = array_column($data['data'], 'id'); | ||
195 | - $res = \app\admin\model\Study::where('id', 'in', $id_arr)->update(['down' => 1]); | ||
196 | - if (!$res) { | ||
197 | - $this->success(''); | ||
198 | - } | ||
199 | - } | ||
200 | - | ||
201 | - | ||
202 | - public function down_file() | ||
203 | - { | ||
204 | - downloadFile(public_url() . '/barcode.zip'); | ||
205 | - } | ||
206 | - | ||
207 | 186 | ||
208 | /** | 187 | /** |
209 | * 添加 | 188 | * 添加 |
@@ -312,7 +291,7 @@ class Study extends Backend | @@ -312,7 +291,7 @@ class Study extends Backend | ||
312 | $ids = explode(',', $ids); | 291 | $ids = explode(',', $ids); |
313 | $arr = $product->whereIn('id' , $ids)->field('barcode')->select(); | 292 | $arr = $product->whereIn('id' , $ids)->field('barcode')->select(); |
314 | foreach ($arr as $v){ | 293 | foreach ($arr as $v){ |
315 | - $v['barcode'] = substr($v['barcode'],20); | 294 | + //$v['barcode'] = substr($v['barcode'],20); |
316 | $as = ROOT_PATH.'public/'.$v['barcode']; | 295 | $as = ROOT_PATH.'public/'.$v['barcode']; |
317 | $data[]=$as; | 296 | $data[]=$as; |
318 | } | 297 | } |
@@ -323,11 +302,11 @@ class Study extends Backend | @@ -323,11 +302,11 @@ class Study extends Backend | ||
323 | // zip 临时文件 | 302 | // zip 临时文件 |
324 | $tmp_dir = $url . 'temp/'; | 303 | $tmp_dir = $url . 'temp/'; |
325 | // zip名称 | 304 | // zip名称 |
326 | - $zip_name = 'quality_'.time().'.zip'; | 305 | + $zip_name = 'images'.time().'.zip'; |
327 | // 打包 | 306 | // 打包 |
328 | $zipName = $this->zip_files($data, $tmp_dir.$zip_name); | 307 | $zipName = $this->zip_files($data, $tmp_dir.$zip_name); |
329 | //下载 | 308 | //下载 |
330 | - $down = 'http://campus.shs.broing.cn/temp/'.$zip_name; | 309 | + $down = 'http://campus.cn/temp/'.$zip_name; |
331 | downloads($down); | 310 | downloads($down); |
332 | } | 311 | } |
333 | 312 |
@@ -10,8 +10,7 @@ | @@ -10,8 +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-success 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-success 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-danger 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-danger btn-export {:$auth->check('study/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i> {:__('Export')}</a> |
13 | - <a class="btn btn-info btn-disabled disabled btn-selected" href="javascript:;"><i class="fa fa-leaf"></i> 批量下载</a> | ||
14 | - <a href="#" title="下载分享码" class="btn btn-success btn-disabled download {:$auth->check('study/multi')?'':'hide'} ">下载分享码</a> | 13 | + <a href="#" title="下载分享码" class="btn btn-success btn-disabled download {:$auth->check('study/multi')?'':'hide'} ">下载条形码</a> |
15 | 14 | ||
16 | <div class="dropdown btn-group {:$auth->check('study/multi')?'':'hide'}"> | 15 | <div class="dropdown btn-group {:$auth->check('study/multi')?'':'hide'}"> |
17 | <ul class="dropdown-menu text-left" role="menu"> | 16 | <ul class="dropdown-menu text-left" role="menu"> |
@@ -512,67 +512,6 @@ EOT; | @@ -512,67 +512,6 @@ EOT; | ||
512 | return $icon; | 512 | return $icon; |
513 | } | 513 | } |
514 | 514 | ||
515 | - //添加方法 | ||
516 | - | ||
517 | - if (!function_exists('downloadFile')) { | ||
518 | - function downloadFile($filePath, $readBuffer = 1024) | ||
519 | - { | ||
520 | - //检测下载文件是否存在 并且可读 | ||
521 | - if (!is_file($filePath) && !is_readable($filePath)) { | ||
522 | - return false; | ||
523 | - } | ||
524 | - //设置头信息 | ||
525 | - //声明浏览器输出的是字节流 | ||
526 | - header('Content-Type: application/octet-stream'); | ||
527 | - //声明浏览器返回大小是按字节进行计算 | ||
528 | - header('Accept-Ranges:bytes'); | ||
529 | - //告诉浏览器文件的总大小 | ||
530 | - $fileSize = filesize($filePath);//坑 filesize 如果超过2G 低版本php会返回负数 | ||
531 | - header('Content-Length:' . $fileSize); //注意是'Content-Length:' 非Accept-Length | ||
532 | - //声明下载文件的名称 | ||
533 | - header('Content-Disposition:attachment;filename=' . basename($filePath));//声明作为附件处理和下载后文件的名称 | ||
534 | - //获取文件内容 | ||
535 | - $handle = fopen($filePath, 'rb');//二进制文件用‘rb’模式读取 | ||
536 | - while (!feof($handle)) { //循环到文件末尾 规定每次读取(向浏览器输出为$readBuffer设置的字节数) | ||
537 | - echo fread($handle, $readBuffer); | ||
538 | - } | ||
539 | - fclose($handle);//关闭文件句柄 | ||
540 | - exit; | ||
541 | - } | ||
542 | - } | ||
543 | - | ||
544 | - | ||
545 | - function makeZip($datalist = []) | ||
546 | - { | ||
547 | - $filename = 'images.zip'; //最终生成的文件名(含路径) | ||
548 | - if (file_exists($filename)) { | ||
549 | - unlink($filename); | ||
550 | - } | ||
551 | - //重新生成文件 | ||
552 | - $zip = new ZipArchive(); | ||
553 | - if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { | ||
554 | - exit('无法打开文件,或者文件创建失败'); | ||
555 | - } | ||
556 | - // $datalist=array('try.php','zip_class.php'); | ||
557 | - foreach ($datalist as $val) { | ||
558 | - if (file_exists($val)) { | ||
559 | - $path_parts = pathinfo($val); | ||
560 | - $zip->addFile($val, $path_parts['basename']); | ||
561 | - } | ||
562 | - } | ||
563 | - $zip->close();//关闭 | ||
564 | - if (!file_exists($filename)) { | ||
565 | - exit('无法找到文件'); //即使创建,仍有可能失败 | ||
566 | - } | ||
567 | - return $filename; | ||
568 | - } | ||
569 | - | ||
570 | - function public_url($path = '') | ||
571 | - { | ||
572 | - $upload_path = str_replace('\\', '/', ROOT_PATH); | ||
573 | - return $upload_path . 'public' . $path; | ||
574 | - } | ||
575 | - | ||
576 | /** | 515 | /** |
577 | *下载小程序码到浏览器 | 516 | *下载小程序码到浏览器 |
578 | * | 517 | * |
@@ -21,23 +21,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -21,23 +21,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
21 | }); | 21 | }); |
22 | 22 | ||
23 | var table = $("#table"); | 23 | var table = $("#table"); |
24 | - //批量下载 | ||
25 | - $(document).on("click", ".btn-selected", function () { | ||
26 | - $.ajax({ | ||
27 | - type: 'post', | ||
28 | - url: 'study/down_all', | ||
29 | - data: {data: table.bootstrapTable('getSelections')}, | ||
30 | - success: function (res) { | ||
31 | - if (res.code === 1) { | ||
32 | - var domain = window.location.href.split(':')[0] + '://' + document.domain; | ||
33 | - var url = domain + '/back.php/study/down_file'; | ||
34 | - window.location.href = url; | ||
35 | - location.reload(); | ||
36 | - $(".btn-refresh").trigger("click"); | ||
37 | - } | ||
38 | - } | ||
39 | - }); | ||
40 | - }); | ||
41 | 24 | ||
42 | //导出功能 | 25 | //导出功能 |
43 | $(document).on("click", ".btn-export", function () { | 26 | $(document).on("click", ".btn-export", function () { |
public/images.zip
0 → 100644
不能预览此文件类型
public/temp/quality_1678890688.zip
0 → 100644
不能预览此文件类型
-
请 注册 或 登录 后发表评论