SyncRewardBases.php 741 B

12345678910111213141516171819
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\RewardBaseSyncService;
  4. use Illuminate\Console\Command;
  5. class SyncRewardBases extends Command
  6. {
  7. protected $signature = 'rewards:sync-bases {--from= : New York start date Y-m-d for backfill} {--to= : New York end date Y-m-d for backfill}';
  8. protected $description = 'Refresh unpaid rebate/backflow rows from per-category bet facts; never touches paid rows or wallets';
  9. public function handle(RewardBaseSyncService $service): int
  10. {
  11. $result = $service->run($this->option('from') ?: null, $this->option('to') ?: null);
  12. $this->line(json_encode($result, JSON_UNESCAPED_UNICODE));
  13. return $result['failed'] > 0 ? self::FAILURE : self::SUCCESS;
  14. }
  15. }