| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Log;
- use App\Jobs\Manager\Process\LowPriceGoodsJobs;
- use App\Jobs\Manager\Process\ViolationProductJobs;
- use App\Jobs\Manager\Process\ViolationStoreJobs;
- /**
- * 定时任务
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- */
- class DailyTask extends Command
- {
- /**
- * 命令名称和签名
- *
- * @var string
- */
- protected $signature = 'task:daily';
- /**
- * 命令描述
- *
- * @var string
- */
- protected $description = '每天12点执行的定时任务';
- /**
- * 执行命令
- *
- * @return int
- */
- public function handle()
- {
- $this->info('开始执行每日任务...');
- try {
- // 示例:记录日志
- $this->info('每日任务执行完成!');
- return Command::SUCCESS;
- } catch (\Exception $e) {
- Log::error('每日定时任务执行失败: ' . $e->getMessage());
- $this->error('任务执行失败: ' . $e->getMessage());
- return Command::FAILURE;
- }
- }
- }
|