khanegi setting and prices records
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\LivePriceTickService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class PriceTickCommand extends Command
|
||||
{
|
||||
protected $signature = 'prices:tick';
|
||||
|
||||
protected $description = 'Fetch live prices, sync products, cache last/list, log snapshot (every 10s)';
|
||||
|
||||
public function handle(LivePriceTickService $tickService): int
|
||||
{
|
||||
$tickService->tick();
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\PriceSnapshotService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class PrunePriceSnapshotsCommand extends Command
|
||||
{
|
||||
protected $signature = 'prices:prune';
|
||||
|
||||
protected $description = 'Downsample and prune price history (daily at midnight)';
|
||||
|
||||
public function handle(PriceSnapshotService $snapshots): int
|
||||
{
|
||||
$stats = $snapshots->pruneHistory();
|
||||
$this->info(json_encode($stats, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -2,19 +2,18 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\ProductPriceSyncService;
|
||||
use App\Services\LivePriceTickService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SyncProductPrices extends Command
|
||||
{
|
||||
protected $signature = 'product:sync-prices';
|
||||
|
||||
protected $description = 'Fetch zaarbox price board + sync product DB (scheduler: every 30s)';
|
||||
protected $description = 'Alias for prices:tick (backward compatible cron)';
|
||||
|
||||
public function handle(ProductPriceSyncService $syncService): int
|
||||
public function handle(LivePriceTickService $tickService): int
|
||||
{
|
||||
// کران: GET https://price.zaarbox.ir/api/free (یا zaarbox_api_url) → کش + UPDATE محصولات
|
||||
$syncService->syncAll(true);
|
||||
$tickService->tick();
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user