telegram: order notify

This commit is contained in:
Tokumeikoi
2020-07-31 15:22:27 +08:00
parent eb53067e67
commit 6e7fb4284a
3 changed files with 27 additions and 14 deletions

View File

@ -1,6 +1,7 @@
<?php
namespace App\Services;
use App\Jobs\SendTelegramJob;
use \Curl\Curl;
class TelegramService {
@ -43,4 +44,15 @@ class TelegramService {
}
return $response;
}
public function sendMessageWithAdmin($message)
{
if (!config('v2board.telegram_bot_enable', 0)) return;
$users = User::where('is_admin', 1)
->where('telegram_id', '!=', NULL)
->get();
foreach ($users as $user) {
SendTelegramJob::dispatch($user->telegram_id, $message);
}
}
}