From ff29de54fb67f5f524dd3a6ece9175ea7ee24424 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 14 Sep 2023 17:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=AE=E5=A5=96=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/Autousezone.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/command/Autousezone.php b/app/command/Autousezone.php index 1b7e619..5facfae 100644 --- a/app/command/Autousezone.php +++ b/app/command/Autousezone.php @@ -6,23 +6,28 @@ use app\logic\Zone; use think\console\Command; use think\console\Input; use think\console\Output; +use think\console\input\Option; class Autousezone extends Command { protected function configure() { - // 配置脚本命令的名称和描述 - $this->setName('Autousezone')->setDescription('自动完成刮奖脚本'); + $this->setName('autousezone') + ->setDescription('Description of Autousezone command') + ->addOption('limit', null, Option::VALUE_REQUIRED , 'Description of --limit option') + ->addOption('user_id', null, Option::VALUE_REQUIRED, 'Description of --user_id option') + ->addOption('zone_goods_id', null, Option::VALUE_REQUIRED, 'Description of --zone_goods_id option'); } protected function execute(Input $input, Output $output) { - $count = $input->getOption('limit') ?? 500; - $user_id = $input->getOption('user_id') ?? 1; - $zone_goods_id = $input->getOption('zone_goods_id') ?? 1; + $limit = $input->getOption('limit'); + $user_id = $input->getOption('user_id'); + $zone_goods_id = $input->getOption('zone_goods_id'); + // 处理您的代码逻辑,使用获取到的选项值 // 执行脚本逻辑 - $output->writeln(Zone::auto($user_id,$zone_goods_id,$count)); + $output->writeln(Zone::auto($user_id,$zone_goods_id,$limit)); } } \ No newline at end of file