48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
||
|
||
namespace App\Notifications;
|
||
|
||
use RuLong\Order\Models\Order;
|
||
|
||
class OrderSigned extends BaseNotification
|
||
{
|
||
|
||
protected static $title = '订单签收提醒';
|
||
|
||
protected $user;
|
||
|
||
protected $order;
|
||
|
||
public static function title()
|
||
{
|
||
return self::$title;
|
||
}
|
||
|
||
public function __construct(Order $order)
|
||
{
|
||
$this->order = $order;
|
||
}
|
||
|
||
public function toWechat($notifiable)
|
||
{
|
||
$app = app('wechat.official_account');
|
||
if ($notifiable->openid) {
|
||
$str = '您好,您的订单由于主动签收或超过15天系统自动签收!!' . "\r\n\r\n";
|
||
$str .= '订单号:' . $this->order->orderid . "\r\n";
|
||
$str .= '下单时间:' . $this->order->created_at->format('Y-m-d H:i:s') . "\r\n";
|
||
$str .= '订单金额:' . number_format($this->order->amount, 2) . "\r\n";
|
||
$str .= '签收时间:' . date('Y-m-d H:i:s', time()) . "\r\n";
|
||
$str .= "<a href='" . route('orders.show', $this->order->orderid) . "'>点击查看详情</a>";
|
||
|
||
$app->customer_service->message($str)->to($notifiable->openid)->send();
|
||
}
|
||
}
|
||
|
||
public function toArray($notifiable)
|
||
{
|
||
return [
|
||
//
|
||
];
|
||
}
|
||
}
|