@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\console;
|
||||
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\console\input\Option;
|
||||
use think\console\Command;
|
||||
use addons\shopro\service\partner\DailySettleService;
|
||||
|
||||
class PartnerSettle extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('shopro:partner:settle')
|
||||
->addOption('date', 'd', Option::VALUE_OPTIONAL, '结算日期 Y-m-d,默认昨天')
|
||||
->addOption('rerun', 'r', Option::VALUE_NONE, '删除当天日结后重算')
|
||||
->setDescription('合伙股东日结(马豆/馆县均分/兑换券释放)');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$date = $input->getOption('date');
|
||||
$rerun = (bool) $input->getOption('rerun');
|
||||
$output->writeln('partner settle start ' . ($date ?: 'yesterday') . ($rerun ? ' rerun' : ''));
|
||||
try {
|
||||
$report = (new DailySettleService())->run($date, $rerun);
|
||||
$output->writeln('partner settle done: ' . json_encode($report ? $report->toArray() : [], JSON_UNESCAPED_UNICODE));
|
||||
return 0;
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln('partner settle fail: ' . $e->getMessage());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户