第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 30 分鐘后向客戶發(fā)送通知?

如何在 30 分鐘后向客戶發(fā)送通知?

PHP
慕無忌1623718 2022-10-14 16:31:44
在他點(diǎn)擊確認(rèn)交付后,我試圖在 30 分鐘后向客戶應(yīng)用發(fā)送通知。我創(chuàng)建了一個事件偵聽器來發(fā)送該通知,但是如何讓偵聽器偵聽一個事件并在 30 分鐘后發(fā)送該通知?這是我在 APIController 中的確認(rèn)交付功能:public function confirm_delivery(Request $request){    $id = (int)$request->order_id;    $order = Order::find($id);    Order::where('user_id', $user->id)->find($id)->update(['stage' => 9]);    $type = 'CUSTOMER_';    $uuid = $user->uniqid;    $order_id =$id;    $order_no =$order->order_no;    //Todo::Event to send notfifiction for user to rate place after 30 mins    event(new CustomerRatePlaceEvent($type,$uuid,$order_id,$order_no));    return ResponseHelper::customizedResponse(true, 1, 'Order delivered to customer.');}_在 CustomerRatePlaceEvent 中構(gòu)造:public $type;public $uuid;public $order_id;public $order_no;public function __construct($type,$uuid,$order_id,$order_no){    $this->type = $type;    $this->uuid = $uuid;    $this->order_id = $order_id;    $this->order_no = $order_no;}事件服務(wù)提供者: CustomerRatePlaceEvent::class => [     CustomerRatePlaceListener::class, ],CustomerRatePlaceListener:public function handle($event){    NotificationHelper::?ratePlaceNotification($event->type,$event->uuid,$event->order_id,$event->order_no);}(通知代碼在一個輔助函數(shù)中,它工作正常:NotificationHelper::?ratePlaceNotification)
查看完整描述

1 回答

?
蕭十郎

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個贊

隊列足以完成此任務(wù)。

您應(yīng)該使用延遲調(diào)度 - https://laravel.com/docs/7.x/queues#delayed-dispatching

當(dāng)用戶使用 api 端點(diǎn)或創(chuàng)建某些實(shí)體時,您調(diào)度延遲 30 分鐘。

像這樣的東西:

SendNotification::dispatch($podcast)->delay(now()->addMinutes(30));


查看完整回答
反對 回復(fù) 2022-10-14
  • 1 回答
  • 0 關(guān)注
  • 120 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號