From 4a9153533bc5f4acb2253c82517e74e9a04efe66 Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 25 Nov 2023 17:01:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=BC=BA=E5=A4=B1=E7=9A=84js=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 2 ++ extend/base/common/command/admin/VersionBase.php | 5 ++--- extend/base/common/controller/AdminControllerBase.php | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.example.env b/.example.env index e28af9c..a14b899 100644 --- a/.example.env +++ b/.example.env @@ -55,4 +55,6 @@ STRICT_EVENT=true # 严格要求每个页面都建立js文件 STRICT_VIEW_JS=true +MAKE_VIEW_JS_WHILE_MISSING=false + UPDATE_LEVEL=production \ No newline at end of file diff --git a/extend/base/common/command/admin/VersionBase.php b/extend/base/common/command/admin/VersionBase.php index 9d794f2..8505012 100644 --- a/extend/base/common/command/admin/VersionBase.php +++ b/extend/base/common/command/admin/VersionBase.php @@ -12,13 +12,12 @@ use think\console\Output; class VersionBase extends Command { - public const VERSION = 'v2.0.71'; + public const VERSION = 'v2.0.72'; public const LAYUI_VERSION = '2.8.17'; public const COMMENT = [ - '清理技术债务update配置文件', - '优化sqlite的安装兼容性', + '增加自动创建缺失的js配置项;', '发布新版本', ]; diff --git a/extend/base/common/controller/AdminControllerBase.php b/extend/base/common/controller/AdminControllerBase.php index 2cbd82e..18edf07 100644 --- a/extend/base/common/controller/AdminControllerBase.php +++ b/extend/base/common/controller/AdminControllerBase.php @@ -6,6 +6,7 @@ use app\admin\model\SystemAdmin; use app\BaseController; use app\common\constants\AdminConstant; use app\common\service\AuthService; +use app\common\tools\PathTools; use think\facade\Env; use think\facade\View; use think\Model; @@ -158,7 +159,12 @@ class AdminControllerBase extends BaseController $content_js .= View::layout(false)->fetchJS($common_template); $content_js .= View::layout(false)->fetchJS($template); } catch (TemplateNotFoundException $th) { - if (Env::get('adminsystem.strict_view_js', true)) { + if (Env::get('adminsystem.make_view_js_while_missing', false)) { + $template_file_path = $th->getTemplate(); + PathTools::intiDir($template_file_path); + file_put_contents($template_file_path, ''); + $content_js = ''; + } elseif (Env::get('adminsystem.strict_view_js', true)) { throw $th; } }