order-food-admin/app/Jobs/SendPickUpOrderNotice.php

55 lines
1.4 KiB
PHP

<?php
namespace App\Jobs;
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 App\Models\Order;
class SendPickUpOrderNotice implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $order;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Order $order)
{
//
$this->order = $order;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$temp_id = env('WECHAT_MINI_PROGRAM_TEMP_ID_PICKUP_ORDER', 'vQjq_quVE7AkafTtOuUVw4RKRaafimRvZnVy7zZ4Tdc');
$msg_data = [
'character_string22' => [
'value'=> $this->order->order_sn,
],
'date3' => [
'value'=> $this->order->pay_time,
],
'character_string19' => [
'value'=> $this->order->order_number,
],
'thing20' => [
'value'=>"您的餐品已制作完成,请到前台领取",
],
];
$this->order->user->sendMiniprogramNotice($temp_id, 'pages/order-my/order-info?order_sn='.$this->order->order_sn, $msg_data);
}
}