SyncReporting.php 668 B

123456789101112131415161718
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\Reporting\ReportSync;
  4. use Illuminate\Console\Command;
  5. class SyncReporting extends Command
  6. {
  7. protected $signature = 'reporting:sync {--full : 分批重新核对全部历史来源,不修改业务订单或钱包}';
  8. protected $description = '同步后台统一报表事实(默认增量,幂等,可重试)';
  9. public function handle(ReportSync $service): int
  10. {
  11. $result = $service->sync((bool) $this->option('full'));
  12. $this->line(json_encode($result, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR));
  13. return $result['errors'] > 0 ? self::FAILURE : self::SUCCESS;
  14. }
  15. }