Browse Source

fix 新版检查优化

magicblack 9 months ago
parent
commit
49c07d932a

+ 1 - 1
static/css/install.css

@@ -1,7 +1,7 @@
 body{text-align:center;}
 .header{position:fixed;left:0;top:0;width:80%;height:60px;line-height:60px;background:#000;padding:0 10%;z-index:10000;}
 .header h1{color:#fff;font-size:20px;font-weight:600;text-align:center;}
-.install-box{margin:100px auto 0;background:#fff;border-radius:10px;padding:20px;overflow:hidden;box-shadow: 5px 5px 15px #888888;display:inline-block;width:680px;min-height:500px;}
+.install-box{margin:100px auto 0;background:#fff;border-radius:10px;padding:20px;box-shadow: 5px 5px 15px #888888;display:inline-block;width:680px;min-height:500px;}
 .protocol{text-align:left;height:400px;overflow-y:auto;padding:10px;color:#333;}
 .protocol h2{text-align:center;font-size:16px;color:#000;}
 .step-btns{padding:20px 0 10px 0;}

+ 3 - 1
thinkphp/library/think/Controller.php

@@ -118,7 +118,9 @@ class Controller
      */
     protected function fetch($template = '', $vars = [], $replace = [], $config = [])
     {
-        if($GLOBALS['config']['site']['new_version'] == 1){
+        // 如果是新版本
+        if($GLOBALS['config']['site']['new_version'] == 1 || !isset($GLOBALS['config']['site']['new_version']) || empty($GLOBALS['config']['site']['new_version'])){
+            // 如果模板路径以admin@开头
             if (strpos($template, 'admin@') === 0) {
                 $parts = explode('@', $template);
                 $result = $parts[1];

+ 5 - 4
thinkphp/library/think/View.php

@@ -39,12 +39,13 @@ class View
         $base    = $request->root();
         $root    = strpos($base, '.') ? ltrim(dirname($base), DS) : $base;
         if ('' != $root) {
-            $root = '/' . ltrim($root, '/');
+            $root = '/' . ltrim($root, '/'); 
         }
-        if($GLOBALS['config']['site']['new_version'] == 1){
-            $static_path = '/static_new/';
+        // 如果 new_version 为 1 或者 new_version 不存在或者为null,则使用新版模板
+        if($GLOBALS['config']['site']['new_version'] == 1 || !isset($GLOBALS['config']['site']['new_version']) || empty($GLOBALS['config']['site']['new_version'])){
+            $root . $static_path = '/static_new/';
         }else{
-            $static_path = '/static/';
+            $root . $static_path = '/static/';
         }
         $baseReplace = [
             '__ROOT__'   => $root,