mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 19:12:48 +08:00
优化导出类的代码语义
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
$select_fields = json_decode($select_fields, true);
|
$select_fields = json_decode($select_fields, true);
|
||||||
$date_fields = json_decode($date_fields, true);
|
$date_fields = json_decode($date_fields, true);
|
||||||
|
|
||||||
$content = \app\common\tools\ExcelTools::exportModel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
|
$content = \app\common\tools\ExportTools::excel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
|
||||||
|
|
||||||
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
|
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ trait Curd
|
|||||||
$select_fields = json_decode($select_fields, true);
|
$select_fields = json_decode($select_fields, true);
|
||||||
$date_fields = json_decode($date_fields, true);
|
$date_fields = json_decode($date_fields, true);
|
||||||
|
|
||||||
$content = \app\common\tools\ExcelTools::exportModel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
|
$content = \app\common\tools\ExportTools::excel($this->model, $where, $fields, $image_fields, $select_fields, $date_fields);
|
||||||
|
|
||||||
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
|
return download($content, $this->model->getName() . date('YmdHis') . '.xlsx', true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ namespace app\common\tools;
|
|||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
|
|
||||||
class ExcelTools
|
class ExportTools
|
||||||
{
|
{
|
||||||
public static function exportModel($model, $where = [], $fields = [], $image_fields = [], $select_fields = [], $date_fields = [])
|
public static function excel($model, $where = [], $fields = [], $image_fields = [], $select_fields = [], $date_fields = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||||
Reference in New Issue
Block a user