SyncOrderPackageLogisticRouteTask.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\LogService;
  4. use App\Services\OrderPackageReceivedSyncService;
  5. use Illuminate\Console\Command;
  6. use Illuminate\Support\Facades\Log;
  7. class SyncOrderPackageLogisticRouteTask extends Command
  8. {
  9. /**
  10. * @var OrderPackageReceivedSyncService $service
  11. */
  12. public $service;
  13. /**
  14. * The name and signature of the console command.
  15. *
  16. * @var string
  17. */
  18. protected $signature = 'syncOrderPackageLogisticRouteTask';
  19. /**
  20. * The console command description.
  21. *
  22. * @var string
  23. */
  24. protected $description = 'Command description';
  25. /**
  26. * Create a new command instance.
  27. *
  28. * @return void
  29. */
  30. public function __construct()
  31. {
  32. parent::__construct();
  33. }
  34. /**
  35. * Execute the console command.
  36. *
  37. * @throws \Exception
  38. */
  39. public function handle()
  40. {
  41. $usage = memory_get_usage();
  42. $exeTime = microtime(true);
  43. ini_set('memory_limit', '2226M');
  44. $this->service = app('OrderPackageReceivedSyncService');
  45. $this->service->syncLogisticRoute();
  46. $this->service->syncLogisticRouteByAliJiSu();
  47. Log::warning("快递路由同步任务",["usage"=>(memory_get_usage()-$usage)/1048576,
  48. "elapsedTime"=>round(microtime(true)-$exeTime,3)]);//MB SECOND
  49. }
  50. }