作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -185,18 +185,18 @@ class AdminEquipmentController extends AdminBaseController{ @@ -185,18 +185,18 @@ class AdminEquipmentController extends AdminBaseController{
185 185
186 public function ceshi(){ 186 public function ceshi(){
187 $ids=$this->request->param('ids/a'); 187 $ids=$this->request->param('ids/a');
188 - $this->success('成功'.$ids[0]); 188 + $data=$this->batch_export($ids);
  189 + if ($data==true){
  190 + $this->success('成功');
  191 + }else{
  192 + $this->error('失败');
  193 + }
  194 +
189 } 195 }
190 196
191 //批量导出 197 //批量导出
192 - public function batch_export(){  
193 - $ids=$this->request->param('ids/a');  
194 - if (empty($ids)){  
195 - dump('数据为空');  
196 - exit();  
197 - } 198 + public function batch_export($ids){
198 $data= Db::name('equipment')->where(['id' => ['in', $ids]])->select(); 199 $data= Db::name('equipment')->where(['id' => ['in', $ids]])->select();
199 -  
200 // 导出Exl 200 // 导出Exl
201 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel"); 201 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel");
202 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Drawing"); 202 vendor("VENDOR_PATH/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/Drawing");
@@ -279,7 +279,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -279,7 +279,7 @@ class AdminEquipmentController extends AdminBaseController{
279 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); 279 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
280 $objWriter->save('php://output'); //文件通过浏览器下载 280 $objWriter->save('php://output'); //文件通过浏览器下载
281 // END 281 // END
282 - $this->success('success'); 282 + return true;
283 } 283 }
284 284
285 //生成二维码 285 //生成二维码