123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- namespace App\Notifications;
- use App\Channels\SendMiniChannel;
- use App\Models\Model;
- use App\Models\User;
- use Illuminate\Bus\Queueable;
- use Illuminate\Notifications\Notification;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Notifications\Messages\MailMessage;
- class OrderNoPayNotification extends Notification
- {
- use Queueable;
- public static $user;
- public static $order;
-
- public function __construct(User $user,$order)
- {
-
- self::$user = $user;
- self::$order = $order;
- }
-
- public function via($notifiable)
- {
- return [SendMiniChannel::class];
- }
-
- public function toMail($notifiable)
- {
- return (new MailMessage)
- ->line('The introduction to the notification.')
- ->action('Notification Action', url('/'))
- ->line('Thank you for using our application!');
- }
-
- public function toArray($notifiable)
- {
- return [
-
- ];
- }
-
- public function toSendMini($notifiable)
- {
- $order = self::$order;
- $user = self::$user;
- $app = app('wechat.mini_program');
- $page = 'pages/my_riding/my_riding?order='.$order->no.'&index='.$order->order_type;
- $data = [
- 'template_id' => config('wechat.mini_program.message_template.to_be_paid'),
- 'touser' => $user->auth->credential,
- 'page' => $page,
- 'data' => [
- 'date1' => [
-
- 'value' => $order->start_use_bike_time,
- ],
- 'thing2' => [
-
- 'value' => floor($order->use_bike_time_length / 60) . 'h' . ($order->use_bike_time_length % 60) . 'm',
- ],
- 'amount3' => [
-
- 'value' => $order->pay_money,
- ],
- 'thing4' => [
-
- 'value' => '点击卡片查看明细',
- ],
- ],
- ];
- $app->subscribe_message->send($data);
- }
- }
|