From 2c8157ffd5799d827ee6bd58318167590fd963e0 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Fri, 26 Sep 2025 13:34:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E4=BC=98=E5=8C=96=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/UpdateUserNo.php | 15 ++++++++------- .../Controllers/Admin/SupplyDemandController.php | 9 +++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/Console/Commands/UpdateUserNo.php b/app/Console/Commands/UpdateUserNo.php index 22c0ea7..408f2cf 100755 --- a/app/Console/Commands/UpdateUserNo.php +++ b/app/Console/Commands/UpdateUserNo.php @@ -43,18 +43,19 @@ class UpdateUserNo extends Command public function handle() { // 已经开始的课程日期(所有历史数据处理) - $dateList = Course::whereNotNull('start_date') - ->where('start_date', '<=', date('Y-m-d')) - ->orderBy('start_date') - ->groupBy('start_date') - ->pluck('start_date') - ->toArray(); +// $dateList = Course::whereNotNull('start_date') +// ->where('start_date', '<=', date('Y-m-d')) +// ->orderBy('start_date') +// ->groupBy('start_date') +// ->pluck('start_date') +// ->toArray(); // 当日数据处理(日常定时任务) - //$dateList = [date('Y-m-d')]; + $dateList = [date('Y-m-d')]; foreach ($dateList as $date) { $courses = Course::with(['courseSigns' => function ($query) { $query->where('status', 1); }])->where('start_date', $date) + ->whereNotNull('student_prefix') ->orderBy('start_date') ->get(); $i = 1; diff --git a/app/Http/Controllers/Admin/SupplyDemandController.php b/app/Http/Controllers/Admin/SupplyDemandController.php index 1bfeb9a..70e10d2 100755 --- a/app/Http/Controllers/Admin/SupplyDemandController.php +++ b/app/Http/Controllers/Admin/SupplyDemandController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Exports\BaseExport; +use App\Exports\CommonExport; use App\Helpers\ResponseCode; use App\Models\AppointmentType; use App\Models\CustomForm; @@ -101,12 +102,8 @@ class SupplyDemandController extends BaseController } })->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc'); if (isset($all['is_export']) && !empty($all['is_export'])) { - $list = $list->get()->toArray(); - $export_fields = $all['export_fields'] ?? []; - // 导出文件名字 - $tableName = $this->model->getTable(); - $filename = (new CustomForm())->getTableComment($tableName); - return Excel::download(new BaseExport($export_fields, $list, $tableName), $filename . date('YmdHis') . '.xlsx'); + $list = $list->limit(5000)->get()->toArray(); + return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), $all['file_name'] ?? '' . date('YmdHis') . '.xlsx'); } else { // 输出 $list = $list->paginate($all['page_size'] ?? 20);