| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\common\command;
- use app\common\model\bank_account\BankAccount;
- use app\common\model\export\Export;
- use app\common\model\master_worker\MasterWorker;
- use app\common\model\master_worker\MasterWorkerInfo;
- use app\common\service\ExcelExportService;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use think\facade\Log;
- /**
- * 表格导出
- * Class OpenObtainOrder
- * @package app\command
- */
- class ExcelExport extends Command
- {
- protected function configure()
- {
- $this->setName('excel_export')->setDescription('表格导出');
- }
- protected function execute(Input $input, Output $output)
- {
- set_time_limit(180);
- ini_set('memory_limit', '1024M');
- try {
- Export::where('generate_status',0)->where('createtime','<',(time()-86400*2))->delete();
- $result = Export::where('generate_status',0)->findOrEmpty();
- if(!$result->isEmpty()){
- (new ExcelExportService)->download($result->id,true);
- }
- return true;
- } catch (\Exception $e) {
- Log::write('ExcelExport:'.$e->getMessage());
- return $e->getMessage();
- }
- }
- }
|