自动更新版本号
This commit is contained in:
parent
dd06cec1a1
commit
279159d94a
|
@ -143,7 +143,16 @@ class Index extends Controller
|
||||||
$this->assign('menus', json_encode($menus));
|
$this->assign('menus', json_encode($menus));
|
||||||
$this->assign('dashbord', count($menus) ? $menus[0] : ['url' => url('welcome'), 'name' => '首页']);
|
$this->assign('dashbord', count($menus) ? $menus[0] : ['url' => url('welcome'), 'name' => '首页']);
|
||||||
|
|
||||||
return $this->fetch(Module::getInstance()->getIndexView());
|
$config = Module::getInstance()->getConfig();
|
||||||
|
$template = 'index';
|
||||||
|
if (!empty($config['index_page_style']) && $config['index_page_style'] != 1) { //下拉选择的其他模板
|
||||||
|
$template = $config['index_page_style'];
|
||||||
|
if (!is_file($template)) { //其他模板不存在,回到默认
|
||||||
|
$template = 'index2';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->fetch($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function denied()
|
public function denied()
|
||||||
|
@ -539,15 +548,18 @@ class Index extends Controller
|
||||||
$rootPath = app()->getRootPath();
|
$rootPath = app()->getRootPath();
|
||||||
|
|
||||||
$template = '';
|
$template = '';
|
||||||
if (!empty($config['login_page_view_path']) && file_exists($rootPath . $config['login_page_view_path'])) {
|
if (!empty($config['login_page_view_path']) && file_exists($rootPath . $config['login_page_view_path'])) { //直接填写的模板路径
|
||||||
$template = $rootPath . $config['login_page_view_path'];
|
$template = $rootPath . $config['login_page_view_path'];
|
||||||
} else {
|
} else { //下拉选择模板路径
|
||||||
$template = 'login1';
|
$template = 'login1';
|
||||||
if (!empty($config['login_page_style'])) {
|
if (!empty($config['login_page_style'])) {
|
||||||
if (is_numeric($config['login_page_style'])) { // 1,2,3,4 默认样式
|
if (is_numeric($config['login_page_style'])) { // 1,2,3,4 默认样式
|
||||||
$template = 'login' . $config['login_page_style'];
|
$template = 'login' . $config['login_page_style'];
|
||||||
} else { //其他
|
} else { //其他
|
||||||
$template = $config['login_page_style'];
|
$template = $config['login_page_style'];
|
||||||
|
if (!is_file($template)) { //其他模板不存在,回到默认3
|
||||||
|
$template = 'login3';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yunwuxin <448901948@qq.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
function checkUrl($url)
|
if (!function_exists('checkUrl')) {
|
||||||
{
|
function checkUrl($url)
|
||||||
return \tpext\myadmin\admin\model\AdminUser::checkUrl($url);
|
{
|
||||||
}
|
return \tpext\myadmin\admin\model\AdminUser::checkUrl($url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,9 +25,8 @@ class Module extends baseModule
|
||||||
|
|
||||||
protected static $tpextmyadminInstalled = false;
|
protected static $tpextmyadminInstalled = false;
|
||||||
|
|
||||||
protected $indexView = '';
|
|
||||||
|
|
||||||
protected $loginViews = ['1' => '风格1', '2' => '风格2', '3' => '风格3', '4' => '风格4'];
|
protected $loginViews = ['1' => '风格1', '2' => '风格2', '3' => '风格3', '4' => '风格4'];
|
||||||
|
protected $indexViews = ['1' => '默认lightYearAdmin'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
|
@ -121,29 +120,30 @@ class Module extends baseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* 添加index框架模板到列表
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path 模板路径
|
||||||
|
* @param string $title 模板名称
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setIndexView($path)
|
public function addIndexView($path, $title)
|
||||||
{
|
{
|
||||||
$this->indexView = $path;
|
$this->indexViews[$path] = $title;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* 获取index框架模板到列表
|
||||||
*
|
*
|
||||||
* @return string
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getIndexView()
|
public function getIndexViews()
|
||||||
{
|
{
|
||||||
return $this->indexView;
|
return $this->indexViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* 添加登录模板到列表
|
||||||
*
|
*
|
||||||
* @param string $path 模板路径
|
* @param string $path 模板路径
|
||||||
* @param string $title 模板名称
|
* @param string $title 模板名称
|
||||||
|
@ -156,7 +156,7 @@ class Module extends baseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* 获取登录框架模板到列表
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tpext\myadmin\common\behavior;
|
||||||
|
|
||||||
|
use tpext\common\model\WebConfig;
|
||||||
|
use tpext\common\Tool;
|
||||||
|
use tpext\myadmin\common\Module;
|
||||||
|
|
||||||
|
class Assets
|
||||||
|
{
|
||||||
|
public function run($data = [])
|
||||||
|
{
|
||||||
|
$key = Module::getInstance()->getId();
|
||||||
|
$config = Module::getInstance()->getConfig();
|
||||||
|
$config['assets_ver'] = date('Y-m-d-H:i:s');
|
||||||
|
WebConfig::where('key', $key)->update(['config' => json_encode($config, JSON_UNESCAPED_UNICODE)]);
|
||||||
|
WebConfig::clearCache($key);
|
||||||
|
|
||||||
|
if ($config['minify']) {
|
||||||
|
$dirs = ['', 'assets', 'minify', ''];
|
||||||
|
$scriptName = $_SERVER['SCRIPT_FILENAME'];
|
||||||
|
$minifyDir = realpath(dirname($scriptName)) . implode(DIRECTORY_SEPARATOR, $dirs);
|
||||||
|
Tool::deleteDir($minifyDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace tpext\myadmin\common\behavior;
|
namespace tpext\myadmin\common\behavior;
|
||||||
|
|
||||||
use tpext\builder\common\Builder;
|
use tpext\builder\common\Builder;
|
||||||
|
@ -16,6 +17,7 @@ class Setup
|
||||||
if (strtolower($module) == 'admin') { //admin模块, 替换错误和跳转模板 ,其他事件监听
|
if (strtolower($module) == 'admin') { //admin模块, 替换错误和跳转模板 ,其他事件监听
|
||||||
|
|
||||||
ExtLoader::watch('tpext_menus', Menu::class, false, '接收菜单创建/删除事件');
|
ExtLoader::watch('tpext_menus', Menu::class, false, '接收菜单创建/删除事件');
|
||||||
|
ExtLoader::watch('tpext_copy_assets', Assets::class, false, '监视资源刷新,修改版本号');
|
||||||
ExtLoader::watch('app_end', Log::class, false, '记录日志');
|
ExtLoader::watch('app_end', Log::class, false, '记录日志');
|
||||||
|
|
||||||
$instance = Module::getInstance();
|
$instance = Module::getInstance();
|
||||||
|
|
|
@ -25,6 +25,7 @@ return [
|
||||||
'admin_group_title' => '分组',
|
'admin_group_title' => '分组',
|
||||||
'admin_group_model' => '',
|
'admin_group_model' => '',
|
||||||
'operation_log_catch' => ['POST', 'PUT', 'PATCH', 'DELETE'],
|
'operation_log_catch' => ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||||
|
'index_page_style' => '',
|
||||||
'login_page_style' => '1',
|
'login_page_style' => '1',
|
||||||
'login_page_view_path' => '',
|
'login_page_view_path' => '',
|
||||||
//配置描述
|
//配置描述
|
||||||
|
@ -45,6 +46,7 @@ return [
|
||||||
'admin_group_title' => ['type' => 'text', 'label' => '管理员分组名称', 'help' => '如:`部门,分店`', 'col_size' => 6, 'size' => [4, 8]],
|
'admin_group_title' => ['type' => 'text', 'label' => '管理员分组名称', 'help' => '如:`部门,分店`', 'col_size' => 6, 'size' => [4, 8]],
|
||||||
'admin_group_model' => ['type' => 'text', 'label' => '管理员分组模型', 'help' => '如:`\tpext\myadmin\admin\model\AdminGroup`,你可以自己实现分组。树形结构需要配合\tpext\builder\traits\TreeModel', 'col_size' => 6, 'size' => [4, 8]],
|
'admin_group_model' => ['type' => 'text', 'label' => '管理员分组模型', 'help' => '如:`\tpext\myadmin\admin\model\AdminGroup`,你可以自己实现分组。树形结构需要配合\tpext\builder\traits\TreeModel', 'col_size' => 6, 'size' => [4, 8]],
|
||||||
'operation_log_catch' => ['type' => 'checkbox', 'label' => '操作日志记录类型', 'col_size' => 6, 'size' => [4, 8], 'options' => ['GET' => 'GET', 'POST' => 'POST', 'PUT' => 'PUT', 'PATCH' => 'PATCH', 'DELETE' => 'DELETE']],
|
'operation_log_catch' => ['type' => 'checkbox', 'label' => '操作日志记录类型', 'col_size' => 6, 'size' => [4, 8], 'options' => ['GET' => 'GET', 'POST' => 'POST', 'PUT' => 'PUT', 'PATCH' => 'PATCH', 'DELETE' => 'DELETE']],
|
||||||
|
'index_page_style' => ['type' => 'select', 'label' => 'index主体页面风格', 'col_size' => 6, 'size' => [4, 8], 'options' => Module::getInstance()->getIndexViews()],
|
||||||
'login_page_style' => ['type' => 'select', 'label' => '登录页面风格', 'col_size' => 6, 'size' => [4, 8], 'options' => Module::getInstance()->getLoginViews()],
|
'login_page_style' => ['type' => 'select', 'label' => '登录页面风格', 'col_size' => 6, 'size' => [4, 8], 'options' => Module::getInstance()->getLoginViews()],
|
||||||
'login_page_view_path' => ['type' => 'text', 'label' => '自定义登录页面', 'col_size' => 6, 'size' => [4, 8],'help' => '设置后不再使用以上4种风格。自定登录模板路径,如`application/admin/view/login.html`。仍然发送`post`请求到`/admin/index/login`'],
|
'login_page_view_path' => ['type' => 'text', 'label' => '自定义登录页面', 'col_size' => 6, 'size' => [4, 8],'help' => '设置后不再使用以上4种风格。自定登录模板路径,如`application/admin/view/login.html`。仍然发送`post`请求到`/admin/index/login`'],
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue