| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace App\Console\Commands;
- use App\Services\LogService;
- use App\Services\OrderTrackingService;
- use Illuminate\Console\Command;
- use Illuminate\Support\Carbon;
- use Illuminate\Support\Facades\Auth;
- class WASSyncWMSOrderInformation extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'WASSyncWMSOrderInformation';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '同步WMS的订单信息';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return int
- */
- public function handle()
- {
- sleep(rand(15,30));
- $this->WasSyncWmsOrder();
- }
- public function WasSyncWmsOrder(){
- /** @var OrderTrackingService $orderTrackingService */
- $orderTrackingService = app('OrderTrackingService');
- $dataInterval = intval(data_get(config('sync'), 'order_tracking_import.interval')) * 60 + 5;
- $startDate = Carbon::now()->subSeconds($dataInterval);
- $syncStartDate = data_get(config('sync'), 'order_tracking_import.start_at');
- if($syncStartDate ?? false){
- $syncStartDate = Carbon::parse($syncStartDate);
- if ($startDate->lt($syncStartDate)) {
- $startDate = $syncStartDate;
- }
- }
- // $startDate = Carbon::parse('2020-05-06 13:16:51')->toDateTimeString();
- // $orderTrackingService->根据设置从WMS同步追踪货主的订单($startDate);
- $orderTrackingService->trackingWmsOrder($startDate);
- }
- }
|