order = $order; } public function toWechat($notifiable) { $app = app('wechat.official_account'); if ($notifiable->openid && $this->order->item_type == 'GIFT') { $type_text = ''; $url = route('orders.show', $this->order->orderid); switch ($this->order->type) { case 'lottery': $type_text = '奖品'; $url = route('lottery.logs'); break; case 'lesson': $type_text = '赠品'; $url = route('gifts.index'); break; default: $type_text = ($this->order->payment) ? $this->order->payment->type_text : ''; break; } if (in_array($this->order->type, ['lottery', 'lesson'])) { $str = '您获得一份礼品,请设置收货地址,我们将尽快为您安排发货' . "\r\n\r\n"; } else { $str = '您的订单已经支付成功,我们将尽快为您安排发货!!' . "\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 .= '支付途径:' . $type_text . "\r\n\r\n"; $str .= "点击查看详情"; $app->customer_service->message($str)->to($notifiable->openid)->send(); } } public function toArray($notifiable) { return [ // ]; } }