From ca1fbd6fd1197d76241a152c46b0745a99202755 Mon Sep 17 00:00:00 2001 From: molong Date: Fri, 29 Apr 2022 20:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=AE=E5=BD=95=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 2 +- app/controller/Base.php | 10 +- app/controller/admin/Ad.php | 17 +-- app/controller/admin/Addons.php | 4 +- app/controller/admin/Attribute.php | 2 +- app/controller/admin/Base.php | 16 +- app/controller/admin/Category.php | 8 +- app/controller/admin/Channel.php | 2 +- app/controller/admin/Client.php | 2 +- app/controller/admin/Config.php | 129 +++++----------- app/controller/admin/Content.php | 4 +- app/controller/admin/Form.php | 4 +- app/controller/admin/Group.php | 8 +- app/controller/admin/Index.php | 2 +- app/controller/admin/Link.php | 2 +- app/controller/admin/Menu.php | 2 +- app/controller/admin/Model.php | 4 +- app/controller/admin/Seo.php | 4 +- app/controller/admin/User.php | 6 +- app/controller/admin/Wechat.php | 4 +- app/controller/api/Attach.php | 2 +- app/controller/api/Config.php | 2 +- app/controller/api/Content.php | 6 +- app/controller/api/Department.php | 4 +- app/controller/api/Form.php | 4 +- app/controller/api/Login.php | 2 +- app/controller/api/User.php | 8 +- app/controller/front/Content.php | 6 +- app/controller/front/Form.php | 4 +- app/controller/user/Base.php | 4 +- app/controller/user/Content.php | 4 +- app/controller/user/Form.php | 2 +- app/controller/user/Index.php | 2 +- app/controller/user/User.php | 2 +- app/http/middleware/Admin.php | 2 +- app/http/middleware/Validate.php | 10 +- app/http/validate/{ => admin}/Ad.php | 6 +- app/http/validate/{ => admin}/Category.php | 6 +- app/http/validate/{ => admin}/Channel.php | 6 +- app/http/validate/{ => admin}/Config.php | 9 +- app/http/validate/{ => admin}/Content.php | 6 +- app/http/validate/{ => admin}/Link.php | 6 +- app/http/validate/{ => admin}/Menu.php | 6 +- app/http/validate/{ => admin}/Model.php | 6 +- app/http/validate/{ => admin}/User.php | 8 +- app/http/validate/{ => api}/Login.php | 4 +- app/model/ActionLog.php | 21 --- app/model/{ => addons}/Addons.php | 9 +- app/model/{ => addons}/Hooks.php | 9 +- app/model/{ => ads}/Ad.php | 9 +- app/model/{ => ads}/AdPlace.php | 9 +- app/model/{ => auth}/AuthGroup.php | 3 +- app/model/{ => auth}/AuthGroupAccess.php | 3 +- app/model/{ => auth}/AuthRule.php | 3 +- app/model/{ => auth}/Department.php | 2 +- app/model/{ => auth}/Member.php | 2 +- app/model/{ => auth}/MemberLog.php | 3 +- app/model/{ => auth}/Menu.php | 3 +- app/model/{ => auth}/Role.php | 3 +- app/model/{ => auth}/RoleAccess.php | 3 +- app/model/{ => client}/Client.php | 9 +- app/model/{ => form}/DiyForm.php | 3 +- app/model/{ => form}/Form.php | 9 +- app/model/{ => form}/FormAttr.php | 2 +- app/model/{ => link}/Link.php | 2 +- app/model/{ => module}/Attribute.php | 2 +- app/model/{ => module}/Category.php | 3 +- app/model/{ => module}/Document.php | 8 +- app/model/{ => module}/Model.php | 3 +- app/model/{ => system}/Attach.php | 2 +- app/model/{ => system}/Channel.php | 3 +- app/model/{ => system}/Config.php | 33 +---- app/model/{ => system}/Dictionary.php | 2 +- app/model/{ => system}/Rewrite.php | 9 +- app/model/{ => system}/SeoRule.php | 3 +- app/model/{ => wechat}/Wechat.php | 3 +- app/model/{ => wechat}/WechatPay.php | 3 +- app/provider/ModuleProviderService.php | 27 ++++ app/service.php | 6 +- app/services/AdService.php | 29 ++++ app/services/module/ContentService.php | 16 ++ app/services/module/ModuleService.php | 46 ++++++ app/services/system/ConfigService.php | 162 +++++++++++++++++++++ app/services/system/RewriteService.php | 33 +++++ composer.json | 5 +- extend/com/Sent.php | 6 +- qrcode.png | Bin 5695 -> 0 bytes route/app.php | 38 +---- view/admin/config/index.html | 2 +- 89 files changed, 529 insertions(+), 381 deletions(-) rename app/http/validate/{ => admin}/Ad.php (88%) rename app/http/validate/{ => admin}/Category.php (87%) rename app/http/validate/{ => admin}/Channel.php (88%) rename app/http/validate/{ => admin}/Config.php (82%) rename app/http/validate/{ => admin}/Content.php (94%) rename app/http/validate/{ => admin}/Link.php (88%) rename app/http/validate/{ => admin}/Menu.php (88%) rename app/http/validate/{ => admin}/Model.php (90%) rename app/http/validate/{ => admin}/User.php (88%) rename app/http/validate/{ => api}/Login.php (92%) delete mode 100644 app/model/ActionLog.php rename app/model/{ => addons}/Addons.php (94%) rename app/model/{ => addons}/Hooks.php (93%) rename app/model/{ => ads}/Ad.php (89%) rename app/model/{ => ads}/AdPlace.php (90%) rename app/model/{ => auth}/AuthGroup.php (97%) rename app/model/{ => auth}/AuthGroupAccess.php (95%) rename app/model/{ => auth}/AuthRule.php (99%) rename app/model/{ => auth}/Department.php (95%) rename app/model/{ => auth}/Member.php (99%) rename app/model/{ => auth}/MemberLog.php (95%) rename app/model/{ => auth}/Menu.php (98%) rename app/model/{ => auth}/Role.php (97%) rename app/model/{ => auth}/RoleAccess.php (97%) rename app/model/{ => client}/Client.php (68%) rename app/model/{ => form}/DiyForm.php (95%) rename app/model/{ => form}/Form.php (95%) rename app/model/{ => form}/FormAttr.php (99%) rename app/model/{ => link}/Link.php (98%) rename app/model/{ => module}/Attribute.php (99%) rename app/model/{ => module}/Category.php (97%) rename app/model/{ => module}/Document.php (79%) rename app/model/{ => module}/Model.php (99%) rename app/model/{ => system}/Attach.php (95%) rename app/model/{ => system}/Channel.php (98%) rename app/model/{ => system}/Config.php (73%) rename app/model/{ => system}/Dictionary.php (97%) rename app/model/{ => system}/Rewrite.php (84%) rename app/model/{ => system}/SeoRule.php (99%) rename app/model/{ => wechat}/Wechat.php (98%) rename app/model/{ => wechat}/WechatPay.php (97%) create mode 100644 app/provider/ModuleProviderService.php create mode 100644 app/services/AdService.php create mode 100644 app/services/module/ContentService.php create mode 100644 app/services/module/ModuleService.php create mode 100644 app/services/system/ConfigService.php create mode 100644 app/services/system/RewriteService.php delete mode 100644 qrcode.png diff --git a/app/common.php b/app/common.php index 12919a5f..7cb696ef 100755 --- a/app/common.php +++ b/app/common.php @@ -7,7 +7,7 @@ // | Author: molong // +---------------------------------------------------------------------- // 应用公共文件 -use app\model\Member; +use app\model\auth\Member; use think\facade\Request; use think\facade\Session; use think\facade\Config; diff --git a/app/controller/Base.php b/app/controller/Base.php index 42a99ae1..96d80c6c 100644 --- a/app/controller/Base.php +++ b/app/controller/Base.php @@ -8,9 +8,9 @@ // +---------------------------------------------------------------------- namespace app\controller; -use app\model\Config; -use app\model\Hooks; -use app\model\SeoRule; +use app\model\system\Config; +use app\model\addons\Hooks; +use app\model\system\SeoRule; use think\App; use think\exception\ValidateException; use think\facade\Cache; @@ -76,7 +76,7 @@ class Base { } $hooks = Cache::get('sentcms_hooks'); if (!$hooks) { - $hooks = Hooks::where('status', 1)->column('addons', 'name'); + $hooks = Hooks::where('status', 1)->where('addons', '<>', '')->column('addons', 'name'); foreach ($hooks as $key => $values) { if (is_string($values)) { $values = explode(',', $values); @@ -247,7 +247,7 @@ class Base { $config = []; $addons = $this->request->param('addon'); $addon = get_addons_instance($addons)->getConfig(); - $config = \app\model\Addons::where('name', $addons)->value('config'); + $config = \app\model\addons\Addons::where('name', $addons)->value('config'); return $config ? json_decode($config, true) : $addon; } diff --git a/app/controller/admin/Ad.php b/app/controller/admin/Ad.php index a22d8616..0aa69e71 100644 --- a/app/controller/admin/Ad.php +++ b/app/controller/admin/Ad.php @@ -8,8 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\AdPlace; -use app\model\Ad as AdModel; +use app\services\Adservice; /** * @title 广告管理 @@ -20,11 +19,9 @@ class Ad extends Base { /** * @title 广告位管理 */ - public function index() { - $map = []; - $order = "id desc"; + public function index(Adservice $service) { - $list = AdPlace::where($map)->order($order)->paginate($this->request->pageConfig); + $list = $service->getAdPlaceList($this->request); $this->data = array( 'list' => $list, @@ -47,7 +44,7 @@ class Ad extends Base { } } else { $this->data = array( - 'keyList' => AdPlace::$keyList, + 'keyList' => \app\model\ads\AdPlace::$keyList, ); return $this->fetch('admin/public/edit'); } @@ -72,7 +69,7 @@ class Ad extends Base { } $this->data = array( 'info' => $info, - 'keyList' => AdPlace::$keyList, + 'keyList' => \app\model\ads\AdPlace::$keyList, ); return $this->fetch('admin/public/edit'); } @@ -129,7 +126,7 @@ class Ad extends Base { $info['place_id'] = $id; $this->data = array( 'info' => $info, - 'keyList' => AdModel::$keyList, + 'keyList' => \app\model\ads\Ad::$keyList, ); return $this->fetch('admin/public/edit'); } @@ -155,7 +152,7 @@ class Ad extends Base { } $this->data = array( 'info' => $info, - 'keyList' => AdModel::$keyList, + 'keyList' => \app\model\ads\Ad::$keyList, ); return $this->fetch('admin/public/edit'); } diff --git a/app/controller/admin/Addons.php b/app/controller/admin/Addons.php index da0ab317..66d7cc42 100644 --- a/app/controller/admin/Addons.php +++ b/app/controller/admin/Addons.php @@ -8,8 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Addons as AddonsM; -use app\model\Hooks; +use app\model\addons\Addons as AddonsM; +use app\model\addons\Hooks; use think\facade\Cache; use think\facade\Config; diff --git a/app/controller/admin/Attribute.php b/app/controller/admin/Attribute.php index c3d3fadf..4fcb63eb 100644 --- a/app/controller/admin/Attribute.php +++ b/app/controller/admin/Attribute.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Attribute as AttributeModel; +use app\model\module\Attribute as AttributeModel; /** * @title 字段管理 diff --git a/app/controller/admin/Base.php b/app/controller/admin/Base.php index d6cdaab8..8974eb2f 100644 --- a/app/controller/admin/Base.php +++ b/app/controller/admin/Base.php @@ -8,10 +8,10 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Addons; -use app\model\AuthGroup; -use app\model\Menu; -use app\model\Model; +use app\model\addons\Addons; +use app\model\auth\AuthGroup; +use app\model\auth\Menu; +use app\model\module\Model; use think\facade\View; use think\facade\Config; @@ -36,12 +36,12 @@ class Base extends \app\controller\Base { ]; protected function initialize() { - $url = str_replace(".", "/", strtolower($this->request->controller())) . '/' . $this->request->action(); - if (!is_login() and !in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) { - $this->redirect('/admin/index/login'); + $url = $this->request->rule()->getRule(); + if (!is_login() and !in_array($url, array('admin/login', 'admin/logout', 'admin/index/verify'))) { + $this->redirect('/admin/login'); } - if (!in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) { + if (!in_array($url, array('admin/login', 'admin/logout', 'admin/index/verify'))) { // 是否是超级管理员 define('IS_ROOT', is_administrator()); diff --git a/app/controller/admin/Category.php b/app/controller/admin/Category.php index 5e134597..b07e905b 100644 --- a/app/controller/admin/Category.php +++ b/app/controller/admin/Category.php @@ -9,10 +9,10 @@ namespace app\controller\admin; -use app\model\Category as CategoryM; -use app\model\Attribute; -use app\model\Model; -use app\model\Channel; +use app\model\module\Category as CategoryM; +use app\model\module\Attribute; +use app\model\module\Model; +use app\model\system\Channel; /** * @title 栏目管理 diff --git a/app/controller/admin/Channel.php b/app/controller/admin/Channel.php index 7749de60..55a53ad5 100644 --- a/app/controller/admin/Channel.php +++ b/app/controller/admin/Channel.php @@ -9,7 +9,7 @@ namespace app\controller\admin; -use app\model\Channel as ChannelM; +use app\model\system\Channel as ChannelM; use sent\tree\Tree; /** diff --git a/app/controller/admin/Client.php b/app/controller/admin/Client.php index 9eb52abe..5276bfc4 100644 --- a/app/controller/admin/Client.php +++ b/app/controller/admin/Client.php @@ -9,7 +9,7 @@ namespace app\controller\admin; -use app\model\Client as ClientM; +use app\model\client\Client as ClientM; /** * @title 客户端管理 diff --git a/app/controller/admin/Config.php b/app/controller/admin/Config.php index 944591f5..8536e777 100644 --- a/app/controller/admin/Config.php +++ b/app/controller/admin/Config.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Config as ConfigM; +use app\services\system\ConfigService; use think\facade\Cache; /** @@ -16,34 +16,13 @@ use think\facade\Cache; */ class Config extends Base { - public function _initialize() { - parent::_initialize(); - $this->model = new ConfigM(); - } - /** * @title 配置管理 * @author 麦当苗儿 */ - public function index(ConfigM $config) { - $param = $this->request->param(); + public function index(ConfigService $config) { + $list = $config->getConfigList($this->request); - - $group = input('group', 0, 'trim'); - $name = input('name', '', 'trim'); - /* 查询条件初始化 */ - $map = array('status' => 1); - if ($group) { - $map['group'] = $group; - } - - if ($name) { - $map['name'] = array('like', '%' . $name . '%'); - } - - $list = $config->where($map)->order('id desc')->paginate(25, false, array( - 'query' => $this->request->param(), - )); // 记录当前列表页的cookie Cookie('__forward__', $_SERVER['REQUEST_URI']); @@ -51,7 +30,7 @@ class Config extends Base { 'group' => config('config_group_list'), 'config_type' => config('config_config_list'), 'page' => $list->render(), - 'group_id' => $group, + 'group_id' => $this->request->param('group', 0), 'list' => $list, ); @@ -61,22 +40,19 @@ class Config extends Base { /** * @title 信息配置 */ - public function group(ConfigM $config, $id = 1) { + public function group(ConfigService $config) { if ($this->request->isPost()) { - $data = $this->request->post(); - - foreach ($data['config'] as $key => $value) { - ConfigM::update(['value' => $value], ['name' => $key]); + try { + $config->updateConfig($this->request); + return $this->success("更新成功!"); + } catch (\think\Exception $e) { + return $this->error($e->getMessage()); } - //清除db_config_data缓存 - Cache::pull('system_config_data'); - return $this->success("更新成功!"); } else { - $list = $config->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select(); - if ($list) { - $this->data['list'] = $list; - } - $this->data['id'] = $id; + $this->data = [ + 'list' => $config->getConfigByGroup($this->request), + 'id' => $this->request->param('id', 1) + ]; return $this->fetch(); } } @@ -85,19 +61,14 @@ class Config extends Base { * @title 新增配置 * @author 麦当苗儿 */ - public function add(ConfigM $config) { + public function add(ConfigService $config) { if ($this->request->isPost()) { - $data = $this->request->post(); - if ($data) { - $result = ConfigM::create($data); - if (false !== $result) { - Cache::pull('system_config_data'); - return $this->success('新增成功', url('/admin/config/index')); - } else { - return $this->error('新增失败'); - } - } else { - return $this->error('无添加数据!'); + try { + $config->createConfig($this->request); + + return $this->success('添加成功!', url('/admin/config/index')); + } catch (\think\Exception $e) { + return $this->error($e->getMessage()); } } else { $this->data['info'] = []; @@ -109,70 +80,38 @@ class Config extends Base { * @title 编辑配置 * @author 麦当苗儿 */ - public function edit($id = 0) { + public function edit(ConfigService $config) { if ($this->request->isPost()) { - $data = $this->request->post(); - if ($data) { - $result = ConfigM::update($data, array('id' => $data['id'])); - if (false !== $result) { - Cache::pull('system_config_data'); - return $this->success('更新成功', Cookie('__forward__')); - } else { - return $this->error('更新失败!'); - } - } else { - return $this->error('无更新数据!'); + try { + $config->editConfig($this->request); + return $this->success("修改成功!", url('/admin/config/index')); + } catch (\think\Exception $e) { + return $this->error($e->getMessage()); } } else { - $info = array(); - /* 获取数据 */ - $info = ConfigM::find($id); - - if (false === $info) { - return $this->error('获取配置信息错误'); - } - $this->data = ['info' => $info]; + $this->data = ['info' => $config->getConfigDetail($this->request)]; return $this->fetch(); } } - /** - * @title 批量保存配置 - * @author 麦当苗儿 - */ - public function save($config) { - if ($config && is_array($config)) { - foreach ($config as $name => $value) { - (new ConfigM())->save(['value' => $value], ['name' => $name]); - } - } - Cache::pull('system_config_data'); - return $this->success('保存成功!'); - } /** * @title 删除配置 * @author 麦当苗儿 */ - public function del() { - $id = $this->request->param('id'); - - if (empty($id)) { - return $this->error('请选择要操作的数据!'); - } - - $result = ConfigM::find($id)->delete(); - if (false !== $result) { + public function del(ConfigService $config) { + try { + $config->deleteConfig($this->request); Cache::pull('system_config_data'); return $this->success('删除成功'); - } else { - return $this->error('删除失败!'); + } catch (\think\Exception $e) { + return $this->error($e->getMessage()); } } /** * @title 主题选择 */ - public function themes(ConfigM $config) { + public function themes(ConfigService $config) { $list = $config->getThemesList($this->request); $config = Cache::get('system_config_data'); diff --git a/app/controller/admin/Content.php b/app/controller/admin/Content.php index b39c044a..436e8ce0 100644 --- a/app/controller/admin/Content.php +++ b/app/controller/admin/Content.php @@ -10,8 +10,8 @@ namespace app\controller\admin; use think\facade\Db; -use app\model\Model; -use app\model\Attribute; +use app\model\module\Model; +use app\model\module\Attribute; /** * @title 内容管理 diff --git a/app/controller/admin/Form.php b/app/controller/admin/Form.php index 3b0266fc..4e56d9d4 100644 --- a/app/controller/admin/Form.php +++ b/app/controller/admin/Form.php @@ -9,8 +9,8 @@ namespace app\controller\admin; use think\facade\Db; -use app\model\Form as FormM; -use app\model\FormAttr; +use app\model\form\Form as FormM; +use app\model\form\FormAttr; /** * @title 自定义表单 diff --git a/app/controller/admin/Group.php b/app/controller/admin/Group.php index 120e6147..e2e936ec 100644 --- a/app/controller/admin/Group.php +++ b/app/controller/admin/Group.php @@ -9,10 +9,10 @@ namespace app\controller\admin; use think\facade\Db; -use app\model\AuthGroup; -use app\model\AuthGroupAccess; -use app\model\AuthRule; -use app\model\Model; +use app\model\auth\AuthGroup; +use app\model\auth\AuthGroupAccess; +use app\model\auth\AuthRule; +use app\model\module\Model; /** * @title 用户组管理 diff --git a/app/controller/admin/Index.php b/app/controller/admin/Index.php index 3da23770..4a1f8f9e 100755 --- a/app/controller/admin/Index.php +++ b/app/controller/admin/Index.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Member; +use app\model\auth\Member; use think\facade\Session; /** diff --git a/app/controller/admin/Link.php b/app/controller/admin/Link.php index 8d696bc9..c2d6ff84 100644 --- a/app/controller/admin/Link.php +++ b/app/controller/admin/Link.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Link as LinkM; +use app\model\link\Link as LinkM; /** * @title 友情链接 diff --git a/app/controller/admin/Menu.php b/app/controller/admin/Menu.php index fb5cc201..5d837e89 100644 --- a/app/controller/admin/Menu.php +++ b/app/controller/admin/Menu.php @@ -9,7 +9,7 @@ namespace app\controller\admin; use sent\tree\Tree; -use app\model\Menu as MenuM; +use app\model\auth\Menu as MenuM; use think\facade\Cache; /** diff --git a/app/controller/admin/Model.php b/app/controller/admin/Model.php index 9d112ca0..7739a630 100644 --- a/app/controller/admin/Model.php +++ b/app/controller/admin/Model.php @@ -8,8 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Attribute; -use app\model\Model as ModelM; +use app\model\module\Attribute; +use app\model\module\Model as ModelM; use think\facade\Cache; /** diff --git a/app/controller/admin/Seo.php b/app/controller/admin/Seo.php index 9b2786d9..f27795bf 100644 --- a/app/controller/admin/Seo.php +++ b/app/controller/admin/Seo.php @@ -8,8 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\admin; -use app\model\Rewrite; -use app\model\SeoRule; +use app\model\system\Rewrite; +use app\model\system\SeoRule; use think\facade\Cache; /** diff --git a/app/controller/admin/User.php b/app/controller/admin/User.php index f009ea8b..c403adcb 100644 --- a/app/controller/admin/User.php +++ b/app/controller/admin/User.php @@ -10,9 +10,9 @@ namespace app\controller\admin; use think\facade\Cache; -use app\model\Member; -use app\model\AuthGroup; -use app\model\AuthGroupAccess; +use app\model\auth\Member; +use app\model\auth\AuthGroup; +use app\model\auth\AuthGroupAccess; /** * @title 用户管理 diff --git a/app/controller/admin/Wechat.php b/app/controller/admin/Wechat.php index 2786d22c..d7dd77b2 100644 --- a/app/controller/admin/Wechat.php +++ b/app/controller/admin/Wechat.php @@ -9,8 +9,8 @@ namespace app\controller\admin; -use app\model\Wechat as WechatM; -use app\model\WechatPay; +use app\model\wechat\Wechat as WechatM; +use app\model\wechat\WechatPay; /** * @title 微信模块 diff --git a/app/controller/api/Attach.php b/app/controller/api/Attach.php index 3d0ebdf6..59686e32 100644 --- a/app/controller/api/Attach.php +++ b/app/controller/api/Attach.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\api; -use app\model\Attach as AttachModel; +use app\model\system\Attach as AttachModel; /** * @title 附件管理 diff --git a/app/controller/api/Config.php b/app/controller/api/Config.php index 900587ea..ef117ca0 100644 --- a/app/controller/api/Config.php +++ b/app/controller/api/Config.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\api; -use app\model\Config as ConfigM; +use app\model\system\Config as ConfigM; /** * @title 基础功能 diff --git a/app/controller/api/Content.php b/app/controller/api/Content.php index d9f31fc8..26767df9 100644 --- a/app/controller/api/Content.php +++ b/app/controller/api/Content.php @@ -9,9 +9,9 @@ namespace app\controller\api; use think\facade\Db; -use app\model\Category; -use app\model\Model; -use app\model\Attribute; +use app\model\module\Category; +use app\model\module\Model; +use app\model\module\Attribute; /** * @title 内容管理 diff --git a/app/controller/api/Department.php b/app/controller/api/Department.php index 364fc81c..b3b6163e 100644 --- a/app/controller/api/Department.php +++ b/app/controller/api/Department.php @@ -8,8 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\api; -use app\model\Department as DepartmentM; -use app\model\Role; +use app\model\auth\Department as DepartmentM; +use app\model\auth\Role; use sent\tree\Tree; /** diff --git a/app/controller/api/Form.php b/app/controller/api/Form.php index fcf3458d..5df1c626 100644 --- a/app/controller/api/Form.php +++ b/app/controller/api/Form.php @@ -9,8 +9,8 @@ namespace app\controller\api; use think\facade\Db; -use \app\model\Form as FormModel; -use \app\model\FormAttr; +use \app\model\form\Form as FormModel; +use \app\model\form\FormAttr; class Form extends Base { diff --git a/app/controller/api/Login.php b/app/controller/api/Login.php index f47c2c5a..d44cb74c 100644 --- a/app/controller/api/Login.php +++ b/app/controller/api/Login.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\api; -use app\model\Member; +use app\model\auth\Member; use think\facade\Event; use think\Request; diff --git a/app/controller/api/User.php b/app/controller/api/User.php index 5e3e5dbb..59859de5 100644 --- a/app/controller/api/User.php +++ b/app/controller/api/User.php @@ -8,10 +8,10 @@ // +---------------------------------------------------------------------- namespace app\controller\api; -use app\model\Member; -use app\model\MemberLog; -use app\model\Role; -use app\model\RoleAccess; +use app\model\auth\Member; +use app\model\auth\MemberLog; +use app\model\auth\Role; +use app\model\auth\RoleAccess; use xin\helper\Str; /** diff --git a/app/controller/front/Content.php b/app/controller/front/Content.php index 8b3d7a8e..f748687b 100644 --- a/app/controller/front/Content.php +++ b/app/controller/front/Content.php @@ -9,9 +9,9 @@ namespace app\controller\front; use think\facade\Db; -use \app\model\Category; -use \app\model\Model; -use \app\model\Content as ContentModel; +use \app\model\module\Category; +use \app\model\module\Model; +use \app\model\module\Content as ContentModel; class Content extends Base { diff --git a/app/controller/front/Form.php b/app/controller/front/Form.php index 5a65e728..acfbad29 100644 --- a/app/controller/front/Form.php +++ b/app/controller/front/Form.php @@ -9,8 +9,8 @@ namespace app\controller\front; use think\facade\Db; -use \app\model\Form as FormModel; -use \app\model\FormAttr; +use \app\model\form\Form as FormModel; +use \app\model\form\FormAttr; class Form extends Base { diff --git a/app/controller/user/Base.php b/app/controller/user/Base.php index 860b6e1d..0c2ab32f 100644 --- a/app/controller/user/Base.php +++ b/app/controller/user/Base.php @@ -8,8 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\user; -use app\model\Form; -use app\model\Model; +use app\model\form\Form; +use app\model\module\Model; use think\facade\Cache; use think\facade\Config; use think\facade\View; diff --git a/app/controller/user/Content.php b/app/controller/user/Content.php index 63e93eb9..96e3b8ac 100644 --- a/app/controller/user/Content.php +++ b/app/controller/user/Content.php @@ -9,8 +9,8 @@ namespace app\controller\user; use think\facade\Db; -use app\model\Model; -use app\model\Attribute; +use app\model\module\Model; +use app\model\module\Attribute; /** * @title 内容模块 diff --git a/app/controller/user/Form.php b/app/controller/user/Form.php index e8088f7d..3f7d4a7d 100644 --- a/app/controller/user/Form.php +++ b/app/controller/user/Form.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\user; -use app\model\Member; +use app\model\auth\Member; /** * @title 表单管理 diff --git a/app/controller/user/Index.php b/app/controller/user/Index.php index 0d8126ee..f5ac5c67 100644 --- a/app/controller/user/Index.php +++ b/app/controller/user/Index.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\user; -use app\model\Member; +use app\model\auth\Member; use think\facade\Session; /** diff --git a/app/controller/user/User.php b/app/controller/user/User.php index 95d82bd5..2563914c 100644 --- a/app/controller/user/User.php +++ b/app/controller/user/User.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\controller\user; -use app\model\Member; +use app\model\auth\Member; /** * @title 用户管理 diff --git a/app/http/middleware/Admin.php b/app/http/middleware/Admin.php index 5e547e0a..804aece2 100755 --- a/app/http/middleware/Admin.php +++ b/app/http/middleware/Admin.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- namespace app\http\middleware; -use app\model\MemberLog; +use app\model\auth\MemberLog; use think\facade\Session; /** diff --git a/app/http/middleware/Validate.php b/app/http/middleware/Validate.php index 08bebdc1..f8448594 100755 --- a/app/http/middleware/Validate.php +++ b/app/http/middleware/Validate.php @@ -21,15 +21,11 @@ class Validate { //获取当前参数 $params = $request->param(); //获取访问控制器 - if(\strripos($request->controller(), ".")){ - $controller = explode(".", $request->controller()); - }else{ - $controller = ['', ucfirst($request->controller())]; - } + $controller = strtr($request->controller(), '.', '\\'); //获取操作名,用于验证场景scene - $scene = strtolower($controller[0]) . $request->action(); - $validate = "app\\http\\validate\\" . ucfirst($controller[1]); + $scene = $request->action(); + $validate = "\\app\\http\\validate\\" . $controller; //仅当验证器存在时 进行校验 if (class_exists($validate) && $request->isPost()) { $v = new $validate; diff --git a/app/http/validate/Ad.php b/app/http/validate/admin/Ad.php similarity index 88% rename from app/http/validate/Ad.php rename to app/http/validate/admin/Ad.php index 1e9bd516..487bca75 100644 --- a/app/http/validate/Ad.php +++ b/app/http/validate/admin/Ad.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -26,7 +26,7 @@ class Ad extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title', 'name'], - 'adminedit' => ['title', 'name'], + 'add' => ['title', 'name'], + 'edit' => ['title', 'name'], ]; } \ No newline at end of file diff --git a/app/http/validate/Category.php b/app/http/validate/admin/Category.php similarity index 87% rename from app/http/validate/Category.php rename to app/http/validate/admin/Category.php index 0cf1206c..a033ad09 100644 --- a/app/http/validate/Category.php +++ b/app/http/validate/admin/Category.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -25,7 +25,7 @@ class Category extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title', 'model_id'], - 'adminedit' => ['title', 'model_id'], + 'add' => ['title', 'model_id'], + 'edit' => ['title', 'model_id'], ]; } \ No newline at end of file diff --git a/app/http/validate/Channel.php b/app/http/validate/admin/Channel.php similarity index 88% rename from app/http/validate/Channel.php rename to app/http/validate/admin/Channel.php index 8663f9a6..43014197 100644 --- a/app/http/validate/Channel.php +++ b/app/http/validate/admin/Channel.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -23,7 +23,7 @@ class Channel extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title'], - 'adminedit' => ['title'], + 'add' => ['title'], + 'edit' => ['title'], ]; } \ No newline at end of file diff --git a/app/http/validate/Config.php b/app/http/validate/admin/Config.php similarity index 82% rename from app/http/validate/Config.php rename to app/http/validate/admin/Config.php index 8509b3ac..852a04c6 100644 --- a/app/http/validate/Config.php +++ b/app/http/validate/admin/Config.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -15,22 +15,23 @@ use think\Validate; */ class Config extends Validate{ protected $rule = [ - 'name' => 'require|unique:config', + 'name' => 'require|unique:config|alphaDash', 'title' => 'require', ]; protected $message = [ 'name.require' => '配置标识必须', 'name.unique' => '配置标识已存在', + 'name.alphaDash' => '配置标识格式错误', 'title.require' => '配置标题必须', ]; protected $scene = [ - 'adminadd' => ['title', 'name'], + 'add' => ['title', 'name'], ]; // edit 验证场景定义 - public function sceneAdminedit() { + public function sceneEdit() { return $this->only([['title', 'name']]) ->remove('name', 'unique'); } diff --git a/app/http/validate/Content.php b/app/http/validate/admin/Content.php similarity index 94% rename from app/http/validate/Content.php rename to app/http/validate/admin/Content.php index 3620c691..a9947358 100644 --- a/app/http/validate/Content.php +++ b/app/http/validate/admin/Content.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; use think\facade\Request; @@ -50,8 +50,8 @@ class Content extends Validate{ $this->message = $message; $this->scene = [ - 'adminadd' => $field, - 'adminedit' => $field, + 'add' => $field, + 'edit' => $field, 'useradd' => $field, 'useredit' => $field, ]; diff --git a/app/http/validate/Link.php b/app/http/validate/admin/Link.php similarity index 88% rename from app/http/validate/Link.php rename to app/http/validate/admin/Link.php index 454527af..34e34931 100644 --- a/app/http/validate/Link.php +++ b/app/http/validate/admin/Link.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -26,7 +26,7 @@ class Link extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title', 'url'], - 'adminedit' => ['title', 'url'], + 'add' => ['title', 'url'], + 'edit' => ['title', 'url'], ]; } \ No newline at end of file diff --git a/app/http/validate/Menu.php b/app/http/validate/admin/Menu.php similarity index 88% rename from app/http/validate/Menu.php rename to app/http/validate/admin/Menu.php index 443d42d8..7d555623 100644 --- a/app/http/validate/Menu.php +++ b/app/http/validate/admin/Menu.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -23,7 +23,7 @@ class Menu extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title'], - 'adminedit' => ['title'], + 'add' => ['title'], + 'edit' => ['title'], ]; } \ No newline at end of file diff --git a/app/http/validate/Model.php b/app/http/validate/admin/Model.php similarity index 90% rename from app/http/validate/Model.php rename to app/http/validate/admin/Model.php index debadb3f..cacd5356 100644 --- a/app/http/validate/Model.php +++ b/app/http/validate/admin/Model.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; @@ -27,7 +27,7 @@ class Model extends Validate{ ]; protected $scene = [ - 'adminadd' => ['title', 'name'], - 'adminedit' => ['title'], + 'add' => ['title', 'name'], + 'edit' => ['title'], ]; } \ No newline at end of file diff --git a/app/http/validate/User.php b/app/http/validate/admin/User.php similarity index 88% rename from app/http/validate/User.php rename to app/http/validate/admin/User.php index f73739d3..6e8689a4 100644 --- a/app/http/validate/User.php +++ b/app/http/validate/admin/User.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\admin; use think\Validate; use app\model\Member; @@ -39,9 +39,9 @@ class User extends Validate{ ]; protected $scene = [ - 'adminadd' => ['username', 'email', 'password', 'repassword'], - 'adminedit' => ['username', 'email'], - 'admineditpwd' => ['uid', 'password', 'repassword', 'oldpassword'] + 'add' => ['username', 'email', 'password', 'repassword'], + 'edit' => ['username', 'email'], + 'editpwd' => ['uid', 'password', 'repassword', 'oldpassword'] ]; protected function checkOldpaswd($value, $rule, $data){ diff --git a/app/http/validate/Login.php b/app/http/validate/api/Login.php similarity index 92% rename from app/http/validate/Login.php rename to app/http/validate/api/Login.php index 6663deab..f51db5ba 100644 --- a/app/http/validate/Login.php +++ b/app/http/validate/api/Login.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate; +namespace app\http\validate\api; use think\Validate; use app\model\Member; @@ -28,6 +28,6 @@ class Login extends Validate{ ]; protected $scene = [ - 'apiindex' => ['username', 'password'], + 'index' => ['username', 'password'], ]; } \ No newline at end of file diff --git a/app/model/ActionLog.php b/app/model/ActionLog.php deleted file mode 100644 index d33eff63..00000000 --- a/app/model/ActionLog.php +++ /dev/null @@ -1,21 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace app\model; - -/** - * 分类模型 - */ -class ActionLog { - - protected function getModelIdAttr($value, $data) { - $value = get_document_field($data['model'], "name", "id"); - return $value ? $value : 0; - } -} \ No newline at end of file diff --git a/app/model/Addons.php b/app/model/addons/Addons.php similarity index 94% rename from app/model/Addons.php rename to app/model/addons/Addons.php index be93bec3..92bdbe78 100644 --- a/app/model/Addons.php +++ b/app/model/addons/Addons.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\addons; use app\facade\Cache; diff --git a/app/model/Hooks.php b/app/model/addons/Hooks.php similarity index 93% rename from app/model/Hooks.php rename to app/model/addons/Hooks.php index dba6a97e..6d403a38 100644 --- a/app/model/Hooks.php +++ b/app/model/addons/Hooks.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\addons; /** * 分类模型 diff --git a/app/model/Ad.php b/app/model/ads/Ad.php similarity index 89% rename from app/model/Ad.php rename to app/model/ads/Ad.php index 72cf730a..410b92b2 100644 --- a/app/model/Ad.php +++ b/app/model/ads/Ad.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\ads; /** * 分类模型 diff --git a/app/model/AdPlace.php b/app/model/ads/AdPlace.php similarity index 90% rename from app/model/AdPlace.php rename to app/model/ads/AdPlace.php index 708c43ca..578af2d1 100644 --- a/app/model/AdPlace.php +++ b/app/model/ads/AdPlace.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\ads; /** * 分类模型 diff --git a/app/model/AuthGroup.php b/app/model/auth/AuthGroup.php similarity index 97% rename from app/model/AuthGroup.php rename to app/model/auth/AuthGroup.php index a9e56936..e1d90493 100644 --- a/app/model/AuthGroup.php +++ b/app/model/auth/AuthGroup.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; use think\Model; diff --git a/app/model/AuthGroupAccess.php b/app/model/auth/AuthGroupAccess.php similarity index 95% rename from app/model/AuthGroupAccess.php rename to app/model/auth/AuthGroupAccess.php index e9bc5b9d..63584283 100644 --- a/app/model/AuthGroupAccess.php +++ b/app/model/auth/AuthGroupAccess.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; use think\Model; diff --git a/app/model/AuthRule.php b/app/model/auth/AuthRule.php similarity index 99% rename from app/model/AuthRule.php rename to app/model/auth/AuthRule.php index 6b71f7eb..57ff1840 100644 --- a/app/model/AuthRule.php +++ b/app/model/auth/AuthRule.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; use think\Model; diff --git a/app/model/Department.php b/app/model/auth/Department.php similarity index 95% rename from app/model/Department.php rename to app/model/auth/Department.php index 8f0159e0..1a9e0cf3 100644 --- a/app/model/Department.php +++ b/app/model/auth/Department.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\auth; use think\Model; diff --git a/app/model/Member.php b/app/model/auth/Member.php similarity index 99% rename from app/model/Member.php rename to app/model/auth/Member.php index d397537e..9db9c5c2 100644 --- a/app/model/Member.php +++ b/app/model/auth/Member.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\auth; use sent\jwt\facade\JWTAuth; use think\Model; diff --git a/app/model/MemberLog.php b/app/model/auth/MemberLog.php similarity index 95% rename from app/model/MemberLog.php rename to app/model/auth/MemberLog.php index 1e10d947..4d723cf6 100644 --- a/app/model/MemberLog.php +++ b/app/model/auth/MemberLog.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; use think\Model; use xin\helper\Server; diff --git a/app/model/Menu.php b/app/model/auth/Menu.php similarity index 98% rename from app/model/Menu.php rename to app/model/auth/Menu.php index ccba1e96..f1547210 100644 --- a/app/model/Menu.php +++ b/app/model/auth/Menu.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; /** * 菜单模型类 diff --git a/app/model/Role.php b/app/model/auth/Role.php similarity index 97% rename from app/model/Role.php rename to app/model/auth/Role.php index 42d3b0da..c6569a83 100644 --- a/app/model/Role.php +++ b/app/model/auth/Role.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; /** * 角色模型 diff --git a/app/model/RoleAccess.php b/app/model/auth/RoleAccess.php similarity index 97% rename from app/model/RoleAccess.php rename to app/model/auth/RoleAccess.php index fd1d3b73..a8f8f17e 100644 --- a/app/model/RoleAccess.php +++ b/app/model/auth/RoleAccess.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\auth; /** * 角色模型 diff --git a/app/model/Client.php b/app/model/client/Client.php similarity index 68% rename from app/model/Client.php rename to app/model/client/Client.php index 67501fbf..4f40c49f 100644 --- a/app/model/Client.php +++ b/app/model/client/Client.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\client; /** * Client模型 diff --git a/app/model/DiyForm.php b/app/model/form/DiyForm.php similarity index 95% rename from app/model/DiyForm.php rename to app/model/form/DiyForm.php index 9b6f6dcc..4c90335f 100644 --- a/app/model/DiyForm.php +++ b/app/model/form/DiyForm.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\form; /** * 自定义表单模型 diff --git a/app/model/Form.php b/app/model/form/Form.php similarity index 95% rename from app/model/Form.php rename to app/model/form/Form.php index af8f21bc..485df452 100644 --- a/app/model/Form.php +++ b/app/model/form/Form.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\form; use think\facade\Config; diff --git a/app/model/FormAttr.php b/app/model/form/FormAttr.php similarity index 99% rename from app/model/FormAttr.php rename to app/model/form/FormAttr.php index 0d03e770..a5beec3e 100644 --- a/app/model/FormAttr.php +++ b/app/model/form/FormAttr.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\form; use think\facade\Cache; use think\facade\Config; diff --git a/app/model/Link.php b/app/model/link/Link.php similarity index 98% rename from app/model/Link.php rename to app/model/link/Link.php index 923ac8ac..225943e7 100644 --- a/app/model/Link.php +++ b/app/model/link/Link.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\link; /** * 友情链接类 diff --git a/app/model/Attribute.php b/app/model/module/Attribute.php similarity index 99% rename from app/model/Attribute.php rename to app/model/module/Attribute.php index a0391ce2..b408de84 100644 --- a/app/model/Attribute.php +++ b/app/model/module/Attribute.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\module; use think\facade\Config; use think\facade\Db; diff --git a/app/model/Category.php b/app/model/module/Category.php similarity index 97% rename from app/model/Category.php rename to app/model/module/Category.php index 2721e5a1..cc6d138c 100644 --- a/app/model/Category.php +++ b/app/model/module/Category.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\module; /** * 设置模型 diff --git a/app/model/Document.php b/app/model/module/Document.php similarity index 79% rename from app/model/Document.php rename to app/model/module/Document.php index 5de4fd4d..29f7cbab 100644 --- a/app/model/Document.php +++ b/app/model/module/Document.php @@ -1,12 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\module; use think\facade\Db; diff --git a/app/model/Model.php b/app/model/module/Model.php similarity index 99% rename from app/model/Model.php rename to app/model/module/Model.php index 3f91e238..2ef6cfc9 100644 --- a/app/model/Model.php +++ b/app/model/module/Model.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\module; /** * 设置模型 diff --git a/app/model/Attach.php b/app/model/system/Attach.php similarity index 95% rename from app/model/Attach.php rename to app/model/system/Attach.php index 59b99ea9..acbe021e 100644 --- a/app/model/Attach.php +++ b/app/model/system/Attach.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\system; /** * 附件模型 diff --git a/app/model/Channel.php b/app/model/system/Channel.php similarity index 98% rename from app/model/Channel.php rename to app/model/system/Channel.php index 53995557..6cdd70af 100644 --- a/app/model/Channel.php +++ b/app/model/system/Channel.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\system; /** * 设置模型 diff --git a/app/model/Config.php b/app/model/system/Config.php similarity index 73% rename from app/model/Config.php rename to app/model/system/Config.php index 12dbc76f..5e29cab7 100644 --- a/app/model/Config.php +++ b/app/model/system/Config.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\system; use think\facade\Cache; use think\Model; @@ -82,35 +82,4 @@ class Config extends Model { } return $data; } - - public function getThemesList($request){ - return [ - 'pc' => $this->getList('pc'), - 'mobile' => $this->getList('mobile') - ]; - } - - protected function getList($type){ - $tempPath = app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR; - - $file = opendir($tempPath); - $list = []; - while (false !== ($filename = readdir($file))) { - if (!in_array($filename, array('.', '..'))) { - $files = $tempPath . $filename . '/info.php'; - if (is_file($files)) { - $info = include($files); - if (isset($info['type']) && $info['type'] == $type) { - $info['id'] = $filename; - $preview = '/template/' . $filename . '/' . $info['preview']; - $info['preview'] = is_file($tempPath . $preview) ? $preview : '/static/common/images/default.png'; - $list[] = $info; - }else{ - continue; - } - } - } - } - return $list; - } } \ No newline at end of file diff --git a/app/model/Dictionary.php b/app/model/system/Dictionary.php similarity index 97% rename from app/model/Dictionary.php rename to app/model/system/Dictionary.php index 45d13ee7..d1e17e67 100644 --- a/app/model/Dictionary.php +++ b/app/model/system/Dictionary.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\model; +namespace app\model\system; use think\Model; use think\facade\Db; diff --git a/app/model/Rewrite.php b/app/model/system/Rewrite.php similarity index 84% rename from app/model/Rewrite.php rename to app/model/system/Rewrite.php index fd74ca1c..a1c1965e 100644 --- a/app/model/Rewrite.php +++ b/app/model/system/Rewrite.php @@ -1,13 +1,12 @@ +// | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\system; /** * 伪静态 diff --git a/app/model/SeoRule.php b/app/model/system/SeoRule.php similarity index 99% rename from app/model/SeoRule.php rename to app/model/system/SeoRule.php index 49e9f812..4e8312e7 100644 --- a/app/model/SeoRule.php +++ b/app/model/system/SeoRule.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\system; /** * 用户模型 diff --git a/app/model/Wechat.php b/app/model/wechat/Wechat.php similarity index 98% rename from app/model/Wechat.php rename to app/model/wechat/Wechat.php index a3197201..65e62772 100644 --- a/app/model/Wechat.php +++ b/app/model/wechat/Wechat.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\wechat; /** * 微信模型 diff --git a/app/model/WechatPay.php b/app/model/wechat/WechatPay.php similarity index 97% rename from app/model/WechatPay.php rename to app/model/wechat/WechatPay.php index 22102e7a..25ef4331 100644 --- a/app/model/WechatPay.php +++ b/app/model/wechat/WechatPay.php @@ -6,8 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- - -namespace app\model; +namespace app\model\wechat; /** * 微信模型 diff --git a/app/provider/ModuleProviderService.php b/app/provider/ModuleProviderService.php new file mode 100644 index 00000000..63218b4e --- /dev/null +++ b/app/provider/ModuleProviderService.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- +declare (strict_types = 1); +namespace app\provider; + +use think\Service; +use app\services\module\ModuleService; +use think\Db; + +/** + * 模型服务类 + */ +class ModuleProviderService extends Service{ + public function register(){ + // 服务注册 + } + + public function boot(){ + // 服务启动 + } +} diff --git a/app/service.php b/app/service.php index db1ee6a8..dcb53c56 100644 --- a/app/service.php +++ b/app/service.php @@ -1,9 +1,11 @@ +// +---------------------------------------------------------------------- +namespace app\services; + +use app\model\ads\Ad; +use app\model\ads\AdPlace; + +class AdService{ + + /** + * @title 获取广告位列表 + * + * @return void + */ + public function getAdPlaceList($request){ + $map = []; + $order = "id desc"; + + $list = AdPlace::where($map)->order($order)->paginate($request->pageConfig); + + return $list; + } +} \ No newline at end of file diff --git a/app/services/module/ContentService.php b/app/services/module/ContentService.php new file mode 100644 index 00000000..5bb8e02b --- /dev/null +++ b/app/services/module/ContentService.php @@ -0,0 +1,16 @@ + +// +---------------------------------------------------------------------- +namespace app\services\module; + +class ContentService{ + + /** + * + */ +} \ No newline at end of file diff --git a/app/services/module/ModuleService.php b/app/services/module/ModuleService.php new file mode 100644 index 00000000..234222d3 --- /dev/null +++ b/app/services/module/ModuleService.php @@ -0,0 +1,46 @@ + +// +---------------------------------------------------------------------- +namespace app\services\module; + +use app\model\module\Model; +use think\facade\Cache; +use think\facade\Route; + +class ModuleService{ + + /** + * @title 获取模型数据 + */ + public function getModuleList(){ + $map = []; + + $list = (new Module())->where($map)->select(); + + return $list; + } + + public function registerRoute(){ + $model = Cache::get('model_route_list'); + if (!$model) { + $model = Model::where('status', '>', 0)->field(['id', 'name'])->select()->toArray(); + Cache::set('model_route_list', $model); + } + + if (!empty($model)) { + foreach ($model as $value) { + Route::rule('/admin/' . $value['name'] . '/:function', 'admin.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + Route::rule($value['name'] . '/index', 'front.Content/index')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + Route::rule($value['name'] . '/list/:id', 'front.Content/lists')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + Route::rule($value['name'] . '/detail-:id', 'front.Content/detail')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + Route::rule('/user/' . $value['name'] . '/:function', 'user.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + Route::rule('/api/' . $value['name'] . '/:function', 'api.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); + } + } + } +} \ No newline at end of file diff --git a/app/services/system/ConfigService.php b/app/services/system/ConfigService.php new file mode 100644 index 00000000..6e3d7aed --- /dev/null +++ b/app/services/system/ConfigService.php @@ -0,0 +1,162 @@ + +// +---------------------------------------------------------------------- +namespace app\services\system; + +use app\model\system\Config; +use think\facade\Cache; + +class ConfigService{ + + /** + * @title 获取配置列表 + * + * @param [type] $request + * @return void + */ + public function getConfigList($request){ + $group = $request->param('group', 0); + $name = $request->param('name', 0); + + /* 查询条件初始化 */ + $map = []; + if ($group) { + $map['group'] = $group; + } + + if ($name) { + $map['name'] = array('like', '%' . $name . '%'); + } + + $list = Config::where($map)->order('id desc')->paginate($request->pageConfig); + return $list; + } + + /** + * @title 根据分组获取配置 + * + * @param [type] $request + * @return void + */ + public function getConfigByGroup($request){ + $id = $request->param('id', 1); + $map = []; + + $map[] = ['group', '=', $id]; + $map[] = ['status', '=', 1]; + $data = Config::where($map)->field('id,name,title,extra,value,remark,type')->order('sort')->select(); + + return $data ? $data : []; + } + + /** + * @title 更新配置 + * + * @param [type] $request + * @return void + */ + public function updateConfig($request){ + $data = $request->post('config'); + + foreach ($data as $key => $value) { + Config::update(['value' => $value], ['name' => $key]); + } + //清除db_config_data缓存 + Cache::delete('system_config_data'); + } + + /** + * @title 创建配置项 + * + * @param [type] $request + * @return void + */ + public function createConfig($request){ + $data = $request->post(); + $result = Config::create($data); + if (false !== $result) { + Cache::pull('system_config_data'); + } else { + throw new \think\Exception("新增失败!", 1); + } + } + + /** + * @title 获取单个配置信息 + * + * @return void + */ + public function getConfigDetail($request){ + $id = $request->param('id', 0); + + $config = Config::where('id', '=', $id)->findOrEmpty(); + return $config->isEmpty() ? [] : $config; + } + + /** + * @title 修改单个配置项 + * + * @param [type] $request + * @return void + */ + public function editConfig($request){ + $data = $request->post(); + + $result = Config::update($data, array('id' => $data['id'])); + if (false !== $result) { + Cache::pull('system_config_data'); + return true; + } else { + throw new \think\Exception("更新失败!", 1); + } + } + + /** + * @title 删除配置 + * + * @return void + */ + public function deleteConfig($request){ + $id = $request->param('id', 0); + if(!$id){ + throw new \think\Exception("非法操作!", 1); + } + return Config::find($id)->delete(); + } + + public function getThemesList($request){ + return [ + 'pc' => $this->getList('pc'), + 'mobile' => $this->getList('mobile') + ]; + } + + protected function getList($type){ + $tempPath = app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR; + + $file = opendir($tempPath); + $list = []; + while (false !== ($filename = readdir($file))) { + if (!in_array($filename, array('.', '..'))) { + $files = $tempPath . $filename . '/info.php'; + if (is_file($files)) { + $info = include($files); + if (isset($info['type']) && $info['type'] == $type) { + $info['id'] = $filename; + $preview = '/template/' . $filename . '/' . $info['preview']; + $info['preview'] = is_file($tempPath . $preview) ? $preview : '/static/common/images/default.png'; + $list[] = $info; + }else{ + continue; + } + } + } + } + return $list; + } +} \ No newline at end of file diff --git a/app/services/system/RewriteService.php b/app/services/system/RewriteService.php new file mode 100644 index 00000000..ff222aa5 --- /dev/null +++ b/app/services/system/RewriteService.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- +namespace app\services\system; + +use app\model\system\Rewrite; +use think\facade\Cache; +use think\facade\Route; + +class RewriteService{ + + public function registerRoute(){ + $rewrite = Cache::get('rewrite_list'); + if (!$rewrite) { + $rewrite = Rewrite::select()->toArray(); + Cache::set('rewrite_list', $rewrite); + } + + if (!empty($rewrite)) { + foreach ($rewrite as $key => $value) { + $url = parse_url($value['url']); + $param = []; + parse_str($url['query'], $param); + Route::rule($value['rule'], $url['path'])->append($param); + } + } + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index 93e48a08..d28e03d2 100755 --- a/composer.json +++ b/composer.json @@ -42,7 +42,10 @@ } }, "config": { - "preferred-install": "dist" + "preferred-install": "dist", + "allow-plugins": { + "easywechat-composer/easywechat-composer": true + } }, "scripts": { "post-autoload-dump": [ diff --git a/extend/com/Sent.php b/extend/com/Sent.php index aacc15a9..754478b1 100644 --- a/extend/com/Sent.php +++ b/extend/com/Sent.php @@ -27,7 +27,7 @@ class Sent extends \think\template\TagLib { $pid = isset($tag['pid']) ? $tag['pid'] : ''; $tree = isset($tag['tree']) ? $tag['tree'] : false; $parse = ' $'.$tag['name'].') {'; $parse .= '?>'; $parse .= $content; @@ -44,7 +44,7 @@ class Sent extends \think\template\TagLib { $name = isset($tag['name']) ? $tag['name'] : 'item'; $parse = $parse = ' $'.$name.') {'; $parse .= '?>'; $parse .= $content; @@ -66,7 +66,7 @@ class Sent extends \think\template\TagLib { $map = implode(" and ", $where); $parse = $parse = 'field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; + $parse .= '$__LIST__ = \\app\\model\link\\\Link::where(\''.$map.'\')->field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; $parse .= 'foreach ($__LIST__ as $key => $'.$tag['name'].') {'; $parse .= '?>'; $parse .= $content; diff --git a/qrcode.png b/qrcode.png deleted file mode 100644 index 07a73687ff92b55bc0bcf1ccd47ce71b90d7b3bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5695 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 CJ~;{i diff --git a/route/app.php b/route/app.php index e8fe1776..dcc02bb9 100755 --- a/route/app.php +++ b/route/app.php @@ -9,43 +9,13 @@ // | Author: liu21st // +---------------------------------------------------------------------- use think\facade\Route; -use think\facade\Cache; -use app\model\Model; -use app\model\Rewrite; +use app\services\module\ModuleService; +use app\services\system\RewriteService; use app\http\middleware\Validate; use app\http\middleware\Admin; -$model = Cache::get('model_list'); -if (!$model) { - $model = Model::where('status', '>', 0)->field(['id', 'name'])->select()->toArray(); - Cache::set('model_list', $model); -} - -if (!empty($model)) { - foreach ($model as $value) { - Route::rule('/admin/' . $value['name'] . '/:function', 'admin.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - Route::rule($value['name'] . '/index', 'front.Content/index')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - Route::rule($value['name'] . '/list/:id', 'front.Content/lists')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - Route::rule($value['name'] . '/detail-:id', 'front.Content/detail')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - Route::rule('/user/' . $value['name'] . '/:function', 'user.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - Route::rule('/api/' . $value['name'] . '/:function', 'api.Content/:function')->append(['name'=>$value['name'], 'model_id' => $value['id']]); - } -} - -$rewrite = Cache::get('rewrite_list'); -if (!$rewrite) { - $rewrite = Rewrite::select()->toArray(); - Cache::set('rewrite_list', $rewrite); -} - -if (!empty($rewrite)) { - foreach ($rewrite as $key => $value) { - $url = parse_url($value['url']); - $param = []; - parse_str($url['query'], $param); - Route::rule($value['rule'], $url['path'])->append($param); - } -} +app()->make(ModuleService::class)->registerRoute(); //注册模型路由 +app()->make(RewriteService::class)->registerRoute(); //后台伪静态设置路由注册 Route::rule('/', 'front.Index/index'); Route::rule('search', 'front.Content/search'); diff --git a/view/admin/config/index.html b/view/admin/config/index.html index 5e7e8a49..542e24aa 100644 --- a/view/admin/config/index.html +++ b/view/admin/config/index.html @@ -20,7 +20,7 @@
  • 全部
  • {volist name="config['config_group_list']" id="item"}
  • - {$item['label']} + {$item['label']}
  • {/volist}