Ver Fonte

feat:loadDistData

igb há 4 meses atrás
pai
commit
d41fd29ffc
1 ficheiros alterados com 15 adições e 14 exclusões
  1. 15 14
      app/Http/Middleware/LoadDistData.php

+ 15 - 14
app/Http/Middleware/LoadDistData.php

@@ -35,23 +35,24 @@ class LoadDistData
         }
 
         // 检查模板是否需要更新
-        if (
-            !$dist?->publishList?->template_local_code ||
-            !empty($dist?->publishList?->template_update_code) ||
-            $dist?->publishList?->template_update_code !== $dist?->publishList?->template_local_code
-        ) {
+        if(!empty($dist?->publishList?->template_update_code)) {
+            if (
+                !$dist?->publishList?->template_local_code ||
+                $dist?->publishList?->template_update_code !== $dist?->publishList?->template_local_code
+            ) {
 
-            // dd('update template');
-            // 更新模板
-            TemplateUpdater::updateTemplates($dist);
+                // dd('update template');
+                // 更新模板
+                TemplateUpdater::updateTemplates($dist);
 
-            // 清除缓存并重新获取
-            SiteCache::clearDistCache($domain);
-            $dist = SiteCache::getDist($domain);
-            $dist = $dist ? unserialize($dist) : null;
+                // 清除缓存并重新获取
+                SiteCache::clearDistCache($domain);
+                $dist = SiteCache::getDist($domain);
+                $dist = $dist ? unserialize($dist) : null;
 
-            if (!$dist) {
-                abort(404, 'site not found.');
+                if (!$dist) {
+                    abort(404, 'site not found.');
+                }
             }
         }