From 74f695df34074d70adc5069bbec8b698f40d341c Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 20 Jul 2024 08:54:58 +0800 Subject: [PATCH] cache dir snap improve for old versions --- themes/beauty/controller/SiteController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index 069fc63..fda45ea 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -172,6 +172,7 @@ Class SiteController extends Controller { $msg = 'OK'; $url = ''; $img_id = ''; + $size = 'orignal'; $cacheId = $this->post('cid', ''); $cateId = $this->post('id', ''); @@ -192,6 +193,11 @@ Class SiteController extends Controller { } } + //弃用老版本数据格式,抛弃没有size属性的 + if (!empty($cachedData) && empty($cachedData['size'])) { + $cachedData = null; + } + if (empty($cachedData)) { //从缓存数据中获取目录的realpath $cachedData = Common::getCacheFromFile($cacheId); @@ -219,7 +225,8 @@ Class SiteController extends Controller { if (!empty($cachedData)) { $url = $cachedData['snapshot']; $cacheSubDir = 'dir'; - Common::saveCacheToFile($cacheKey, compact('url', 'img_id'), $cacheSubDir); + $size = 'vm'; + Common::saveCacheToFile($cacheKey, compact('url', 'img_id', 'size'), $cacheSubDir); } } }else {