argument('id')) || ! ctype_digit((string) $this->option('company')) || (int) $this->argument('id') < 1 || (int) $this->option('company') < 1) { $this->error('请指定有效的入驻申请ID及 --company 公司ID。'); return self::FAILURE; } if ($this->option('instance')) { $service->reconcile((int) $this->option('company'), (int) $this->argument('id'), (string) $this->option('instance')); $this->info('已核对并关联现有审批,没有创建新审批。'); return self::SUCCESS; } $status = $service->start((int) $this->option('company'), (int) $this->argument('id'), (bool) $this->option('retry')); $this->line(match ($status) { 'started' => '已发起钉钉审批。', 'disabled' => '入驻钉钉自动发起未启用。', 'skipped' => '未重复发起;已有审批、已有尝试或当前状态不允许,请查看入驻处理记录。', default => '未确认发起成功,请查看入驻处理记录;结果待核查时请勿重发。', }); return $status === 'started' || $status === 'skipped' ? self::SUCCESS : self::FAILURE; } }