order = $order; $this->sign = (new Hashids(config('app.key'), 8))->encode($order->payment->id); } public function via($notifiable) { return sysConfig('payment_confirm_notification'); } public function toTelegram($notifiable) { $order = $this->order; $goods = $this->order->goods; $message = sprintf("πŸ›’ δΊΊε·₯ζ”―δ»˜\nβ€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”\n\t\tℹ️ 账号:%s\n\t\tπŸ’° ι‡‘ι’οΌš%1.2f\n\t\tπŸ“¦ ε•†ε“οΌš%s\n\t\t", $order->user->username, $order->amount, $goods->name ?? '余钝充值'); foreach (User::role('Super Admin')->get() as $admin) { if (! $admin->telegram_user_id) { continue; } return TelegramMessage::create() ->to($admin->telegram_user_id) ->token(sysConfig('telegram_token')) ->content($message) ->button(trans('common.status.reject'), route('payment.notify', ['method' => 'manual', 'sign' => $this->sign, 'status' => 0])) ->button(trans('common.confirm'), route('payment.notify', ['method' => 'manual', 'sign' => $this->sign, 'status' => 1])); } return false; } public function toCustom($notifiable): array { $order = $this->order; $goods = $this->order->goods; return [ 'title' => 'πŸ›’ δΊΊε·₯ζ”―δ»˜', 'body' => [ [ 'keyname' => 'ℹ️ 账号', 'value' => $order->user->username, ], [ 'keyname' => 'πŸ’° 金钝', 'value' => sprintf('%1.2f', $order->amount), ], [ 'keyname' => 'πŸ“¦ 商品', 'value' => $goods->name ?? '余钝充值', ], ], 'markdown' => '- ℹ️ 账号: '.$order->user->username.PHP_EOL.'- πŸ’° 金钝: '.sprintf('%1.2f', $order->amount).PHP_EOL.'- πŸ“¦ 商品: '.($goods->name ?? '余钝充值'), 'button' => [ route('payment.notify', ['method' => 'manual', 'sign' => $this->sign, 'status' => 0]), route('payment.notify', ['method' => 'manual', 'sign' => $this->sign, 'status' => 1]), ], ]; } }