64 lines
1.8 KiB
PHP
64 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use RuLong\Order\Models\Order;
|
|
|
|
class OrderCreatedNotify extends BaseNotification
|
|
{
|
|
protected static $title = '订单支付提醒';
|
|
|
|
protected $TPL = 'Gx2tH68kd7pretngGWO47CxvinnDAtyQOeIoEwQmo80';
|
|
|
|
protected $user;
|
|
|
|
protected $order;
|
|
|
|
public static function title()
|
|
{
|
|
return self::$title;
|
|
}
|
|
|
|
public function __construct(Order $order)
|
|
{
|
|
$this->order = $order;
|
|
}
|
|
|
|
public function toWechat($notifiable)
|
|
{
|
|
// $det = '';
|
|
// foreach ($this->order->details as $detail) {
|
|
// $det .= $detail->item->getTitle() . '*' . $detail->number . '/';
|
|
// }
|
|
// $det = rtrim($det, '/');
|
|
|
|
// $app = app('wechat.official_account');
|
|
// if($notifiable->openid){
|
|
// $app->template_message->send([
|
|
// 'touser' => $notifiable->openid,
|
|
// 'template_id' => $this->TPL,
|
|
// 'url' => route('orders.show',$this->order->orderid),
|
|
// 'data' => [
|
|
// 'first' => [
|
|
// 'value' => '恭喜您达到满仓资格,获得满仓奖励一份,您在“待付款”订单中支付满仓赠品的运费后,即可成功领取满仓奖励',
|
|
// 'color' => '#FF0000',
|
|
// ],
|
|
// 'keyword1' =>$this->order->created_at,
|
|
// 'keyword2' => $this->order->orderid,//订单编号
|
|
// 'keyword3' => $det,//商品名称
|
|
// 'keyword4' => number_format($this->order->total - $this->order->score,2),
|
|
// ],
|
|
|
|
// ]);
|
|
|
|
// }
|
|
}
|
|
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
}
|