|
|
|
@ -0,0 +1,48 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Jobs; |
|
|
|
|
|
|
|
use App\Common\OrderStatus; |
|
|
|
use App\Models\Order; |
|
|
|
use App\Service\SmsService; |
|
|
|
use App\Traits\SmsTraits; |
|
|
|
use Illuminate\Bus\Queueable; |
|
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique; |
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
|
|
|
use Illuminate\Foundation\Bus\Dispatchable; |
|
|
|
use Illuminate\Queue\InteractsWithQueue; |
|
|
|
use Illuminate\Queue\SerializesModels; |
|
|
|
use Illuminate\Support\Facades\Log; |
|
|
|
|
|
|
|
class BalanceDue implements ShouldQueue |
|
|
|
{ |
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
|
|
|
|
|
|
|
protected $orderNumber = ''; |
|
|
|
protected $redis=''; |
|
|
|
/** |
|
|
|
* Create a new job instance. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function __construct($orderNumber,$delay) |
|
|
|
{ |
|
|
|
$this->orderNumber = $orderNumber; |
|
|
|
$this->delay = $delay; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Execute the job. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function handle() |
|
|
|
{ |
|
|
|
$order = Order::query()->where('order_no',$this->orderNumber)->first(); |
|
|
|
if(env('SMS_SWITCH' , '') == true && !empty($order->status) && ($order->status == OrderStatus::PAID || $order->status == OrderStatus::PAID_RETAINAGE)){ |
|
|
|
Log::info('队列执行'); |
|
|
|
$sms = new SmsService(); |
|
|
|
$sms->send('demand',['订单号:'.$this->orderNumber,'测试2',SmsTraits::$systeaNameText['supplier']],[15677177320]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |