|
|
@ -6,23 +6,28 @@ use app\logic\Zone; |
|
|
use think\console\Command; |
|
|
use think\console\Command; |
|
|
use think\console\Input; |
|
|
use think\console\Input; |
|
|
use think\console\Output; |
|
|
use think\console\Output; |
|
|
|
|
|
use think\console\input\Option; |
|
|
|
|
|
|
|
|
class Autousezone extends Command |
|
|
class Autousezone extends Command |
|
|
{ |
|
|
{ |
|
|
protected function configure() |
|
|
protected function configure() |
|
|
{ |
|
|
{ |
|
|
// 配置脚本命令的名称和描述 |
|
|
$this->setName('autousezone') |
|
|
$this->setName('Autousezone')->setDescription('自动完成刮奖脚本'); |
|
|
->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) |
|
|
protected function execute(Input $input, Output $output) |
|
|
{ |
|
|
{ |
|
|
$count = $input->getOption('limit') ?? 500; |
|
|
$limit = $input->getOption('limit'); |
|
|
$user_id = $input->getOption('user_id') ?? 1; |
|
|
$user_id = $input->getOption('user_id'); |
|
|
$zone_goods_id = $input->getOption('zone_goods_id') ?? 1; |
|
|
$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)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |