正在显示
1 个修改的文件
包含
8 行增加
和
33 行删除
| @@ -141,33 +141,6 @@ public function uploadAmpVerifyFile(Request $request): string | @@ -141,33 +141,6 @@ public function uploadAmpVerifyFile(Request $request): string | ||
| 141 | return $this->success(); | 141 | return $this->success(); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | - /** | ||
| 145 | - * 压缩文件夹 | ||
| 146 | - */ | ||
| 147 | - public function createZipFile(){ | ||
| 148 | - $folderPath = public_path("target"); | ||
| 149 | - $zipFilePath = public_path().'/target.zip'; | ||
| 150 | - $zip = new ZipArchive(); | ||
| 151 | - if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { | ||
| 152 | - // 递归添加文件夹下的所有文件和子文件夹 | ||
| 153 | - $files = new RecursiveIteratorIterator( | ||
| 154 | - new RecursiveDirectoryIterator($folderPath), | ||
| 155 | - RecursiveIteratorIterator::LEAVES_ONLY | ||
| 156 | - ); | ||
| 157 | - foreach ($files as $name => $file) { | ||
| 158 | - if (!$file->isDir()) { | ||
| 159 | - $filePath = $file->getRealPath(); | ||
| 160 | - $relativePath = substr($filePath, strlen($folderPath) + 1); | ||
| 161 | - $zip->addFile($filePath, $relativePath); | ||
| 162 | - } | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - $zip->close(); | ||
| 166 | - echo '文件夹压缩成功'; | ||
| 167 | - } else { | ||
| 168 | - echo '无法打开或创建压缩文件'; | ||
| 169 | - } | ||
| 170 | - } | ||
| 171 | 144 | ||
| 172 | /** | 145 | /** |
| 173 | * 获取需要下载的文件url | 146 | * 获取需要下载的文件url |
| @@ -181,6 +154,8 @@ public function websiteHtml(Request $request){ | @@ -181,6 +154,8 @@ public function websiteHtml(Request $request){ | ||
| 181 | $token = env("WEB_SITE_TOKEN"); | 154 | $token = env("WEB_SITE_TOKEN"); |
| 182 | $apiUrl = env("API_URL"); | 155 | $apiUrl = env("API_URL"); |
| 183 | $requestUrl = $apiUrl."?domain=".$domain."&token=".$token; | 156 | $requestUrl = $apiUrl."?domain=".$domain."&token=".$token; |
| 157 | + @file_put_contents(storage_path('logs/notify_get_url.log'), date('Y-m-d H:i:s') . "接收到通知:". $requestUrl . PHP_EOL, FILE_APPEND); | ||
| 158 | + | ||
| 184 | 159 | ||
| 185 | try { | 160 | try { |
| 186 | $res = $this->curlGet($requestUrl); | 161 | $res = $this->curlGet($requestUrl); |
| @@ -192,16 +167,16 @@ public function websiteHtml(Request $request){ | @@ -192,16 +167,16 @@ public function websiteHtml(Request $request){ | ||
| 192 | } catch (\Exception $e) { | 167 | } catch (\Exception $e) { |
| 193 | return $this->error($e->getMessage()); | 168 | return $this->error($e->getMessage()); |
| 194 | } | 169 | } |
| 195 | - return $this->websiteHtmlHandle($url); | 170 | + return $this->websiteHtmlHandle($url,$domain); |
| 196 | } | 171 | } |
| 197 | 172 | ||
| 198 | - /** | 173 | +/** |
| 199 | * 网站html解压 | 174 | * 网站html解压 |
| 200 | * @param $url | 175 | * @param $url |
| 201 | * @return string | 176 | * @return string |
| 202 | */ | 177 | */ |
| 203 | - public function websiteHtmlHandle($url) | ||
| 204 | - { | 178 | +public function websiteHtmlHandle($url,$domain) |
| 179 | +{ | ||
| 205 | $pathInfo = pathinfo($url); | 180 | $pathInfo = pathinfo($url); |
| 206 | $extension = $pathInfo['extension']; | 181 | $extension = $pathInfo['extension']; |
| 207 | //只允许解压zip格式文件 | 182 | //只允许解压zip格式文件 |
| @@ -210,7 +185,7 @@ public function websiteHtmlHandle($url) | @@ -210,7 +185,7 @@ public function websiteHtmlHandle($url) | ||
| 210 | $targetFile = $this->downLoadFile($url); | 185 | $targetFile = $this->downLoadFile($url); |
| 211 | $zip = new ZipArchive(); | 186 | $zip = new ZipArchive(); |
| 212 | if ($zip->open($targetFile) === TRUE) { | 187 | if ($zip->open($targetFile) === TRUE) { |
| 213 | - $outputFolder = public_path(); | 188 | + $outputFolder = public_path($domain); |
| 214 | if (!is_dir($outputFolder)) { | 189 | if (!is_dir($outputFolder)) { |
| 215 | mkdir($outputFolder, 0777, true); | 190 | mkdir($outputFolder, 0777, true); |
| 216 | } | 191 | } |
| @@ -229,7 +204,7 @@ public function websiteHtmlHandle($url) | @@ -229,7 +204,7 @@ public function websiteHtmlHandle($url) | ||
| 229 | return $this->error('不允许解压改格式压缩包!'); | 204 | return $this->error('不允许解压改格式压缩包!'); |
| 230 | } | 205 | } |
| 231 | return $this->success(); | 206 | return $this->success(); |
| 232 | - } | 207 | +} |
| 233 | 208 | ||
| 234 | /** | 209 | /** |
| 235 | * 下载文件(下载到public目录下) | 210 | * 下载文件(下载到public目录下) |
-
请 注册 或 登录 后发表评论