| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Console\Commands;
- use App\Services\Anime\AnimeService;
- use Illuminate\Console\Command;
- class CheckProductPicTasksCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'Anime:checkProductPicTasks';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '检查产品图片生成任务状态并更新产品记录';
- protected $animeService;
- public function __construct(AnimeService $animeService)
- {
- parent::__construct();
- $this->animeService = $animeService;
- }
- /**
- * Execute the console command.
- *
- * @return int
- */
- public function handle()
- {
- dLog('command')->info('====================开始检查产品图片生成任务状态====================');
- $time_start = microtime(true);
- $stats = $this->animeService->checkProductPicTasks();
- $time_end = microtime(true);
- $this->info('检查完成: ' . json_encode($stats, JSON_UNESCAPED_UNICODE));
- dLog('command')->info('产品图片生成任务检查完成', [
- 'stats' => $stats,
- 'cost_time' => round($time_end - $time_start, 2)
- ]);
- dLog('command')->info('====================结束检查产品图片生成任务状态====================');
- return 0;
- }
- }
|