48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
declare (strict_types=1);
|
|
|
|
namespace addon\commission\command;
|
|
|
|
|
|
use addon\commission\model\Legumes;
|
|
use addon\commission\model\Partner;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\input\Argument;
|
|
use think\console\Output;
|
|
|
|
class Commission extends Command{
|
|
protected function configure(){
|
|
// 指令配置
|
|
$this->setName('commission')
|
|
->addArgument('run_type', Argument::OPTIONAL, "运行类型")
|
|
->setDescription('平台抽成相关任务');
|
|
}
|
|
|
|
protected function execute(Input $input,Output $output){
|
|
// 参数获取
|
|
$runType = trim($input->getArgument('run_type'));
|
|
$runType = $runType ?: '';
|
|
// 根据类型执行对应的操作
|
|
switch($runType){
|
|
// 合伙人佣金结算
|
|
case 'partner_settlement':
|
|
trace($runType, '计划任务 - 合伙人佣金周期计算 - 开始处理');
|
|
|
|
(new Partner())->settlementInit();
|
|
break;
|
|
// 计算昨天产生的豆豆总数
|
|
case 'compute_legumes':
|
|
trace($runType, '计划任务 - 计算昨日产生的豆豆总数 - 开始处理');
|
|
|
|
(new Legumes())->computeYesterdayLegumes();
|
|
break;
|
|
default:
|
|
trace($runType, '计划任务 - 错误 - 不明确的执行内容');
|
|
break;
|
|
}
|
|
// $output->writeln('接收参数:'. $runType);
|
|
// $output->writeln('success');
|
|
}
|
|
}
|