From dd9a07f7ba17cae2a0ad6936958beda4f27191e4 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 1 Dec 2025 18:03:42 +0800 Subject: [PATCH] no message --- app/Services/Article/CacheTg.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Services/Article/CacheTg.php b/app/Services/Article/CacheTg.php index 833382c5..156f20ee 100644 --- a/app/Services/Article/CacheTg.php +++ b/app/Services/Article/CacheTg.php @@ -145,6 +145,12 @@ final class CacheTg $sBotToken = ModelTelegramKey::botTokenByCode($sGroupCode); + $sPathUpload = $_ENV["dir_base"]."public/upload/"; + + if (!is_dir($sPathUpload)) { + mkdir($sPathUpload, 0777, true); + } + foreach ($aCacheImgId as $k => $aImgIdRow) { // 第一步:获取 file_path $getFileUrl = "https://api.telegram.org/bot".$sBotToken."/getFile?file_id=".$aImgIdRow; @@ -168,18 +174,16 @@ final class CacheTg } // 第三步:保存到服务器 - $savePath = 'upload/'; - if (!is_dir($savePath)) { - mkdir($savePath, 0777, true); - } +// $savePath = 'upload/'; +// if (!is_dir($savePath)) { +// mkdir($savePath, 0777, true); +// } $fileName = basename($filePath); $fileName = uniqid('ffq_tg-'.$k.'-'.time().'-').$fileName; // 加前缀并提高熵值 - file_put_contents($savePath . $fileName, $imageData); - - $sSavePath = $_ENV["APP_URL"].'/'.$savePath.$fileName; + file_put_contents($sPathUpload . $fileName, $imageData); - $aDataTmp["content"]["img"][$k] = $sSavePath; + $aDataTmp["content"]["img"][$k] = $_ENV["APP_URL"].'/upload/'.$fileName;; }