no message

This commit is contained in:
hellcat 2025-12-01 18:03:42 +08:00
parent e020c8ff97
commit dd9a07f7ba

View File

@ -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;;
}