setName('plan:push-touchkebao-daily') ->setDescription('场景获客计划:按日上限+时段批量推送到触客宝 AI 获客') ->addOption('planId', null, Option::VALUE_OPTIONAL, '指定计划 ID,0=全部启用计划', 0); } protected function execute(Input $input, Output $output) { $planId = max(0, (int)$input->getOption('planId')); if ($planId > 0) { $result = TouchkebaoAiLeadPushService::pushPlanDailyTouchkebao($planId); $msg = $result['message'] ?? 'done'; $output->writeln($msg); Log::info('[plan:push-touchkebao-daily] planId=' . $planId . ' ' . $msg); return !empty($result['success']) ? 0 : 1; } $summary = TouchkebaoAiLeadPushService::pushAllEnabledPlansDaily(); $line = sprintf( 'plan:push-touchkebao-daily done ok=%d skip=%d fail=%d', (int)($summary['ok'] ?? 0), (int)($summary['skip'] ?? 0), (int)($summary['fail'] ?? 0) ); $output->writeln('' . $line . ''); Log::info('[plan:push-touchkebao-daily] ' . $line); return 0; } }