更新目录结构

This commit is contained in:
molong
2022-04-29 20:26:03 +08:00
parent 4ef43e0258
commit ca1fbd6fd1
89 changed files with 529 additions and 381 deletions

View File

@@ -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;
}

View File

@@ -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');
}

View File

@@ -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;

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\admin;
use app\model\Attribute as AttributeModel;
use app\model\module\Attribute as AttributeModel;
/**
* @title 字段管理

View File

@@ -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());

View File

@@ -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 栏目管理

View File

@@ -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;
/**

View File

@@ -9,7 +9,7 @@
namespace app\controller\admin;
use app\model\Client as ClientM;
use app\model\client\Client as ClientM;
/**
* @title 客户端管理

View File

@@ -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 麦当苗儿 <zuojiazi@vip.qq.com>
*/
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 麦当苗儿 <zuojiazi@vip.qq.com>
*/
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 麦当苗儿 <zuojiazi@vip.qq.com>
*/
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 麦当苗儿 <zuojiazi@vip.qq.com>
*/
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 麦当苗儿 <zuojiazi@vip.qq.com>
*/
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');

View File

@@ -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 内容管理

View File

@@ -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 自定义表单

View File

@@ -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 用户组管理

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\admin;
use app\model\Member;
use app\model\auth\Member;
use think\facade\Session;
/**

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\admin;
use app\model\Link as LinkM;
use app\model\link\Link as LinkM;
/**
* @title 友情链接

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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 用户管理

View File

@@ -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 微信模块

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\api;
use app\model\Attach as AttachModel;
use app\model\system\Attach as AttachModel;
/**
* @title 附件管理

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\api;
use app\model\Config as ConfigM;
use app\model\system\Config as ConfigM;
/**
* @title 基础功能

View File

@@ -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 内容管理

View File

@@ -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;
/**

View File

@@ -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 {

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\api;
use app\model\Member;
use app\model\auth\Member;
use think\facade\Event;
use think\Request;

View File

@@ -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;
/**

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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 内容模块

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\user;
use app\model\Member;
use app\model\auth\Member;
/**
* @title 表单管理

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\user;
use app\model\Member;
use app\model\auth\Member;
use think\facade\Session;
/**

View File

@@ -8,7 +8,7 @@
// +----------------------------------------------------------------------
namespace app\controller\user;
use app\model\Member;
use app\model\auth\Member;
/**
* @title 用户管理