更新目录结构
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// 应用公共文件
|
// 应用公共文件
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller;
|
namespace app\controller;
|
||||||
|
|
||||||
use app\model\Config;
|
use app\model\system\Config;
|
||||||
use app\model\Hooks;
|
use app\model\addons\Hooks;
|
||||||
use app\model\SeoRule;
|
use app\model\system\SeoRule;
|
||||||
use think\App;
|
use think\App;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
@@ -76,7 +76,7 @@ class Base {
|
|||||||
}
|
}
|
||||||
$hooks = Cache::get('sentcms_hooks');
|
$hooks = Cache::get('sentcms_hooks');
|
||||||
if (!$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) {
|
foreach ($hooks as $key => $values) {
|
||||||
if (is_string($values)) {
|
if (is_string($values)) {
|
||||||
$values = explode(',', $values);
|
$values = explode(',', $values);
|
||||||
@@ -247,7 +247,7 @@ class Base {
|
|||||||
$config = [];
|
$config = [];
|
||||||
$addons = $this->request->param('addon');
|
$addons = $this->request->param('addon');
|
||||||
$addon = get_addons_instance($addons)->getConfig();
|
$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;
|
return $config ? json_decode($config, true) : $addon;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\AdPlace;
|
use app\services\Adservice;
|
||||||
use app\model\Ad as AdModel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 广告管理
|
* @title 广告管理
|
||||||
@@ -20,11 +19,9 @@ class Ad extends Base {
|
|||||||
/**
|
/**
|
||||||
* @title 广告位管理
|
* @title 广告位管理
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index(Adservice $service) {
|
||||||
$map = [];
|
|
||||||
$order = "id desc";
|
|
||||||
|
|
||||||
$list = AdPlace::where($map)->order($order)->paginate($this->request->pageConfig);
|
$list = $service->getAdPlaceList($this->request);
|
||||||
|
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'list' => $list,
|
'list' => $list,
|
||||||
@@ -47,7 +44,7 @@ class Ad extends Base {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'keyList' => AdPlace::$keyList,
|
'keyList' => \app\model\ads\AdPlace::$keyList,
|
||||||
);
|
);
|
||||||
return $this->fetch('admin/public/edit');
|
return $this->fetch('admin/public/edit');
|
||||||
}
|
}
|
||||||
@@ -72,7 +69,7 @@ class Ad extends Base {
|
|||||||
}
|
}
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'keyList' => AdPlace::$keyList,
|
'keyList' => \app\model\ads\AdPlace::$keyList,
|
||||||
);
|
);
|
||||||
return $this->fetch('admin/public/edit');
|
return $this->fetch('admin/public/edit');
|
||||||
}
|
}
|
||||||
@@ -129,7 +126,7 @@ class Ad extends Base {
|
|||||||
$info['place_id'] = $id;
|
$info['place_id'] = $id;
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'keyList' => AdModel::$keyList,
|
'keyList' => \app\model\ads\Ad::$keyList,
|
||||||
);
|
);
|
||||||
return $this->fetch('admin/public/edit');
|
return $this->fetch('admin/public/edit');
|
||||||
}
|
}
|
||||||
@@ -155,7 +152,7 @@ class Ad extends Base {
|
|||||||
}
|
}
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'keyList' => AdModel::$keyList,
|
'keyList' => \app\model\ads\Ad::$keyList,
|
||||||
);
|
);
|
||||||
return $this->fetch('admin/public/edit');
|
return $this->fetch('admin/public/edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Addons as AddonsM;
|
use app\model\addons\Addons as AddonsM;
|
||||||
use app\model\Hooks;
|
use app\model\addons\Hooks;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Attribute as AttributeModel;
|
use app\model\module\Attribute as AttributeModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 字段管理
|
* @title 字段管理
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Addons;
|
use app\model\addons\Addons;
|
||||||
use app\model\AuthGroup;
|
use app\model\auth\AuthGroup;
|
||||||
use app\model\Menu;
|
use app\model\auth\Menu;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ class Base extends \app\controller\Base {
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected function initialize() {
|
protected function initialize() {
|
||||||
$url = str_replace(".", "/", strtolower($this->request->controller())) . '/' . $this->request->action();
|
$url = $this->request->rule()->getRule();
|
||||||
if (!is_login() and !in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
if (!is_login() and !in_array($url, array('admin/login', 'admin/logout', 'admin/index/verify'))) {
|
||||||
$this->redirect('/admin/index/login');
|
$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());
|
define('IS_ROOT', is_administrator());
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Category as CategoryM;
|
use app\model\module\Category as CategoryM;
|
||||||
use app\model\Attribute;
|
use app\model\module\Attribute;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use app\model\Channel;
|
use app\model\system\Channel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 栏目管理
|
* @title 栏目管理
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Channel as ChannelM;
|
use app\model\system\Channel as ChannelM;
|
||||||
use sent\tree\Tree;
|
use sent\tree\Tree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Client as ClientM;
|
use app\model\client\Client as ClientM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 客户端管理
|
* @title 客户端管理
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Config as ConfigM;
|
use app\services\system\ConfigService;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,34 +16,13 @@ use think\facade\Cache;
|
|||||||
*/
|
*/
|
||||||
class Config extends Base {
|
class Config extends Base {
|
||||||
|
|
||||||
public function _initialize() {
|
|
||||||
parent::_initialize();
|
|
||||||
$this->model = new ConfigM();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 配置管理
|
* @title 配置管理
|
||||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
*/
|
*/
|
||||||
public function index(ConfigM $config) {
|
public function index(ConfigService $config) {
|
||||||
$param = $this->request->param();
|
$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
|
||||||
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
@@ -51,7 +30,7 @@ class Config extends Base {
|
|||||||
'group' => config('config_group_list'),
|
'group' => config('config_group_list'),
|
||||||
'config_type' => config('config_config_list'),
|
'config_type' => config('config_config_list'),
|
||||||
'page' => $list->render(),
|
'page' => $list->render(),
|
||||||
'group_id' => $group,
|
'group_id' => $this->request->param('group', 0),
|
||||||
'list' => $list,
|
'list' => $list,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -61,22 +40,19 @@ class Config extends Base {
|
|||||||
/**
|
/**
|
||||||
* @title 信息配置
|
* @title 信息配置
|
||||||
*/
|
*/
|
||||||
public function group(ConfigM $config, $id = 1) {
|
public function group(ConfigService $config) {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$data = $this->request->post();
|
try {
|
||||||
|
$config->updateConfig($this->request);
|
||||||
foreach ($data['config'] as $key => $value) {
|
|
||||||
ConfigM::update(['value' => $value], ['name' => $key]);
|
|
||||||
}
|
|
||||||
//清除db_config_data缓存
|
|
||||||
Cache::pull('system_config_data');
|
|
||||||
return $this->success("更新成功!");
|
return $this->success("更新成功!");
|
||||||
} else {
|
} catch (\think\Exception $e) {
|
||||||
$list = $config->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select();
|
return $this->error($e->getMessage());
|
||||||
if ($list) {
|
|
||||||
$this->data['list'] = $list;
|
|
||||||
}
|
}
|
||||||
$this->data['id'] = $id;
|
} else {
|
||||||
|
$this->data = [
|
||||||
|
'list' => $config->getConfigByGroup($this->request),
|
||||||
|
'id' => $this->request->param('id', 1)
|
||||||
|
];
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,19 +61,14 @@ class Config extends Base {
|
|||||||
* @title 新增配置
|
* @title 新增配置
|
||||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
*/
|
*/
|
||||||
public function add(ConfigM $config) {
|
public function add(ConfigService $config) {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$data = $this->request->post();
|
try {
|
||||||
if ($data) {
|
$config->createConfig($this->request);
|
||||||
$result = ConfigM::create($data);
|
|
||||||
if (false !== $result) {
|
return $this->success('添加成功!', url('/admin/config/index'));
|
||||||
Cache::pull('system_config_data');
|
} catch (\think\Exception $e) {
|
||||||
return $this->success('新增成功', url('/admin/config/index'));
|
return $this->error($e->getMessage());
|
||||||
} else {
|
|
||||||
return $this->error('新增失败');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return $this->error('无添加数据!');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->data['info'] = [];
|
$this->data['info'] = [];
|
||||||
@@ -109,70 +80,38 @@ class Config extends Base {
|
|||||||
* @title 编辑配置
|
* @title 编辑配置
|
||||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
*/
|
*/
|
||||||
public function edit($id = 0) {
|
public function edit(ConfigService $config) {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$data = $this->request->post();
|
try {
|
||||||
if ($data) {
|
$config->editConfig($this->request);
|
||||||
$result = ConfigM::update($data, array('id' => $data['id']));
|
return $this->success("修改成功!", url('/admin/config/index'));
|
||||||
if (false !== $result) {
|
} catch (\think\Exception $e) {
|
||||||
Cache::pull('system_config_data');
|
return $this->error($e->getMessage());
|
||||||
return $this->success('更新成功', Cookie('__forward__'));
|
|
||||||
} else {
|
|
||||||
return $this->error('更新失败!');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->error('无更新数据!');
|
$this->data = ['info' => $config->getConfigDetail($this->request)];
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$info = array();
|
|
||||||
/* 获取数据 */
|
|
||||||
$info = ConfigM::find($id);
|
|
||||||
|
|
||||||
if (false === $info) {
|
|
||||||
return $this->error('获取配置信息错误');
|
|
||||||
}
|
|
||||||
$this->data = ['info' => $info];
|
|
||||||
return $this->fetch();
|
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 删除配置
|
* @title 删除配置
|
||||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
*/
|
*/
|
||||||
public function del() {
|
public function del(ConfigService $config) {
|
||||||
$id = $this->request->param('id');
|
try {
|
||||||
|
$config->deleteConfig($this->request);
|
||||||
if (empty($id)) {
|
|
||||||
return $this->error('请选择要操作的数据!');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = ConfigM::find($id)->delete();
|
|
||||||
if (false !== $result) {
|
|
||||||
Cache::pull('system_config_data');
|
Cache::pull('system_config_data');
|
||||||
return $this->success('删除成功');
|
return $this->success('删除成功');
|
||||||
} else {
|
} catch (\think\Exception $e) {
|
||||||
return $this->error('删除失败!');
|
return $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 主题选择
|
* @title 主题选择
|
||||||
*/
|
*/
|
||||||
public function themes(ConfigM $config) {
|
public function themes(ConfigService $config) {
|
||||||
$list = $config->getThemesList($this->request);
|
$list = $config->getThemesList($this->request);
|
||||||
$config = Cache::get('system_config_data');
|
$config = Cache::get('system_config_data');
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use app\model\Attribute;
|
use app\model\module\Attribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 内容管理
|
* @title 内容管理
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\model\Form as FormM;
|
use app\model\form\Form as FormM;
|
||||||
use app\model\FormAttr;
|
use app\model\form\FormAttr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 自定义表单
|
* @title 自定义表单
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\model\AuthGroup;
|
use app\model\auth\AuthGroup;
|
||||||
use app\model\AuthGroupAccess;
|
use app\model\auth\AuthGroupAccess;
|
||||||
use app\model\AuthRule;
|
use app\model\auth\AuthRule;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 用户组管理
|
* @title 用户组管理
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Link as LinkM;
|
use app\model\link\Link as LinkM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 友情链接
|
* @title 友情链接
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use sent\tree\Tree;
|
use sent\tree\Tree;
|
||||||
use app\model\Menu as MenuM;
|
use app\model\auth\Menu as MenuM;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Attribute;
|
use app\model\module\Attribute;
|
||||||
use app\model\Model as ModelM;
|
use app\model\module\Model as ModelM;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Rewrite;
|
use app\model\system\Rewrite;
|
||||||
use app\model\SeoRule;
|
use app\model\system\SeoRule;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use app\model\AuthGroup;
|
use app\model\auth\AuthGroup;
|
||||||
use app\model\AuthGroupAccess;
|
use app\model\auth\AuthGroupAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 用户管理
|
* @title 用户管理
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
namespace app\controller\admin;
|
namespace app\controller\admin;
|
||||||
|
|
||||||
use app\model\Wechat as WechatM;
|
use app\model\wechat\Wechat as WechatM;
|
||||||
use app\model\WechatPay;
|
use app\model\wechat\WechatPay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 微信模块
|
* @title 微信模块
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use app\model\Attach as AttachModel;
|
use app\model\system\Attach as AttachModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 附件管理
|
* @title 附件管理
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use app\model\Config as ConfigM;
|
use app\model\system\Config as ConfigM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 基础功能
|
* @title 基础功能
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\model\Category;
|
use app\model\module\Category;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use app\model\Attribute;
|
use app\model\module\Attribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 内容管理
|
* @title 内容管理
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use app\model\Department as DepartmentM;
|
use app\model\auth\Department as DepartmentM;
|
||||||
use app\model\Role;
|
use app\model\auth\Role;
|
||||||
use sent\tree\Tree;
|
use sent\tree\Tree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use \app\model\Form as FormModel;
|
use \app\model\form\Form as FormModel;
|
||||||
use \app\model\FormAttr;
|
use \app\model\form\FormAttr;
|
||||||
|
|
||||||
class Form extends Base {
|
class Form extends Base {
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use think\facade\Event;
|
use think\facade\Event;
|
||||||
use think\Request;
|
use think\Request;
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\api;
|
namespace app\controller\api;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use app\model\MemberLog;
|
use app\model\auth\MemberLog;
|
||||||
use app\model\Role;
|
use app\model\auth\Role;
|
||||||
use app\model\RoleAccess;
|
use app\model\auth\RoleAccess;
|
||||||
use xin\helper\Str;
|
use xin\helper\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
namespace app\controller\front;
|
namespace app\controller\front;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use \app\model\Category;
|
use \app\model\module\Category;
|
||||||
use \app\model\Model;
|
use \app\model\module\Model;
|
||||||
use \app\model\Content as ContentModel;
|
use \app\model\module\Content as ContentModel;
|
||||||
|
|
||||||
class Content extends Base {
|
class Content extends Base {
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
namespace app\controller\front;
|
namespace app\controller\front;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use \app\model\Form as FormModel;
|
use \app\model\form\Form as FormModel;
|
||||||
use \app\model\FormAttr;
|
use \app\model\form\FormAttr;
|
||||||
|
|
||||||
class Form extends Base {
|
class Form extends Base {
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\user;
|
namespace app\controller\user;
|
||||||
|
|
||||||
use app\model\Form;
|
use app\model\form\Form;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
namespace app\controller\user;
|
namespace app\controller\user;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\model\Model;
|
use app\model\module\Model;
|
||||||
use app\model\Attribute;
|
use app\model\module\Attribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 内容模块
|
* @title 内容模块
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\user;
|
namespace app\controller\user;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 表单管理
|
* @title 表单管理
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\user;
|
namespace app\controller\user;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\controller\user;
|
namespace app\controller\user;
|
||||||
|
|
||||||
use app\model\Member;
|
use app\model\auth\Member;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 用户管理
|
* @title 用户管理
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\middleware;
|
namespace app\http\middleware;
|
||||||
|
|
||||||
use app\model\MemberLog;
|
use app\model\auth\MemberLog;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,15 +21,11 @@ class Validate {
|
|||||||
//获取当前参数
|
//获取当前参数
|
||||||
$params = $request->param();
|
$params = $request->param();
|
||||||
//获取访问控制器
|
//获取访问控制器
|
||||||
if(\strripos($request->controller(), ".")){
|
$controller = strtr($request->controller(), '.', '\\');
|
||||||
$controller = explode(".", $request->controller());
|
|
||||||
}else{
|
|
||||||
$controller = ['', ucfirst($request->controller())];
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取操作名,用于验证场景scene
|
//获取操作名,用于验证场景scene
|
||||||
$scene = strtolower($controller[0]) . $request->action();
|
$scene = $request->action();
|
||||||
$validate = "app\\http\\validate\\" . ucfirst($controller[1]);
|
$validate = "\\app\\http\\validate\\" . $controller;
|
||||||
//仅当验证器存在时 进行校验
|
//仅当验证器存在时 进行校验
|
||||||
if (class_exists($validate) && $request->isPost()) {
|
if (class_exists($validate) && $request->isPost()) {
|
||||||
$v = new $validate;
|
$v = new $validate;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ class Ad extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title', 'name'],
|
'add' => ['title', 'name'],
|
||||||
'adminedit' => ['title', 'name'],
|
'edit' => ['title', 'name'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class Category extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title', 'model_id'],
|
'add' => ['title', 'model_id'],
|
||||||
'adminedit' => ['title', 'model_id'],
|
'edit' => ['title', 'model_id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Channel extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title'],
|
'add' => ['title'],
|
||||||
'adminedit' => ['title'],
|
'edit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -15,22 +15,23 @@ use think\Validate;
|
|||||||
*/
|
*/
|
||||||
class Config extends Validate{
|
class Config extends Validate{
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'name' => 'require|unique:config',
|
'name' => 'require|unique:config|alphaDash',
|
||||||
'title' => 'require',
|
'title' => 'require',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
'name.require' => '配置标识必须',
|
'name.require' => '配置标识必须',
|
||||||
'name.unique' => '配置标识已存在',
|
'name.unique' => '配置标识已存在',
|
||||||
|
'name.alphaDash' => '配置标识格式错误',
|
||||||
'title.require' => '配置标题必须',
|
'title.require' => '配置标题必须',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title', 'name'],
|
'add' => ['title', 'name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
// edit 验证场景定义
|
// edit 验证场景定义
|
||||||
public function sceneAdminedit() {
|
public function sceneEdit() {
|
||||||
return $this->only([['title', 'name']])
|
return $this->only([['title', 'name']])
|
||||||
->remove('name', 'unique');
|
->remove('name', 'unique');
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
@@ -50,8 +50,8 @@ class Content extends Validate{
|
|||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
|
|
||||||
$this->scene = [
|
$this->scene = [
|
||||||
'adminadd' => $field,
|
'add' => $field,
|
||||||
'adminedit' => $field,
|
'edit' => $field,
|
||||||
'useradd' => $field,
|
'useradd' => $field,
|
||||||
'useredit' => $field,
|
'useredit' => $field,
|
||||||
];
|
];
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ class Link extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title', 'url'],
|
'add' => ['title', 'url'],
|
||||||
'adminedit' => ['title', 'url'],
|
'edit' => ['title', 'url'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Menu extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title'],
|
'add' => ['title'],
|
||||||
'adminedit' => ['title'],
|
'edit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class Model extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['title', 'name'],
|
'add' => ['title', 'name'],
|
||||||
'adminedit' => ['title'],
|
'edit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\admin;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
use app\model\Member;
|
use app\model\Member;
|
||||||
@@ -39,9 +39,9 @@ class User extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'adminadd' => ['username', 'email', 'password', 'repassword'],
|
'add' => ['username', 'email', 'password', 'repassword'],
|
||||||
'adminedit' => ['username', 'email'],
|
'edit' => ['username', 'email'],
|
||||||
'admineditpwd' => ['uid', 'password', 'repassword', 'oldpassword']
|
'editpwd' => ['uid', 'password', 'repassword', 'oldpassword']
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function checkOldpaswd($value, $rule, $data){
|
protected function checkOldpaswd($value, $rule, $data){
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate;
|
namespace app\http\validate\api;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
use app\model\Member;
|
use app\model\Member;
|
||||||
@@ -28,6 +28,6 @@ class Login extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'apiindex' => ['username', 'password'],
|
'index' => ['username', 'password'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分类模型
|
|
||||||
*/
|
|
||||||
class ActionLog {
|
|
||||||
|
|
||||||
protected function getModelIdAttr($value, $data) {
|
|
||||||
$value = get_document_field($data['model'], "name", "id");
|
|
||||||
return $value ? $value : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\addons;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use app\facade\Cache;
|
use app\facade\Cache;
|
||||||
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\addons;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类模型
|
* 分类模型
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\ads;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类模型
|
* 分类模型
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\ads;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类模型
|
* 分类模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\auth;
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\auth;
|
||||||
|
|
||||||
use sent\jwt\facade\JWTAuth;
|
use sent\jwt\facade\JWTAuth;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use xin\helper\Server;
|
use xin\helper\Server;
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单模型类
|
* 菜单模型类
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色模型
|
* 角色模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\auth;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色模型
|
* 角色模型
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\client;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client模型
|
* Client模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\form;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义表单模型
|
* 自定义表单模型
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\form;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\form;
|
||||||
|
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 友情链接类
|
* 友情链接类
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\module;
|
||||||
|
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\module;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置模型
|
* 设置模型
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\module;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\module;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置模型
|
* 设置模型
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\system;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件模型
|
* 附件模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\system;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置模型
|
* 设置模型
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\system;
|
||||||
|
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
@@ -82,35 +82,4 @@ class Config extends Model {
|
|||||||
}
|
}
|
||||||
return $data;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\model;
|
namespace app\model\system;
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\system;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 伪静态
|
* 伪静态
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\system;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户模型
|
* 用户模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\wechat;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信模型
|
* 微信模型
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\model\wechat;
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信模型
|
* 微信模型
|
||||||
27
app/provider/ModuleProviderService.php
Normal file
27
app/provider/ModuleProviderService.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
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(){
|
||||||
|
// 服务启动
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use app\AppService;
|
use app\AppService;
|
||||||
|
use app\provider\ModuleProviderService;
|
||||||
|
|
||||||
// 系统服务定义文件
|
// 系统服务定义文件
|
||||||
// 服务在完成全局初始化之后执行
|
// 服务在完成全局初始化之后执行
|
||||||
return [
|
return [
|
||||||
AppService::class,
|
AppService::class,
|
||||||
|
ModuleProviderService::class
|
||||||
];
|
];
|
||||||
29
app/services/AdService.php
Normal file
29
app/services/AdService.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
app/services/module/ContentService.php
Normal file
16
app/services/module/ContentService.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\services\module;
|
||||||
|
|
||||||
|
class ContentService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
}
|
||||||
46
app/services/module/ModuleService.php
Normal file
46
app/services/module/ModuleService.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
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']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
162
app/services/system/ConfigService.php
Normal file
162
app/services/system/ConfigService.php
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/services/system/RewriteService.php
Normal file
33
app/services/system/RewriteService.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,7 +42,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist"
|
"preferred-install": "dist",
|
||||||
|
"allow-plugins": {
|
||||||
|
"easywechat-composer/easywechat-composer": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-autoload-dump": [
|
"post-autoload-dump": [
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Sent extends \think\template\TagLib {
|
|||||||
$pid = isset($tag['pid']) ? $tag['pid'] : '';
|
$pid = isset($tag['pid']) ? $tag['pid'] : '';
|
||||||
$tree = isset($tag['tree']) ? $tag['tree'] : false;
|
$tree = isset($tag['tree']) ? $tag['tree'] : false;
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__NAV__ = \\app\\model\\Channel::getChannelList('.$type.', "'.$pid.'", '.$tree.');';
|
$parse .= '$__NAV__ = \\app\\model\\system\\Channel::getChannelList('.$type.', "'.$pid.'", '.$tree.');';
|
||||||
$parse .= 'foreach ($__NAV__ as $key => $'.$tag['name'].') {';
|
$parse .= 'foreach ($__NAV__ as $key => $'.$tag['name'].') {';
|
||||||
$parse .= '?>';
|
$parse .= '?>';
|
||||||
$parse .= $content;
|
$parse .= $content;
|
||||||
@@ -44,7 +44,7 @@ class Sent extends \think\template\TagLib {
|
|||||||
$name = isset($tag['name']) ? $tag['name'] : 'item';
|
$name = isset($tag['name']) ? $tag['name'] : 'item';
|
||||||
|
|
||||||
$parse = $parse = '<?php ';
|
$parse = $parse = '<?php ';
|
||||||
$parse .= '$__LIST__ = \\app\\model\\Document::getDocumentList("'.$model.'", '.$cid.', '.$limit.', "'.$order.'", "'.$field.'");';
|
$parse .= '$__LIST__ = \\app\\model\\module\\Document::getDocumentList("'.$model.'", '.$cid.', '.$limit.', "'.$order.'", "'.$field.'");';
|
||||||
$parse .= 'foreach ($__LIST__ as $key => $'.$name.') {';
|
$parse .= 'foreach ($__LIST__ as $key => $'.$name.') {';
|
||||||
$parse .= '?>';
|
$parse .= '?>';
|
||||||
$parse .= $content;
|
$parse .= $content;
|
||||||
@@ -66,7 +66,7 @@ class Sent extends \think\template\TagLib {
|
|||||||
$map = implode(" and ", $where);
|
$map = implode(" and ", $where);
|
||||||
|
|
||||||
$parse = $parse = '<?php ';
|
$parse = $parse = '<?php ';
|
||||||
$parse .= '$__LIST__ = \\app\\model\\Link::where(\''.$map.'\')->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 .= 'foreach ($__LIST__ as $key => $'.$tag['name'].') {';
|
||||||
$parse .= '?>';
|
$parse .= '?>';
|
||||||
$parse .= $content;
|
$parse .= $content;
|
||||||
|
|||||||
BIN
qrcode.png
BIN
qrcode.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB |
@@ -9,43 +9,13 @@
|
|||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
use think\facade\Cache;
|
use app\services\module\ModuleService;
|
||||||
use app\model\Model;
|
use app\services\system\RewriteService;
|
||||||
use app\model\Rewrite;
|
|
||||||
use app\http\middleware\Validate;
|
use app\http\middleware\Validate;
|
||||||
use app\http\middleware\Admin;
|
use app\http\middleware\Admin;
|
||||||
|
|
||||||
$model = Cache::get('model_list');
|
app()->make(ModuleService::class)->registerRoute(); //注册模型路由
|
||||||
if (!$model) {
|
app()->make(RewriteService::class)->registerRoute(); //后台伪静态设置路由注册
|
||||||
$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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Route::rule('/', 'front.Index/index');
|
Route::rule('/', 'front.Index/index');
|
||||||
Route::rule('search', 'front.Content/search');
|
Route::rule('search', 'front.Content/search');
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<li {if !$group_id}class="active"{/if}><a href="{:url('/admin/config/index')}">全部</a></li>
|
<li {if !$group_id}class="active"{/if}><a href="{:url('/admin/config/index')}">全部</a></li>
|
||||||
{volist name="config['config_group_list']" id="item"}
|
{volist name="config['config_group_list']" id="item"}
|
||||||
<li {if $group_id == $item['key']}class="active"{/if}>
|
<li {if $group_id == $item['key']}class="active"{/if}>
|
||||||
<a href="{:url('/admin/config/index?group='.$item['key'])}">{$item['label']}</a>
|
<a href="{:url('/admin/config/index', ['group' => $item['key']])}">{$item['label']}</a>
|
||||||
</li>
|
</li>
|
||||||
{/volist}
|
{/volist}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user