| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Log;
- use App\Jobs\Manager\Process\CityWarningNoticeJobs;
- class CityWarningNotice extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'task:city_warning_notice';
- /**
- * 命令描述
- *
- * @var string
- */
- protected $description = '每天12点执行的定时任务';
- /**
- * 执行命令
- *
- * @return int
- */
- public function handle()
- {
- $this->info('开始执行每日采集预警通知任务...' . now());
- try {
- Log::info('每日采集预警通知任务执行中 - ' . now());
- CityWarningNoticeJobs::dispatch();
- $this->info('每日采集预警通知执行完成!' . now());
- return Command::SUCCESS;
- } catch (\Exception $e) {
- $this->error('每日采集预警通知任务执行失败: ' . $e->getMessage());
- return Command::FAILURE;
- }
- }
- }
|