37 lines
1021 B
PHP
37 lines
1021 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Concerns;
|
|
|
|
use Modules\EcommerceFinance\Services\BillPerformanceResyncDispatcher;
|
|
use Throwable;
|
|
|
|
trait QueuesBillPerformanceResync
|
|
{
|
|
protected function queueBillPerformanceResync(
|
|
BillPerformanceResyncDispatcher $dispatcher,
|
|
string $platform,
|
|
array $result,
|
|
): bool {
|
|
try {
|
|
$queued = $dispatcher->dispatch(
|
|
$platform,
|
|
(string) ($result['period_start'] ?? ''),
|
|
(string) ($result['period_end'] ?? ''),
|
|
);
|
|
} catch (Throwable $exception) {
|
|
report($exception);
|
|
$this->error('账单已导入,但业绩明细重算任务排队失败;请重新执行本导入命令以重试排队。');
|
|
|
|
return false;
|
|
}
|
|
|
|
$this->line(
|
|
'业绩明细重算已排队:'
|
|
. implode('、', $queued['months'])
|
|
. '(新增 ' . $queued['jobs'] . ' 个任务)'
|
|
);
|
|
|
|
return true;
|
|
}
|
|
}
|