refactor: 重构规范部分代码、邮件队列增加失败重试、去除多个支付方式、更新依赖

This commit is contained in:
xboard
2024-04-10 00:51:03 +08:00
parent ec63e05575
commit 4c6c7182e2
50 changed files with 421 additions and 1005 deletions
@@ -13,24 +13,23 @@ class TelegramController extends Controller
protected $commands = [];
protected $telegramService;
public function __construct(Request $request)
public function __construct(TelegramService $telegramService)
{
if ($request->input('access_token') !== md5(admin_setting('telegram_bot_token'))) {
throw new ApiException('access_token is error', 401);
}
$this->telegramService = new TelegramService();
$this->telegramService = $telegramService;
}
public function webhook(Request $request)
{
if ($request->input('access_token') !== md5(admin_setting('telegram_bot_token'))) {
throw new ApiException('access_token is error', 401);
}
$data = json_decode(get_request_content(),true);
$this->formatMessage($data);
$this->formatChatJoinRequest($data);
$this->handle();
}
public function handle()
private function handle()
{
if (!$this->msg) return;
$msg = $this->msg;
@@ -68,7 +67,7 @@ class TelegramController extends Controller
}
}
public function getBotName()
private function getBotName()
{
$response = $this->telegramService->getMe();
return $response->result->username;