0
0
Files
Babyclass/app/Notifications/OrderSigned.php
2020-08-04 10:09:42 +08:00

48 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 [
//
];
}
}