addArgument('name', InputArgument::OPTIONAL, '生成卡号'); } protected function execute(InputInterface $input, OutputInterface $output): int { try { $issue = CardIssue::where('card_issue_id', 5)->first(); $cards = []; for ($i = 0; $i < $issue->card_issue_num; $i++) { $cardId = $issue->card_issue_serial_prefix . str_pad($issue->card_issue_serial_begin + $i, $issue->card_issue_serial_length - strlen($issue->card_issue_serial_prefix), '0', STR_PAD_LEFT); $cards[] = [ 'card_id' => $cardId, 'join_card_main_id' => $issue->join_issue_card_main_id, 'join_card_issue_id' => $issue->card_issue_id, 'card_status' => 'INIT', 'card_cdkey' => random_string(8, 'number'), 'card_addtimes' => time() ]; } Card::insert($cards); return self::SUCCESS; } catch (\Exception $e) { dump($e->getMessage()); return self::SUCCESS; } } }