增加自动创建缺失的js配置项;

This commit is contained in:
2023-11-25 17:01:14 +08:00
parent 51c8490006
commit 4a9153533b
3 changed files with 11 additions and 4 deletions

View File

@@ -55,4 +55,6 @@ STRICT_EVENT=true
# 严格要求每个页面都建立js文件 # 严格要求每个页面都建立js文件
STRICT_VIEW_JS=true STRICT_VIEW_JS=true
MAKE_VIEW_JS_WHILE_MISSING=false
UPDATE_LEVEL=production UPDATE_LEVEL=production

View File

@@ -12,13 +12,12 @@ use think\console\Output;
class VersionBase extends Command 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 LAYUI_VERSION = '2.8.17';
public const COMMENT = [ public const COMMENT = [
'清理技术债务update配置文件', '增加自动创建缺失的js配置项',
'优化sqlite的安装兼容性',
'发布新版本', '发布新版本',
]; ];

View File

@@ -6,6 +6,7 @@ use app\admin\model\SystemAdmin;
use app\BaseController; use app\BaseController;
use app\common\constants\AdminConstant; use app\common\constants\AdminConstant;
use app\common\service\AuthService; use app\common\service\AuthService;
use app\common\tools\PathTools;
use think\facade\Env; use think\facade\Env;
use think\facade\View; use think\facade\View;
use think\Model; 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($common_template);
$content_js .= View::layout(false)->fetchJS($template); $content_js .= View::layout(false)->fetchJS($template);
} catch (TemplateNotFoundException $th) { } 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; throw $th;
} }
} }