sifangpay/app/Jobs/NotifyOrderJob.php

52 lines
1.1 KiB
PHP

<?php
namespace App\Jobs;
use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Log;
class NotifyOrderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $order;
public $status;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Order $order,$status=1)
{
//
$this->order=$order;
$this->status=$status;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
//发起异步通知商户
//$this->order->id
try{
$id=$this->order->id;
$r=Order::notifyMerchant($id);
Log::info(json_encode($r));
}catch (\Exception $exception)
{
Log::info('异常.'.$exception->getMessage());
}
}
}