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