From 8bc0f7534b15847559b9d9a2bc09a6186fdd64c9 Mon Sep 17 00:00:00 2001 From: tensent Date: Tue, 18 Feb 2020 14:50:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 ++-- app/controller/admin/Addons.php | 40 +++-------- app/controller/admin/Category.php | 8 +-- app/controller/admin/Channel.php | 19 ++---- app/controller/admin/Client.php | 50 +++++++------- app/controller/admin/Config.php | 13 ++-- app/controller/admin/Database.php | 98 ++++++++++++++------------- app/controller/admin/Index.php | 13 ++-- app/controller/admin/Link.php | 13 ++-- app/controller/admin/Model.php | 20 ++---- app/model/Addons.php | 17 +++++ app/model/Attribute.php | 66 +++++++++--------- app/model/Channel.php | 2 +- app/model/Client.php | 2 +- app/model/Config.php | 7 ++ app/model/Hooks.php | 17 +++++ app/model/Link.php | 3 +- app/model/{Module.php => Model.php} | 100 ++++++++++++++-------------- view/admin/action/index.html | 2 +- view/admin/action/log.html | 2 +- view/admin/ad/index.html | 2 +- view/admin/addons/hooks.html | 2 +- view/admin/addons/index.html | 2 +- view/admin/attribute/index.html | 2 +- view/admin/client/index.html | 2 +- view/admin/content/index.html | 2 +- view/admin/form/attr.html | 2 +- view/admin/form/index.html | 2 +- view/admin/form/list_alumn.html | 2 +- view/admin/group/access.html | 2 +- view/admin/group/index.html | 2 +- view/admin/link/index.html | 14 ++-- view/admin/model/index.html | 2 +- view/admin/public/base.html | 16 ++--- view/admin/seo/index.html | 2 +- view/admin/user/index.html | 2 +- 36 files changed, 283 insertions(+), 280 deletions(-) create mode 100644 app/model/Addons.php create mode 100644 app/model/Hooks.php rename app/model/{Module.php => Model.php} (52%) diff --git a/README.md b/README.md index b8835f7f..240f2a4c 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## SentCMS介绍 -> SentCMS网站管理系统是南昌腾速科技有限公司倾力打造的一款简单易用的网站管理系统,SentCMS网站管理系统(下文简称SentCMS)继承了thinkphp5.0的优秀品质,秉承“大道至简”的设计理念。SnetCMS为网站建设而生,为网站建设减少90%的代码编写,只需前端设计师就可以设计出完美的网站,而如此完美的系统还是完全开源的。 +> SentCMS网站管理系统是南昌腾速科技有限公司倾力打造的一款简单易用的网站管理系统,SentCMS网站管理系统(下文简称SentCMS)继承了thinkphp的优秀品质,秉承“大道至简”的设计理念。SnetCMS为网站建设而生,为网站建设减少90%的代码编写,只需前端设计师就可以设计出完美的网站,而如此完美的系统还是完全开源的。 ## 环境要求 @@ -12,12 +12,11 @@ > 最好是使用云主机进行安装,虚拟主机有很多局限性 - ``` git clone -b 4.0 https://gitee.com/sentcms/sentcms.git sentcms cd sentcms ``` - +如果是直接下载压缩包则直接进入解压文件夹,然后执行下面的代码 把根目录下的.example.env文件复制一份并命名为.env ``` @@ -47,7 +46,7 @@ composer install * 简单易用的标签体系 * 便捷的文档系统,无需程序即可设计出完美的模型,做出完美的网站,传送门:http://www.kancloud.cn/tensent/sentcms3/169624 -下载最新版框架后,解压缩到web目录下面,可以看到初始的目录结构如下: +下载最新版框架后,解压缩到sentcms目录下面,可以看到初始的目录结构如下: ## 目录结构 ~~~ ├─addons 扩展插件目录 @@ -88,4 +87,8 @@ composer install > 3.0.1611:https://git.oschina.net/sentcms/sentcms/repository/archive/3.0.1611 -> 3.0.1609:https://git.oschina.net/sentcms/sentcms/repository/archive/3.0.1609 \ No newline at end of file +> 3.0.1609:https://git.oschina.net/sentcms/sentcms/repository/archive/3.0.1609 + +> 4.0 正在路上 + +> …… \ No newline at end of file diff --git a/app/controller/admin/Addons.php b/app/controller/admin/Addons.php index 7ac6076a..49cbc06a 100644 --- a/app/controller/admin/Addons.php +++ b/app/controller/admin/Addons.php @@ -6,9 +6,11 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - namespace app\controller\admin; + use app\controller\Admin; +use app\model\Addons as AddonsM; +use app\model\Hooks; /** * @title 插件管理 @@ -16,34 +18,19 @@ use app\controller\Admin; */ class Addons extends Admin { - protected $addons; - - public function _initialize() { - parent::_initialize(); - //加入菜单 - $this->getAddonsMenu(); - $this->addons = model('Addons'); - $this->hooks = db('Hooks'); - } /** * @title 插件列表 */ - public function index($refresh = 0) { + public function index(AddonsM $addons, $refresh = 0) { if ($refresh) { - $this->addons->refresh(); + $addons->refresh(); } - $list = $this->addons->order('id desc')->paginate(25, false, array( - 'query' => $this->request->param(), - )); - // 记录当前列表页的cookie - Cookie('__forward__', $_SERVER['REQUEST_URI']); + $list = $addons->order('id desc')->paginate($this->request->pageConfig); - $data = array( + $this->data = array( 'list' => $list, 'page' => $list->render(), ); - $this->setMeta("插件管理"); - $this->assign($data); return $this->fetch(); } @@ -218,22 +205,15 @@ class Addons extends Admin { * @title 钩子列表 */ public function hooks() { - - $map = array(); + $map = []; $order = "id desc"; - $list = model('Hooks')->where($map)->order($order)->paginate(10, false, array( - 'query' => $this->request->param(), - )); - // 记录当前列表页的cookie - Cookie('__forward__', $_SERVER['REQUEST_URI']); + $list = Hooks::where($map)->order($order)->paginate($this->request->pageConfig); - $data = array( + $this->data = array( 'list' => $list, 'page' => $list->render(), ); - $this->setMeta("钩子管理"); - $this->assign($data); return $this->fetch(); } diff --git a/app/controller/admin/Category.php b/app/controller/admin/Category.php index 40ed09d9..3cdf99c7 100644 --- a/app/controller/admin/Category.php +++ b/app/controller/admin/Category.php @@ -11,7 +11,7 @@ namespace app\controller\admin; use app\model\Category as CategoryM; use app\model\Attribute; -use app\model\Module; +use app\model\Model; use app\controller\Admin; /** @@ -28,7 +28,7 @@ class Category extends Admin { /** * @title 栏目列表 */ - public function index(CategoryM $category, Attribute $attr, Module $medule) { + public function index(CategoryM $category, Attribute $attr, Model $model) { $param = $this->request->param(); $map = []; @@ -42,8 +42,8 @@ class Category extends Admin { $tree = new \sent\tree\Tree(); $list = $tree->toFormatTree($list->toArray()); } - // $subsql = $attr->where('name', 'category_id')->fetchSql(true)->column('model_id'); - // $model_list = $medule->where('id IN ('. $subsql.')')->select(); + $subsql = $attr->where('name', 'category_id')->fetchSql(true)->column('model_id'); + $model_list = $model->where('id IN ('. $subsql.')')->select(); $this->data = [ 'tree' => $list, diff --git a/app/controller/admin/Channel.php b/app/controller/admin/Channel.php index 79e41d86..0438ed22 100644 --- a/app/controller/admin/Channel.php +++ b/app/controller/admin/Channel.php @@ -8,7 +8,10 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; + use app\controller\Admin; +use app\model\Channel as ChannelM; +use sent\tree\Tree; /** * @title 频道管理 @@ -16,35 +19,27 @@ use app\controller\Admin; */ class Channel extends Admin { - public function _initialize() { - parent::_initialize(); - } - /** * @title 频道列表 */ - public function index($type = 0) { + public function index(ChannelM $channel, $type = 0) { /* 获取频道列表 */ //$map = array('status' => array('gt', -1), 'pid'=>$pid); $map = array('status' => array('gt', -1)); if ($type) { $map['type'] = $type; } - $list = db('Channel')->where($map)->order('sort asc,id asc')->column('*', 'id'); + $list = $channel->where($map)->order('sort asc,id asc')->column('*', 'id'); if (!empty($list)) { - $tree = new \com\Tree(); + $tree = new Tree(); $list = $tree->toFormatTree($list); } - config('_sys_get_channel_tree_', true); - - $data = array( + $this->data = array( 'tree' => $list, 'type' => $type, ); - $this->assign($data); - $this->setMeta('导航管理'); return $this->fetch(); } diff --git a/app/controller/admin/Client.php b/app/controller/admin/Client.php index ba8fdf99..b93f329e 100644 --- a/app/controller/admin/Client.php +++ b/app/controller/admin/Client.php @@ -8,6 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; + +use app\model\Client as ClientM; use app\controller\Admin; /** @@ -15,71 +17,65 @@ use app\controller\Admin; */ class Client extends Admin { - public function _initialize() { - parent::_initialize(); - $this->model = model('Client'); - } - /** * @title 客户端列表 */ public function index() { - $list = $this->model->paginate(25, false, array( - 'query' => $this->request->param(), - )); - $data = array( + $map = []; + + $list = ClientM::where($map)->paginate($this->request->pageConfig); + + $this->data = array( 'list' => $list, 'page' => $list->render(), ); - $this->assign($data); - $this->setMeta('客户端列表'); return $this->fetch(); } /** * @title 添加客户端 */ - public function add(\think\Request $request) { + public function add() { if ($this->request->isPost()) { - $data = $request->param(); - $result = $this->model->validate(true)->save($data); + $data = $this->request->param(); + + $result = ClientM::create($data); if (false !== $result) { return $this->success('成功添加', url('client/index')); } else { - return $this->error($this->model->getError()); + return $this->error('添加失败!'); } } else { $info['appid'] = rand_string(10, 1); //八位数字appid $info['appsecret'] = rand_string(32); //32位数字加字母秘钥 - $data = array( + + $this->data = array( 'info' => $info, ); - $this->assign($data); - $this->setMeta('添加客户端'); - return $this->fetch('add'); + return $this->fetch(); } } /** * @title 编辑客户端 */ - public function edit(\think\Request $request) { + public function edit() { if ($this->request->isPost()) { - $data = $request->param(); - $result = $this->model->validate(true)->save($data, array('id' => $request->param('id'))); + $data = $this->request->param(); + + $result = ClientM::update($data, ['id' => $this->request->param('id')]); if (false !== $result) { return $this->success('修改添加', url('client/index')); } else { return $this->error($this->model->getError()); } } else { - $info = $this->model->where('id', $request->param('id'))->find(); - $data = array( + $info = $ClientM::where('id', $request->param('id'))->find(); + + $this->data = array( 'info' => $info, ); - $this->assign($data); - $this->setMeta('编辑客户端'); - return $this->fetch('add'); + return $this->fetch('admin/client/add'); } } diff --git a/app/controller/admin/Config.php b/app/controller/admin/Config.php index a818d90e..76264320 100644 --- a/app/controller/admin/Config.php +++ b/app/controller/admin/Config.php @@ -215,18 +215,17 @@ class Config extends Admin { /** * @title 主题选择 */ - public function themes() { - $list = $this->model->getThemesList(); - $pc = config('pc_themes'); - $mobile = config('mobile_themes'); - $data = array( + public function themes(ConfigM $config) { + $list = $config->getThemesList(); + $pc = config('system_config.pc_themes'); + $mobile = config('system_config.mobile_themes'); + + $this->data = array( 'pc' => $pc, 'mobile' => $mobile, 'list' => $list, ); - $this->assign($data); - $this->setMeta('主题设置'); return $this->fetch(); } diff --git a/app/controller/admin/Database.php b/app/controller/admin/Database.php index 6b6e0819..3bce5733 100644 --- a/app/controller/admin/Database.php +++ b/app/controller/admin/Database.php @@ -7,8 +7,9 @@ // | Author: molong // +---------------------------------------------------------------------- -namespace app\admin\controller; -use app\common\controller\Admin; +namespace app\controller\admin; + +use app\controller\Admin; /** * @title 数据库管理 @@ -20,54 +21,55 @@ class Database extends Admin { * @param String $type import-还原,export-备份 * @author 麦当苗儿 */ - public function index($type = null) { + public function index() { + $type = $this->request->get('type', 'import'); switch ($type) { - /* 数据还原 */ - case 'import': - //列出备份文件列表 - $path = config('data_backup_path'); - if (!is_dir($path)) { - mkdir($path, 0755, true); - } - $path = realpath($path); - $flag = \FilesystemIterator::KEY_AS_FILENAME; - $glob = new \FilesystemIterator($path, $flag); - - $list = array(); - foreach ($glob as $name => $file) { - if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) { - $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d'); - - $date = "{$name[0]}-{$name[1]}-{$name[2]}"; - $time = "{$name[3]}:{$name[4]}:{$name[5]}"; - $part = $name[6]; - - if (isset($list["{$date} {$time}"])) { - $info = $list["{$date} {$time}"]; - $info['part'] = max($info['part'], $part); - $info['size'] = $info['size'] + $file->getSize(); - } else { - $info['part'] = $part; - $info['size'] = $file->getSize(); - } - $extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION)); - $info['compress'] = ($extension === 'SQL') ? '-' : $extension; - $info['time'] = strtotime("{$date} {$time}"); - - $list["{$date} {$time}"] = $info; + /* 数据还原 */ + case 'import': + //列出备份文件列表 + $path = config('data_backup_path'); + if (!is_dir($path)) { + mkdir($path, 0755, true); } - } - $title = '数据还原'; - break; - /* 数据备份 */ - case 'export': - $Db = \think\Db::connect(); - $list = $Db->query('SHOW TABLE STATUS'); - $list = array_map('array_change_key_case', $list); - $title = '数据备份'; - break; - default: - return $this->error('参数错误!'); + $path = realpath($path); + $flag = \FilesystemIterator::KEY_AS_FILENAME; + $glob = new \FilesystemIterator($path, $flag); + + $list = array(); + foreach ($glob as $name => $file) { + if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) { + $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d'); + + $date = "{$name[0]}-{$name[1]}-{$name[2]}"; + $time = "{$name[3]}:{$name[4]}:{$name[5]}"; + $part = $name[6]; + + if (isset($list["{$date} {$time}"])) { + $info = $list["{$date} {$time}"]; + $info['part'] = max($info['part'], $part); + $info['size'] = $info['size'] + $file->getSize(); + } else { + $info['part'] = $part; + $info['size'] = $file->getSize(); + } + $extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION)); + $info['compress'] = ($extension === 'SQL') ? '-' : $extension; + $info['time'] = strtotime("{$date} {$time}"); + + $list["{$date} {$time}"] = $info; + } + } + $title = '数据还原'; + break; + /* 数据备份 */ + case 'export': + $Db = \think\Db::connect(); + $list = $Db->query('SHOW TABLE STATUS'); + $list = array_map('array_change_key_case', $list); + $title = '数据备份'; + break; + default: + return $this->error('参数错误!'); } //渲染模板 $this->setMeta($title); diff --git a/app/controller/admin/Index.php b/app/controller/admin/Index.php index 67094fe1..3d8466a2 100755 --- a/app/controller/admin/Index.php +++ b/app/controller/admin/Index.php @@ -58,10 +58,9 @@ class Index extends Admin { * @title 后台退出 * @return html */ - public function logout() { - $user = model('Member'); - $user->logout(); - $this->redirect('admin/index/login'); + public function logout(Member $user) { + Session::delete('userInfo'); + $this->redirect('/admin/login'); } /** @@ -87,12 +86,10 @@ class Index extends Admin { ), ), ); - $data = array( + $this->data = array( 'keyList' => $keylist, ); - $this->assign($data); - $this->setMeta("更新缓存"); - return $this->fetch('public/edit'); + return $this->fetch('admin/public/edit'); } } } \ No newline at end of file diff --git a/app/controller/admin/Link.php b/app/controller/admin/Link.php index 0557e5a4..fe77abbc 100644 --- a/app/controller/admin/Link.php +++ b/app/controller/admin/Link.php @@ -6,8 +6,9 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - namespace app\controller\admin; + +use app\model\Link as LinkM; use app\controller\Admin; /** @@ -19,20 +20,16 @@ class Link extends Admin { /** * @title 链接列表 */ - public function index() { + public function index(LinkM $link) { $map = array(); $order = "id desc"; - $list = db('Link')->where($map)->order($order)->paginate(10, false, array( - 'query' => $this->request->param(), - )); + $list = $link->where($map)->order($order)->paginate($this->request->pageConfig); - $data = array( + $this->data = array( 'list' => $list, 'page' => $list->render(), ); - $this->assign($data); - $this->setMeta("友情链接"); return $this->fetch(); } diff --git a/app/controller/admin/Model.php b/app/controller/admin/Model.php index f2003245..98c67f51 100644 --- a/app/controller/admin/Model.php +++ b/app/controller/admin/Model.php @@ -6,9 +6,10 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - namespace app\controller\admin; + use app\controller\Admin; +use app\model\Model as ModelM; /** * @title 模型管理 @@ -18,7 +19,6 @@ class Model extends Admin { public function _initialize() { parent::_initialize(); $this->getContentMenu(); - $this->model = model('Model'); } /** @@ -26,23 +26,17 @@ class Model extends Admin { * @author huajie */ public function index() { - $map = array('status' => array('gt', -1)); + $map = []; + + $map[] = ['status', '>', '-1']; $order = "id desc"; - $list = $this->model->where($map)->order($order)->paginate(10, false, array( - 'query' => $this->request->param(), - )); + $list = ModelM::where($map)->order($order)->paginate($this->request->pageConfig); - $data = array( + $this->data = array( 'list' => $list, 'page' => $list->render(), ); - - // 记录当前列表页的cookie - Cookie('__forward__', $_SERVER['REQUEST_URI']); - - $this->assign($data); - $this->setMeta('模型管理'); return $this->fetch(); } diff --git a/app/model/Addons.php b/app/model/Addons.php new file mode 100644 index 00000000..2f87670c --- /dev/null +++ b/app/model/Addons.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- + +namespace app\model; + +/** + * 分类模型 + */ +class Addons extends \think\Model { + +} \ No newline at end of file diff --git a/app/model/Attribute.php b/app/model/Attribute.php index 363b540a..fd1fb421 100644 --- a/app/model/Attribute.php +++ b/app/model/Attribute.php @@ -12,44 +12,44 @@ namespace app\model; /** * 设置模型 */ -class Attribute { +class Attribute extends \think\Model { protected $type = array( 'id' => 'integer', ); - protected static function init() { - self::afterInsert(function ($data) { - if ($data['model_id']) { - $name = db('Model')->where('id', $data['model_id'])->value('name'); - $db = new \com\Datatable(); - $attr = $data->toArray(); - $model_attr = array( - 'model_id' => $data['model_id'], - 'attr_id' => $data->id, - 'group_id' => 0, - 'is_add_table' => 1, - 'is_show' => $data['is_show'], - 'is_must' => $data['is_must'], - 'sort' => 0, - ); - $attr['after'] = db('Attribute')->where('name', '<>', $data['name'])->where('model_id', $data['model_id'])->order('id desc')->value('name'); - return $db->columField(strtolower($name), $attr)->query(); - } - }); - self::beforeUpdate(function ($data) { - $attr = $data->toArray(); - $attr['action'] = 'CHANGE'; - $attr['oldname'] = db('Attribute')->where('id', $attr['id'])->value('name'); - if ($attr['id']) { - $name = db('Model')->where('id', $attr['model_id'])->value('name'); - $db = new \com\Datatable(); - return $db->columField(strtolower($name), $attr)->query(); - } else { - return false; - } - }); - } + // protected static function init() { + // self::afterInsert(function ($data) { + // if ($data['model_id']) { + // $name = db('Model')->where('id', $data['model_id'])->value('name'); + // $db = new \com\Datatable(); + // $attr = $data->toArray(); + // $model_attr = array( + // 'model_id' => $data['model_id'], + // 'attr_id' => $data->id, + // 'group_id' => 0, + // 'is_add_table' => 1, + // 'is_show' => $data['is_show'], + // 'is_must' => $data['is_must'], + // 'sort' => 0, + // ); + // $attr['after'] = db('Attribute')->where('name', '<>', $data['name'])->where('model_id', $data['model_id'])->order('id desc')->value('name'); + // return $db->columField(strtolower($name), $attr)->query(); + // } + // }); + // self::beforeUpdate(function ($data) { + // $attr = $data->toArray(); + // $attr['action'] = 'CHANGE'; + // $attr['oldname'] = db('Attribute')->where('id', $attr['id'])->value('name'); + // if ($attr['id']) { + // $name = db('Model')->where('id', $attr['model_id'])->value('name'); + // $db = new \com\Datatable(); + // return $db->columField(strtolower($name), $attr)->query(); + // } else { + // return false; + // } + // }); + // } protected function getTypeTextAttr($value, $data) { $type = config('config_type_list'); diff --git a/app/model/Channel.php b/app/model/Channel.php index 83d45414..4fbce534 100644 --- a/app/model/Channel.php +++ b/app/model/Channel.php @@ -12,7 +12,7 @@ namespace app\model; /** * 设置模型 */ -class Channel { +class Channel extends \think\Model { protected $type = array( 'id' => 'integer', diff --git a/app/model/Client.php b/app/model/Client.php index 8cf9ca79..67501fbf 100644 --- a/app/model/Client.php +++ b/app/model/Client.php @@ -12,7 +12,7 @@ namespace app\model; /** * Client模型 */ -class Client { +class Client extends \think\Model{ protected $auto = array('update_time'); protected $insert = array('create_time'); diff --git a/app/model/Config.php b/app/model/Config.php index 58909298..de755acb 100644 --- a/app/model/Config.php +++ b/app/model/Config.php @@ -79,4 +79,11 @@ class Config extends Model { } return $data; } + + public function getThemesList(){ + return [ + 'pc' => [], + 'mobile' => [] + ]; + } } \ No newline at end of file diff --git a/app/model/Hooks.php b/app/model/Hooks.php new file mode 100644 index 00000000..f44cab9a --- /dev/null +++ b/app/model/Hooks.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- + +namespace app\model; + +/** + * 分类模型 + */ +class Hooks extends \think\Model { + +} \ No newline at end of file diff --git a/app/model/Link.php b/app/model/Link.php index a2a32ac1..5b551aa4 100644 --- a/app/model/Link.php +++ b/app/model/Link.php @@ -6,14 +6,13 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - namespace app\model; /** * 友情链接类 * @author molong */ -class Link extends \app\common\model\Base { +class Link extends \think\Model { public $keyList = array( array('name' => 'id', 'title' => 'ID', 'type' => 'hidden'), diff --git a/app/model/Module.php b/app/model/Model.php similarity index 52% rename from app/model/Module.php rename to app/model/Model.php index e4bbcef6..8ef58d78 100644 --- a/app/model/Module.php +++ b/app/model/Model.php @@ -12,7 +12,7 @@ namespace app\model; /** * 设置模型 */ -class Module { +class Model extends \think\Model{ protected $auto = ['update_time']; protected $insert = ['name', 'create_time', 'status' => 1, 'list_grid' => "id:ID\r\ntitle:标题\r\ncreate_time:添加时间|time_format\r\nupdate_time:更新时间|time_format"]; @@ -22,57 +22,57 @@ class Module { 'update_time' => 'integer', ); - protected static function init() { - self::beforeInsert(function ($event) { - $data = $event->toArray(); - $tablename = strtolower($data['name']); - //实例化一个数据库操作类 - $db = new \com\Datatable(); - //检查表是否存在并创建 - if (!$db->CheckTable($tablename)) { - //创建新表 - return $db->initTable($tablename, $data['title'], 'id')->query(); - } else { - return false; - } - }); - self::afterInsert(function ($event) { - $data = $event->toArray(); + // protected static function init() { + // self::beforeInsert(function ($event) { + // $data = $event->toArray(); + // $tablename = strtolower($data['name']); + // //实例化一个数据库操作类 + // $db = new \com\Datatable(); + // //检查表是否存在并创建 + // if (!$db->CheckTable($tablename)) { + // //创建新表 + // return $db->initTable($tablename, $data['title'], 'id')->query(); + // } else { + // return false; + // } + // }); + // self::afterInsert(function ($event) { + // $data = $event->toArray(); - $fields = include (APP_PATH . 'admin/fields.php'); - if (!empty($fields)) { - foreach ($fields as $key => $value) { - if ($data['is_doc']) { - $fields[$key]['model_id'] = $data['id']; - } else { - if (in_array($key, array('uid', 'status', 'view', 'create_time', 'update_time'))) { - $fields[$key]['model_id'] = $data['id']; - } else { - unset($fields[$key]); - } - } - } - model('Attribute')->saveAll($fields); - } - return true; - }); - self::beforeUpdate(function ($event) { - $data = $event->toArray(); - if (isset($data['attribute_sort']) && $data['attribute_sort']) { - $attribute_sort = json_decode($data['attribute_sort'], true); + // $fields = include (APP_PATH . 'admin/fields.php'); + // if (!empty($fields)) { + // foreach ($fields as $key => $value) { + // if ($data['is_doc']) { + // $fields[$key]['model_id'] = $data['id']; + // } else { + // if (in_array($key, array('uid', 'status', 'view', 'create_time', 'update_time'))) { + // $fields[$key]['model_id'] = $data['id']; + // } else { + // unset($fields[$key]); + // } + // } + // } + // model('Attribute')->saveAll($fields); + // } + // return true; + // }); + // self::beforeUpdate(function ($event) { + // $data = $event->toArray(); + // if (isset($data['attribute_sort']) && $data['attribute_sort']) { + // $attribute_sort = json_decode($data['attribute_sort'], true); - if (!empty($attribute_sort)) { - foreach ($attribute_sort as $key => $value) { - db('Attribute')->where('id', 'IN', $value)->setField('group_id', $key); - foreach ($value as $k => $v) { - db('Attribute')->where('id', $v)->setField('sort', $k); - } - } - } - } - return true; - }); - } + // if (!empty($attribute_sort)) { + // foreach ($attribute_sort as $key => $value) { + // db('Attribute')->where('id', 'IN', $value)->setField('group_id', $key); + // foreach ($value as $k => $v) { + // db('Attribute')->where('id', $v)->setField('sort', $k); + // } + // } + // } + // } + // return true; + // }); + // } protected function setAttributeSortAttr($value) { return $value ? json_encode($value) : ''; diff --git a/view/admin/action/index.html b/view/admin/action/index.html index 0d397892..82b7fb8b 100644 --- a/view/admin/action/index.html +++ b/view/admin/action/index.html @@ -60,7 +60,7 @@ - {$page} + {$page|raw} diff --git a/view/admin/action/log.html b/view/admin/action/log.html index b049f84b..802d071f 100644 --- a/view/admin/action/log.html +++ b/view/admin/action/log.html @@ -42,7 +42,7 @@ - {$page} + {$page|raw} diff --git a/view/admin/ad/index.html b/view/admin/ad/index.html index 5807c3c8..c9b54bfd 100644 --- a/view/admin/ad/index.html +++ b/view/admin/ad/index.html @@ -45,7 +45,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/addons/hooks.html b/view/admin/addons/hooks.html index 1ca2e82f..a4564c98 100644 --- a/view/admin/addons/hooks.html +++ b/view/admin/addons/hooks.html @@ -42,7 +42,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/addons/index.html b/view/admin/addons/index.html index fd161fba..28155572 100644 --- a/view/admin/addons/index.html +++ b/view/admin/addons/index.html @@ -58,7 +58,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/attribute/index.html b/view/admin/attribute/index.html index 8b496f6f..6023f490 100644 --- a/view/admin/attribute/index.html +++ b/view/admin/attribute/index.html @@ -42,7 +42,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/client/index.html b/view/admin/client/index.html index 9058cb6e..1c81916a 100644 --- a/view/admin/client/index.html +++ b/view/admin/client/index.html @@ -41,7 +41,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/content/index.html b/view/admin/content/index.html index a5f18093..1490ac0c 100644 --- a/view/admin/content/index.html +++ b/view/admin/content/index.html @@ -87,7 +87,7 @@ - {$page} + {$page|raw} diff --git a/view/admin/form/attr.html b/view/admin/form/attr.html index 323ff387..6835ea4b 100644 --- a/view/admin/form/attr.html +++ b/view/admin/form/attr.html @@ -42,7 +42,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/form/index.html b/view/admin/form/index.html index 3b5dcc74..c6f33b10 100644 --- a/view/admin/form/index.html +++ b/view/admin/form/index.html @@ -62,7 +62,7 @@ {/notempty} - {$page} + {$page|raw} diff --git a/view/admin/form/list_alumn.html b/view/admin/form/list_alumn.html index a74e366a..bde5e0a1 100644 --- a/view/admin/form/list_alumn.html +++ b/view/admin/form/list_alumn.html @@ -52,7 +52,7 @@ {/volist} - {$page} + {$page|raw} diff --git a/view/admin/group/access.html b/view/admin/group/access.html index dff2a424..26426301 100644 --- a/view/admin/group/access.html +++ b/view/admin/group/access.html @@ -66,7 +66,7 @@ {/volist} - {$page} + {$page|raw} {/if} diff --git a/view/admin/group/index.html b/view/admin/group/index.html index 16b49992..a250ee89 100644 --- a/view/admin/group/index.html +++ b/view/admin/group/index.html @@ -61,7 +61,7 @@ {/volist} - {$page} + {$page|raw} {/if} diff --git a/view/admin/link/index.html b/view/admin/link/index.html index 5d5f1698..9739237b 100644 --- a/view/admin/link/index.html +++ b/view/admin/link/index.html @@ -1,6 +1,6 @@ {extend name="admin/public/base"/} {block name="style"} - + {/block} {block name="body"}
@@ -9,8 +9,8 @@

{$meta_title}

- 新 增 - + 新 增 +
@@ -33,16 +33,16 @@ {$item['id']} {$item['title']} {$item['sort']} - {$item['update_time']|date='Y-m-d',###} + {$item['update_time']} - 编辑 - 删除 + 编辑 + 删除 {/volist} - {$page} + {$page|raw}
diff --git a/view/admin/model/index.html b/view/admin/model/index.html index 283fd274..642f2dae 100644 --- a/view/admin/model/index.html +++ b/view/admin/model/index.html @@ -65,7 +65,7 @@ - {$page} + {$page|raw} {/block} diff --git a/view/admin/public/base.html b/view/admin/public/base.html index 76352489..b75a47aa 100644 --- a/view/admin/public/base.html +++ b/view/admin/public/base.html @@ -17,23 +17,23 @@