重新初始化
3
.gitignore
vendored
@@ -1,7 +1,6 @@
|
||||
/.idea
|
||||
/.vscode
|
||||
/vendor
|
||||
/bak
|
||||
*.log
|
||||
.env
|
||||
composer.lock
|
||||
/bak
|
||||
@@ -1 +0,0 @@
|
||||
TzgPD8IY5E1NHr8OULQ1C8oa7JVcwFN2_EV63tIvwS0.lYKSCNSGMW2kUAc3EbJC-_xwotlXoGrdI97TjuZIJto
|
||||
26
404.html
@@ -1,26 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>404</title>
|
||||
<style>
|
||||
body{
|
||||
background-color:#444;
|
||||
font-size:14px;
|
||||
}
|
||||
h3{
|
||||
font-size:60px;
|
||||
color:#eee;
|
||||
text-align:center;
|
||||
padding-top:30px;
|
||||
font-weight:normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>404,您请求的文件不存在!</h3>
|
||||
</body>
|
||||
</html>
|
||||
@@ -21,7 +21,7 @@ ThinkPHP 6.0
|
||||
## 安装
|
||||
|
||||
~~~
|
||||
composer create-project topthink/think tp 6.0.*-dev
|
||||
composer create-project topthink/think tp 6.0.*
|
||||
~~~
|
||||
|
||||
如果需要更新框架使用
|
||||
@@ -43,7 +43,7 @@ ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
|
||||
|
||||
本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
||||
|
||||
版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn)
|
||||
版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
|
||||
|
||||
All rights reserved。
|
||||
|
||||
|
||||
22
app/AppService.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\Service;
|
||||
|
||||
/**
|
||||
* 应用服务类
|
||||
*/
|
||||
class AppService extends Service
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
// 服务注册
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
// 服务启动
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ abstract class BaseController
|
||||
} else {
|
||||
if (strpos($validate, '.')) {
|
||||
// 支持场景
|
||||
list($validate, $scene) = explode('.', $validate);
|
||||
[$validate, $scene] = explode('.', $validate);
|
||||
}
|
||||
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
|
||||
$v = new $class();
|
||||
|
||||
1165
app/common.php
@@ -8,140 +8,33 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use sent\auth\Auth;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Config;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* @title 后端公共模块
|
||||
*/
|
||||
class Admin extends BaseController {
|
||||
class Admin extends Base {
|
||||
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
protected $tpl_config = [
|
||||
'tpl_replace_string' => [
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
'__css__' => '/static/admin/css',
|
||||
'__js__' => '/static/admin/js',
|
||||
'__public__' => '/static/admin',
|
||||
],
|
||||
];
|
||||
|
||||
protected $middleware = [
|
||||
'\app\http\middleware\Validate',
|
||||
'\app\http\middleware\Admin',
|
||||
];
|
||||
|
||||
protected $data = ['data' => [], 'code' => 0, 'msg' => ''];
|
||||
|
||||
protected function initialize() {
|
||||
$config = Cache::get('system_config');
|
||||
if (!$config) {
|
||||
$config = (new \app\model\Config())->lists();
|
||||
Cache::set('system_config', $config);
|
||||
}
|
||||
$this->data['config'] = $config;
|
||||
}
|
||||
|
||||
protected function success($msg, $url = '') {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
protected function error($msg, $url = '') {
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权配置
|
||||
* @param [type] $request [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
protected function auth($request) {
|
||||
// 是否是超级管理员
|
||||
define('IS_ROOT', is_administrator());
|
||||
if (!IS_ROOT && Config::get('admin_allow_ip')) {
|
||||
// 检查IP地址访问
|
||||
if (!in_array(get_client_ip(), explode(',', Config::get('admin_allow_ip')))) {
|
||||
$this->error('403:禁止访问');
|
||||
}
|
||||
}
|
||||
|
||||
// 检测系统权限
|
||||
if (!IS_ROOT) {
|
||||
$access = $this->accessControl();
|
||||
if (false === $access) {
|
||||
$this->error('403:禁止访问');
|
||||
} elseif (null === $access) {
|
||||
$dynamic = $this->checkDynamic(); //检测分类栏目有关的各项动态权限
|
||||
if ($dynamic === null) {
|
||||
//检测访问权限
|
||||
if (!$this->checkRule($this->url_path, array('in', '1,2'))) {
|
||||
$this->error('未授权访问!');
|
||||
} else {
|
||||
// 检测分类及内容有关的各项动态权限
|
||||
$dynamic = $this->checkDynamic();
|
||||
if (false === $dynamic) {
|
||||
$this->error('未授权访问!');
|
||||
}
|
||||
}
|
||||
} elseif ($dynamic === false) {
|
||||
$this->error('未授权访问!');
|
||||
}
|
||||
}
|
||||
Db::name('config')->select();
|
||||
if (!is_login() and !in_array($this->request->url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
||||
$this->redirect('admin/index/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限检测
|
||||
* @param string $rule 检测的规则
|
||||
* @param string $mode check模式
|
||||
* @return boolean
|
||||
* @author 朱亚杰 <xcoolcc@gmail.com>
|
||||
*/
|
||||
final protected function checkRule($rule, $type = AuthRule::rule_url, $mode = 'url') {
|
||||
static $Auth = null;
|
||||
if (!$Auth) {
|
||||
$Auth = new Auth();
|
||||
}
|
||||
if (!$Auth->check($rule, session('user_auth.uid'), $type, $mode)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否是需要动态判断的权限
|
||||
* @return boolean|null
|
||||
* 返回true则表示当前访问有权限
|
||||
* 返回false则表示当前访问无权限
|
||||
* 返回null,则表示权限不明
|
||||
*
|
||||
* @author 朱亚杰 <xcoolcc@gmail.com>
|
||||
*/
|
||||
protected function checkDynamic() {
|
||||
if (IS_ROOT) {
|
||||
return true; //管理员允许访问任何页面
|
||||
}
|
||||
return null; //不明,需checkRule
|
||||
}
|
||||
|
||||
/**
|
||||
* action访问控制,在 **登陆成功** 后执行的第一项权限检测任务
|
||||
*
|
||||
* @return boolean|null 返回值必须使用 `===` 进行判断
|
||||
*
|
||||
* 返回 **false**, 不允许任何人访问(超管除外)
|
||||
* 返回 **true**, 允许任何管理员访问,无需执行节点权限检测
|
||||
* 返回 **null**, 需要继续执行节点权限检测决定是否允许访问
|
||||
* @author 朱亚杰 <xcoolcc@gmail.com>
|
||||
*/
|
||||
final protected function accessControl() {
|
||||
$allow = Config::get('allow_visit');
|
||||
$deny = Config::get('deny_visit');
|
||||
$check = strtolower($this->request->controller() . '/' . $this->request->action());
|
||||
if (!empty($deny) && in_array_case($check, $deny)) {
|
||||
return false; //非超管禁止访问deny中的方法
|
||||
}
|
||||
if (!empty($allow) && in_array_case($check, $allow)) {
|
||||
return true;
|
||||
}
|
||||
return null; //需要检测节点权限
|
||||
}
|
||||
}
|
||||
}
|
||||
37
app/controller/Base.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use think\facade\View;
|
||||
|
||||
class Base extends BaseController {
|
||||
|
||||
use \liliuwei\think\Jump;
|
||||
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
protected $tpl_config = [
|
||||
'view_dir_name' => 'public' . DIRECTORY_SEPARATOR . 'template',
|
||||
'tpl_replace_string' => [
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/front/images',
|
||||
'__css__' => '/static/front/css',
|
||||
'__js__' => '/static/front/js',
|
||||
'__public__' => '/static/front',
|
||||
],
|
||||
];
|
||||
|
||||
public $data = []; //渲染数据
|
||||
|
||||
protected function fetch($template = '') {
|
||||
View::config($this->tpl_config);
|
||||
View::assign($this->data);
|
||||
View::fetch($template);
|
||||
}
|
||||
}
|
||||
12
app/model/Link.php → app/controller/Front.php
Executable file → Normal file
@@ -6,10 +6,10 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model;
|
||||
namespace app\controller;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Link extends Model {
|
||||
|
||||
}
|
||||
class Front extends Base {
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use app\BaseController;
|
||||
|
||||
class Index extends BaseController {
|
||||
|
||||
protected $middleware = ['\app\http\middleware\Front'];
|
||||
|
||||
public function weixin(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 网站首页
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 搜索页
|
||||
*/
|
||||
public function search() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 专题页
|
||||
*/
|
||||
public function topic() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 模型数据列表
|
||||
*/
|
||||
public function lists() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 栏目数据列表
|
||||
*/
|
||||
public function category() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 模型数据详情
|
||||
*/
|
||||
public function detail() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 未知页面调整到此方法
|
||||
*/
|
||||
public function miss() {
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class Action extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\model\AdPlace;
|
||||
use app\model\Ad as AdModel;
|
||||
|
||||
class Ad extends Admin{
|
||||
|
||||
/**
|
||||
* @title 广告位列表
|
||||
*/
|
||||
public function index(AdPlace $adp){
|
||||
if ($this->request->isAjax()) {
|
||||
$param = $this->request->param();
|
||||
$res = $adp->paginate($this->request->pageConfig);
|
||||
|
||||
$data = $res->append(['show_type_text', 'status_text'])->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加广告位
|
||||
*/
|
||||
public function add(AdPlace $adp){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $adp->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/ad/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'show_type' => $adp->show_type,
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑广告位
|
||||
*/
|
||||
public function edit(AdPlace $adp){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $adp->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/ad/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $adp->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'show_type' => $adp->show_type,
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除广告位
|
||||
*/
|
||||
public function del(AdPlace $adp){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $adp->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 广告列表
|
||||
*/
|
||||
public function lists(AdModel $ad){
|
||||
if ($this->request->isAjax()) {
|
||||
$res = $ad->paginate($this->request->pageConfig);
|
||||
$data = $res->append(['cover','status_text'])->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加广告
|
||||
*/
|
||||
public function addad(AdModel $ad){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $ad->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/ad/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑广告
|
||||
*/
|
||||
public function editad(AdModel $ad){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $ad->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/ad/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $ad->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "addad";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除广告
|
||||
*/
|
||||
public function delad(AdModel $ad){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $ad->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class Addons extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 钩子列表
|
||||
*/
|
||||
public function hooks(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\Model\Category as CategoryModel;
|
||||
|
||||
class Category extends Admin{
|
||||
|
||||
/**
|
||||
* @title 栏目列表
|
||||
*/
|
||||
public function index(CategoryModel $category){
|
||||
if($this->request->isAjax()){
|
||||
$tree = $this->request->param('tree', 0);
|
||||
$map = array();
|
||||
|
||||
$res = $category->where($map)->order('sort asc, id asc')->select();
|
||||
|
||||
$list = $res->toArray();
|
||||
if($tree){
|
||||
if (!empty($list)) {
|
||||
$tree = new \com\Tree();
|
||||
$list = $tree->toFormatTree($list);
|
||||
}
|
||||
}
|
||||
$this->data['data'] = $list;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加栏目
|
||||
*/
|
||||
public function add(CategoryModel $category){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $category->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/category/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑栏目
|
||||
*/
|
||||
public function edit(CategoryModel $category){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $category->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/category/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $category->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除栏目
|
||||
*/
|
||||
public function del(CategoryModel $category){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $category->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\Model\Channel as ChannelModel;
|
||||
|
||||
class Channel extends Admin{
|
||||
/**
|
||||
* @title 频道列表
|
||||
*/
|
||||
public function index(ChannelModel $channel){
|
||||
if($this->request->isAjax()){
|
||||
$tree = $this->request->param('tree', 0);
|
||||
$type = $this->request->param('type', 0);
|
||||
$map = array();
|
||||
|
||||
if($type){
|
||||
$map['type'] = $type;
|
||||
}
|
||||
|
||||
$res = $channel->where($map)->order('sort asc, id asc')->select();
|
||||
|
||||
$list = $res->toArray();
|
||||
if($tree){
|
||||
if (!empty($list)) {
|
||||
$tree = new \com\Tree();
|
||||
$list = $tree->toFormatTree($list);
|
||||
}
|
||||
}
|
||||
$this->data['data'] = $list;
|
||||
return $this->data;
|
||||
}else{
|
||||
$this->data['data'] = array(
|
||||
'type' => $this->request->param('type', 0),
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加频道
|
||||
*/
|
||||
public function add(ChannelModel $channel){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $channel->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/channel/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑频道
|
||||
*/
|
||||
public function edit(ChannelModel $channel){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $channel->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/channel/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $channel->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除频道
|
||||
*/
|
||||
public function del(ChannelModel $channel){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $channel->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use think\facade\Db;
|
||||
|
||||
use app\model\Client as ClientModel;
|
||||
|
||||
class Client extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(ClientModel $client){
|
||||
if ($this->request->isAjax()) {
|
||||
$param = $this->request->param();
|
||||
$res = $client->paginate($this->request->pageConfig);
|
||||
$data = $res->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加客户端
|
||||
*/
|
||||
public function add(ClientModel $client){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $client->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/client/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑客户端
|
||||
*/
|
||||
public function edit(ClientModel $client){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $client->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/client/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $client->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除客户端
|
||||
*/
|
||||
public function del(ClientModel $client){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $client->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\model\Config as ConfigModel;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Config extends Admin {
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(ConfigModel $config) {
|
||||
if($this->request->isAjax()){
|
||||
$param = $this->request->param();
|
||||
$group = input('group', 0, 'trim');
|
||||
$name = input('name', '', 'trim');
|
||||
$system_config = Cache::get('system_config');
|
||||
|
||||
/* 查询条件初始化 */
|
||||
$map = array('status' => 1);
|
||||
if ($group) {
|
||||
$map['group'] = $group;
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
$map['name'] = array('like', '%' . $name . '%');
|
||||
}
|
||||
|
||||
$res = $config->where($map)->order('id desc')->paginate($this->request->pageConfig);
|
||||
|
||||
$data = $res->append(['type_text','group_text'])->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}else{
|
||||
$data = array(
|
||||
'group_id' => $this->request->get('group', 0),
|
||||
);
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function group(ConfigModel $config) {
|
||||
if ($this->request->isAjax()) {
|
||||
$data = $this->request->param();
|
||||
$result = $config->updateConfig($data);
|
||||
|
||||
if (false !== $result) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = "更新成功!";
|
||||
}else{
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = $config->error;
|
||||
}
|
||||
return $this->data;
|
||||
} else {
|
||||
$id = $this->request->param('id', 1);
|
||||
$res = $config->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select();
|
||||
|
||||
$list = $res->toArray();
|
||||
$this->data['data'] = array('list' => $list, 'id' => $id);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 新增配置
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
public function add(ConfigModel $config) {
|
||||
if ($this->request->isPost()) {
|
||||
$config = model('Config');
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$id = $config->validate(true)->save($data);
|
||||
if ($id) {
|
||||
cache('db_config_data', null);
|
||||
//记录行为
|
||||
action_log('update_config', 'config', $id, session('user_auth.uid'));
|
||||
return $this->success('新增成功', url('index'));
|
||||
} else {
|
||||
return $this->error('新增失败');
|
||||
}
|
||||
} else {
|
||||
return $this->error($config->getError());
|
||||
}
|
||||
} else {
|
||||
$this->data['data'] = array('info' => array());
|
||||
$this->data['template'] = "edit";
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑配置
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
public function edit(ConfigModel $config) {
|
||||
if ($this->request->isPost()) {
|
||||
$config = model('Config');
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$result = $config->validate('Config.edit')->save($data, array('id' => $data['id']));
|
||||
if (false !== $result) {
|
||||
cache('db_config_data', null);
|
||||
//记录行为
|
||||
action_log('update_config', 'config', $data['id'], session('user_auth.uid'));
|
||||
return $this->success('更新成功', Cookie('__forward__'));
|
||||
} else {
|
||||
return $this->error($config->getError(), '');
|
||||
}
|
||||
} else {
|
||||
return $this->error($config->getError());
|
||||
}
|
||||
} else {
|
||||
$id = $this->request->param('id', 0);
|
||||
if (!$id) {
|
||||
$this->data['msg'] = "非法操作!";
|
||||
return $this->data;
|
||||
}
|
||||
$info = array();
|
||||
/* 获取数据 */
|
||||
$info = $config->field(true)->find($id);
|
||||
|
||||
if (false === $info) {
|
||||
return $this->error('获取配置信息错误');
|
||||
}
|
||||
$this->data['data'] = array(
|
||||
'info' => $info,
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @title 批量保存配置
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
public function save($config) {
|
||||
if ($config && is_array($config)) {
|
||||
$Config = db('Config');
|
||||
foreach ($config as $name => $value) {
|
||||
$map = array('name' => $name);
|
||||
$Config->where($map)->setField('value', $value);
|
||||
}
|
||||
}
|
||||
cache('db_config_data', null);
|
||||
return $this->success('保存成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除配置
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
public function del() {
|
||||
$id = array_unique((array) input('id', 0));
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->error('请选择要操作的数据!');
|
||||
}
|
||||
|
||||
$map = array('id' => array('in', $id));
|
||||
if (db('Config')->where($map)->delete()) {
|
||||
cache('DB_CONFIG_DATA', null);
|
||||
//记录行为
|
||||
action_log('update_config', 'config', $id, session('user_auth.uid'));
|
||||
return $this->success('删除成功');
|
||||
} else {
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 配置排序
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function sort() {
|
||||
if ($this->request->isGet()) {
|
||||
$ids = input('ids');
|
||||
//获取排序的数据
|
||||
$map = array('status' => array('gt', -1));
|
||||
if (!empty($ids)) {
|
||||
$map['id'] = array('in', $ids);
|
||||
} elseif (input('group')) {
|
||||
$map['group'] = input('group');
|
||||
}
|
||||
$list = db('Config')->where($map)->field('id,title')->order('sort asc,id asc')->select();
|
||||
|
||||
$this->assign('list', $list);
|
||||
$this->setMeta('配置排序');
|
||||
return $this->fetch();
|
||||
} elseif ($this->request->isPost()) {
|
||||
$ids = input('post.ids');
|
||||
$ids = explode(',', $ids);
|
||||
foreach ($ids as $key => $value) {
|
||||
$res = db('Config')->where(array('id' => $value))->setField('sort', $key + 1);
|
||||
}
|
||||
if ($res !== false) {
|
||||
return $this->success('排序成功!', Cookie('__forward__'));
|
||||
} else {
|
||||
return $this->error('排序失败!');
|
||||
}
|
||||
} else {
|
||||
return $this->error('非法请求!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 主题选择
|
||||
*/
|
||||
public function themes(ConfigModel $config) {
|
||||
if ($this->request->isPost()) {
|
||||
$result = $config->where('name', $name . '_themes')->setField('value', $id);
|
||||
if (false !== $result) {
|
||||
\think\Cache::clear();
|
||||
return $this->success('设置成功!');
|
||||
}else{
|
||||
return $this->error('设置失败!');
|
||||
}
|
||||
}else{
|
||||
$list = $config->getThemesList();
|
||||
$this->data['data'] = array(
|
||||
'pc' => $this->data['config']['pc_themes'],
|
||||
'mobile' => $this->data['config']['mobile_themes'],
|
||||
'list' => $list,
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Content extends Admin{
|
||||
|
||||
/**
|
||||
* @title 内容列表页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 内容添加
|
||||
*/
|
||||
public function add(){
|
||||
if ($this->request->isAjax()) {
|
||||
$result = false;
|
||||
if (false !== $result) {
|
||||
return $this->success();
|
||||
}else{
|
||||
return $this->error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use think\facade\Db;
|
||||
|
||||
class Database extends Admin{
|
||||
|
||||
/**
|
||||
* @title 数据备份
|
||||
*/
|
||||
public function export(){
|
||||
$list = Db::query('SHOW TABLE STATUS');
|
||||
$list = array_map('array_change_key_case', $list);
|
||||
|
||||
$this->data['data'] = array(
|
||||
'list' => $list
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
/**
|
||||
* @title 数据导入
|
||||
*/
|
||||
public function import(){
|
||||
//列出备份文件列表
|
||||
$path = app()->getRuntimePath() . 'backup';
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
$path = realpath($path);
|
||||
$flag = \FilesystemIterator::KEY_AS_FILENAME;
|
||||
$glob = new \FilesystemIterator($path, $flag);
|
||||
|
||||
$list = array();
|
||||
foreach ($glob as $name => $file) {
|
||||
if (preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)) {
|
||||
$name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
|
||||
|
||||
$date = "{$name[0]}-{$name[1]}-{$name[2]}";
|
||||
$time = "{$name[3]}:{$name[4]}:{$name[5]}";
|
||||
$part = $name[6];
|
||||
|
||||
if (isset($list["{$date} {$time}"])) {
|
||||
$info = $list["{$date} {$time}"];
|
||||
$info['part'] = max($info['part'], $part);
|
||||
$info['size'] = $info['size'] + $file->getSize();
|
||||
} else {
|
||||
$info['part'] = $part;
|
||||
$info['size'] = $file->getSize();
|
||||
}
|
||||
$extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
|
||||
$info['compress'] = ($extension === 'SQL') ? '-' : $extension;
|
||||
$info['time'] = strtotime("{$date} {$time}");
|
||||
|
||||
$list["{$date} {$time}"] = $info;
|
||||
}
|
||||
}
|
||||
$this->data['data'] = array(
|
||||
'list' => $list
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
use app\model\Form as FormModel;
|
||||
|
||||
class Form extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(FormModel $form){
|
||||
if ($this->request->isAjax()) {
|
||||
$res = $form->paginate($this->request->pageConfig);
|
||||
$data = $res->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加客户端
|
||||
*/
|
||||
public function add(FormModel $form){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $form->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/form/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑客户端
|
||||
*/
|
||||
public function edit(FormModel $form){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $form->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/form/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $form->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除客户端
|
||||
*/
|
||||
public function del(FormModel $form){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $form->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class Group extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
if ($this->request->isAjax()) {
|
||||
# code...
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 权限列表
|
||||
*/
|
||||
public function access(){
|
||||
if ($this->request->isAjax()) {
|
||||
# code...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,6 @@
|
||||
namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\model\Menu;
|
||||
use think\facade\Session;
|
||||
|
||||
/**
|
||||
* @title 后端公共模块
|
||||
@@ -18,75 +16,26 @@ use think\facade\Session;
|
||||
class Index extends Admin {
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
* @title 后台首页
|
||||
* @return html [description]
|
||||
*/
|
||||
public function index(Menu $menu) {
|
||||
$this->data['data'] = array('menu' => $menu->getAuthMenuList($this->request));
|
||||
return $this->data;
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function dashboard() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 更新缓存
|
||||
*/
|
||||
public function clear() {
|
||||
if ($this->request->isAjax()) {
|
||||
$root = app()->getRootPath() . 'runtime/';
|
||||
$this->delDirAndFile($root);
|
||||
return $this->success('更新成功!');
|
||||
}
|
||||
}
|
||||
|
||||
/** 递归删除文件
|
||||
* @param $dirName
|
||||
* @param bool $subdir
|
||||
*/
|
||||
protected function delDirAndFile($dirName) {
|
||||
$list = glob($dirName . '*');
|
||||
foreach ($list as $file) {
|
||||
if (is_dir($file)) {
|
||||
$this->delDirAndFile($file . '/');
|
||||
} else {
|
||||
@unlink($file);
|
||||
}
|
||||
|
||||
}
|
||||
@rmdir($dirName);
|
||||
}
|
||||
/**
|
||||
* @title 后台登录
|
||||
* @return html [description]
|
||||
*/
|
||||
public function login(\app\model\Member $member) {
|
||||
if ($this->request->isAjax()) {
|
||||
$username = $this->request->param('username', '');
|
||||
$password = $this->request->param('password', '');
|
||||
$user = $member->login($username, $password);
|
||||
if ($user) {
|
||||
Session::set('user', $user);
|
||||
$this->data['url'] = "/admin/index/index.html";
|
||||
$this->data['msg'] = "登录成功!";
|
||||
} else {
|
||||
Session::set('user', null);
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = "登录失败!";
|
||||
}
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
public function login() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 后台登出
|
||||
* @title 后台退出
|
||||
* @return html [description]
|
||||
*/
|
||||
public function logout() {
|
||||
Session::set('user', null);
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = "成功退出!";
|
||||
return $this->data;
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
use app\model\Link as LinkModel;
|
||||
|
||||
class Link extends Admin{
|
||||
|
||||
/**
|
||||
* @title 友链列表
|
||||
*/
|
||||
public function index(LinkModel $link){
|
||||
if ($this->request->isAjax()) {
|
||||
$res = $link->paginate($this->request->pageConfig);
|
||||
$data = $res->toArray();
|
||||
$this->data['data'] = $data;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加友链
|
||||
*/
|
||||
public function add(LinkModel $link){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
$result = $link->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('/admin/link/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑友链
|
||||
*/
|
||||
public function edit(LinkModel $link){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (!isset($data['id']) || !$data['id']) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
|
||||
$result = $link->exists(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('修改成功', url('/admin/link/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $link->where('id', $this->request->param('id'))->find();
|
||||
$this->data['template'] = "add";
|
||||
$this->data['data'] = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除友链
|
||||
*/
|
||||
public function del(LinkModel $link){
|
||||
$ids = $this->request->param('ids', 0);
|
||||
if(!$ids){
|
||||
return $this->error('非法操作!');
|
||||
}else{
|
||||
$ids = \explode(",", $ids);
|
||||
}
|
||||
$result = $link->where('id', 'IN', $ids)->delete();
|
||||
|
||||
if(false !== $result){
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\Model\Menu as MenuModel;
|
||||
|
||||
class Menu extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
if($this->request->isAjax()){
|
||||
$tree = $this->request->param('tree', 0);
|
||||
$menu = new MenuModel();
|
||||
$map = array();
|
||||
|
||||
$res = $menu->where($map)->order('sort asc, id asc')->select();
|
||||
|
||||
$list = $res->toArray();
|
||||
if($tree){
|
||||
if (!empty($list)) {
|
||||
$tree = new \com\Tree();
|
||||
$list = $tree->toFormatTree($list);
|
||||
}
|
||||
}
|
||||
$this->data['data'] = $list;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$menu = new MenuModel();
|
||||
if($this->request->isAjax()){
|
||||
$data = $this->request->post();
|
||||
|
||||
$result = $menu->where('id', $data['id'])->save($data);
|
||||
if (false !== $result) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = '更新成功!';
|
||||
}else{
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = '更新失败!';
|
||||
}
|
||||
return $this->data;
|
||||
}else{
|
||||
$id = $this->request->param('id', 0);
|
||||
|
||||
if (!$id) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
$info = $menu->where('id', $id)->find();
|
||||
|
||||
$this->data['data'] = array('info'=>$info);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加菜单
|
||||
*/
|
||||
public function add(){
|
||||
if($this->request->isAjax()){
|
||||
return $this->data;
|
||||
}else{
|
||||
$this->data['template'] = 'edit';
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 移除菜单
|
||||
*/
|
||||
public function remove(){
|
||||
if($this->request->isAjax()){
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class Model extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\model\Rewrite;
|
||||
use app\model\SeoRule;
|
||||
|
||||
class Seo extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(SeoRule $seo){
|
||||
if($this->request->isAjax()){
|
||||
//读取规则列表
|
||||
$map = array('status' => array('=', 0));
|
||||
|
||||
$res = $seo->where($map)->order('sort asc')->paginate($this->request->pageConfig);
|
||||
|
||||
$this->data['data'] = $res->toArray();
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 重写规则
|
||||
*/
|
||||
public function rewrite(Rewrite $rewrite){
|
||||
$this->data['data'] = array(
|
||||
'list' => array()
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?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\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class User extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
if ($this->request->isAjax()) {
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 个人资料
|
||||
*/
|
||||
public function profile(){
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 检测密码正确性
|
||||
*/
|
||||
public function checkPassword(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改密码
|
||||
*/
|
||||
public function resetpwd(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\BaseController;
|
||||
|
||||
class Index extends BaseController {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\BaseController;
|
||||
|
||||
class Index extends BaseController {
|
||||
|
||||
}
|
||||
@@ -9,73 +9,22 @@
|
||||
namespace app\http\middleware;
|
||||
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* @title 后台中间件
|
||||
*/
|
||||
class Admin {
|
||||
|
||||
protected $data = [];
|
||||
protected $outAuth = ['admin/index/login', 'admin/index/logout', 'admin/index/verify'];
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$user = Session::get('user');
|
||||
$user = Session::get('user');
|
||||
$request->url = str_replace(".", "/", strtolower($request->controller())) . '/' . $request->action();
|
||||
if (!Session::has('user') && !$user['uid'] && !in_array($request->url, $this->outAuth)) {
|
||||
return redirect('admin/index/login');
|
||||
}
|
||||
$request->isAdmin = 1;
|
||||
$request->user = $user;
|
||||
|
||||
$request->pageConfig = array(
|
||||
'list_rows' => $request->param('limit', 20),
|
||||
'page' => $request->param('page', 1),
|
||||
'page' => $request->param('page', 1),
|
||||
);
|
||||
|
||||
$response = $next($request);
|
||||
|
||||
if (is_array($response->getData())) {
|
||||
$this->data = array_merge($this->data, $response->getData());
|
||||
} else {
|
||||
$this->data = $response->getData();
|
||||
}
|
||||
|
||||
if ($request->isAjax()) {
|
||||
if (isset($this->data['config'])) {
|
||||
unset($this->data['config']);
|
||||
}
|
||||
return json($this->data);
|
||||
} else {
|
||||
if (\is_string($this->data) && $this->data != '') {
|
||||
return $response;
|
||||
} else {
|
||||
return $response->data($this->fetch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 显示类
|
||||
*/
|
||||
protected function fetch($template = '') {
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
$config = array(
|
||||
'tpl_replace_string' => array(
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
'__css__' => '/static/admin/css',
|
||||
'__js__' => '/static/admin/js',
|
||||
'__public__' => '/static/admin',
|
||||
),
|
||||
);
|
||||
|
||||
$template = (isset($this->data['template']) && $this->data['template']) ? $this->data['template'] : $template;
|
||||
|
||||
View::config($config);
|
||||
View::assign('sent_version', sent_version);
|
||||
View::assign('config', (isset($this->data['config']) ? $this->data['config'] : []));
|
||||
View::assign((isset($this->data['data']) ? $this->data['data'] : []));
|
||||
return View::fetch($template);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?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\http\middleware;
|
||||
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* @title 后台中间件
|
||||
*/
|
||||
class AdminAuth {
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$user = Session::get('user');
|
||||
|
||||
if (Session::has('user') && $user['uid']) {
|
||||
$request->user = $user;
|
||||
if ($user['uid'] == 1) {
|
||||
$request->isAdmin = true;
|
||||
}
|
||||
|
||||
$current_url = '/' . str_replace('.', '/', strtolower($request->controller())) . '/' . strtolower($request->action());
|
||||
$meta_title = $current_url;
|
||||
View::assign('meta_title', $meta_title);
|
||||
return $next($request);
|
||||
} else {
|
||||
return redirect(url('admin.index/login'))->remember();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?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\http\middleware;
|
||||
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* @title 后台中间件
|
||||
*/
|
||||
class Front {
|
||||
|
||||
protected $data = [];
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$response = $next($request);
|
||||
$this->data = $response->getData();
|
||||
|
||||
if ($request->isAjax()) {
|
||||
return json($this->data);
|
||||
}else{
|
||||
return $response->data($this->fetch());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 显示类
|
||||
*/
|
||||
protected function fetch($template = ''){
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
$config = array(
|
||||
'tpl_replace_string' => array(
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/front/images',
|
||||
'__css__' => '/static/front/css',
|
||||
'__js__' => '/static/front/js',
|
||||
'__public__' => '/static/front',
|
||||
)
|
||||
);
|
||||
if (is_string($this->data)) {
|
||||
$this->data = array('data' => $this->data);
|
||||
}
|
||||
View::config($config);
|
||||
View::assign($this->data);
|
||||
return View::engine('Think')->fetch($template);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Client extends Validate {
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:client',
|
||||
'appid' => 'require|unique:client',
|
||||
'appsecret' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '客户端标题不能为空!',
|
||||
'appid.require' => 'APPID不能为空!',
|
||||
'appsecret.require' => '秘钥不能为空!',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'appid', 'appsecret'],
|
||||
'edit' => ['title', 'appid', 'appsecret'],
|
||||
];
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Index extends Validate {
|
||||
|
||||
protected $rule = [
|
||||
'username' => 'require',
|
||||
'password' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* @title 登录验证
|
||||
*/
|
||||
public function sceneLogin() {
|
||||
return $this->only(['username','password']);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
<?php
|
||||
// 全局中间件定义文件
|
||||
return [
|
||||
// 全局请求缓存
|
||||
// \think\middleware\CheckRequestCache::class,
|
||||
// 多语言加载
|
||||
// \think\middleware\LoadLangPack::class,
|
||||
// Session初始化
|
||||
\think\middleware\SessionInit::class,
|
||||
// 页面Trace调试
|
||||
// \think\middleware\TraceDebug::class,
|
||||
// 全局请求缓存
|
||||
// \think\middleware\CheckRequestCache::class,
|
||||
// 多语言加载
|
||||
// \think\middleware\LoadLangPack::class,
|
||||
// Session初始化
|
||||
\think\middleware\SessionInit::class,
|
||||
];
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Ad extends Model {
|
||||
|
||||
public $status = array(
|
||||
1 => '开启',
|
||||
0 => '关闭'
|
||||
);
|
||||
|
||||
public function getCoverAttr($value, $data){
|
||||
return get_cover($data['cover_id'], 'path');
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data){
|
||||
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AdPlace extends Model {
|
||||
protected $type = array(
|
||||
'start_time' => 'timestamp',
|
||||
'end_time' => 'timestamp'
|
||||
);
|
||||
|
||||
public $show_type = array(
|
||||
1 => '幻灯片',
|
||||
2 => '对联',
|
||||
3 => '图片列表',
|
||||
4 => '图文列表',
|
||||
5 => '文字列表',
|
||||
6 => '代码广告'
|
||||
);
|
||||
|
||||
public $status = array(
|
||||
1 => '开启',
|
||||
0 => '关闭'
|
||||
);
|
||||
|
||||
public function getShowTypeTextAttr($value, $data){
|
||||
return isset($this->show_type[$data['show_type']]) ? $this->show_type[$data['show_type']] : '未知';
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data){
|
||||
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @title: À¸Ä¿Ä£ÐÍ
|
||||
*/
|
||||
class Category extends Model {
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Channel extends Model
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Client extends Model {
|
||||
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Config extends Model {
|
||||
|
||||
protected $type = array(
|
||||
'id' => 'integer',
|
||||
);
|
||||
|
||||
protected $auto = array('name', 'update_time', 'status' => 1);
|
||||
protected $insert = array('create_time');
|
||||
|
||||
protected function setNameAttr($value) {
|
||||
return strtolower($value);
|
||||
}
|
||||
|
||||
protected function getTypeTextAttr($value, $data) {
|
||||
$config = Cache::get('system_config');
|
||||
$type = $config['config_type_list'];
|
||||
$type_text = explode(',', $type[$data['type']]);
|
||||
return $type_text[0];
|
||||
}
|
||||
|
||||
protected function getGroupTextAttr($value, $data) {
|
||||
$config = Cache::get('system_config');
|
||||
$group = $config['config_group_list'];
|
||||
return isset($group[$data['group']]) ? $group[$data['group']] : '未分组';
|
||||
}
|
||||
|
||||
public function lists() {
|
||||
$map = array('status' => 1);
|
||||
$res = $this->where($map)->field('type,name,value')->select();
|
||||
|
||||
$config = array();
|
||||
foreach ($res->toArray() as $value) {
|
||||
$config[$value['name']] = $this->parse($value['type'], $value['value']);
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
public function updateConfig($data) {
|
||||
if (empty($data['config'])) {
|
||||
$this->error = "无更新";
|
||||
return false;
|
||||
}
|
||||
foreach ($data['config'] as $key => $value) {
|
||||
self::update(['value' => $value], ['name' => $key], ['value']);
|
||||
}
|
||||
Cache::set('system_config', null);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置类型解析配置
|
||||
* @param integer $type 配置类型
|
||||
* @param string $value 配置值
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
private function parse($type, $value) {
|
||||
switch ($type) {
|
||||
case 'textarea': //解析数组
|
||||
$array = preg_split('/[,;\r\n]+/', trim($value, ",;\r\n"));
|
||||
if (strpos($value, ':')) {
|
||||
$value = array();
|
||||
foreach ($array as $val) {
|
||||
$list = explode(':', $val);
|
||||
if (isset($list[2])) {
|
||||
$value[$list[0]] = $list[1] . ',' . $list[2];
|
||||
} else {
|
||||
$value[$list[0]] = $list[1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$value = $array;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getThemesList() {
|
||||
$files = array();
|
||||
$files['pc'] = $this->getList('pc');
|
||||
$files['mobile'] = $this->getList('mobile');
|
||||
return $files;
|
||||
}
|
||||
|
||||
protected function getList($type) {
|
||||
$path = './template/';
|
||||
$file = opendir($path);
|
||||
while (false !== ($filename = readdir($file))) {
|
||||
if (!in_array($filename, array('.', '..'))) {
|
||||
$files = $path . $filename . '/info.php';
|
||||
if (is_file($files)) {
|
||||
$info = include $files;
|
||||
if (isset($info['type']) && $info['type'] == $type) {
|
||||
$info['id'] = $filename;
|
||||
$info['img'] = '/template/' . $filename . '/' . $info['img'];
|
||||
$list[] = $info;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isset($list) ? $list : array();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Content extends Model {
|
||||
// 定义默认的表后缀(默认查询中文数据)
|
||||
protected $suffix = '';
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Form extends Model {
|
||||
|
||||
public $status = array(
|
||||
1 => '开启',
|
||||
0 => '关闭'
|
||||
);
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data){
|
||||
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @title: 用户模型
|
||||
*/
|
||||
class Member extends Model {
|
||||
|
||||
protected $pk = 'uid';
|
||||
|
||||
protected $createTime = 'reg_time';
|
||||
protected $updateTime = 'last_login_time';
|
||||
|
||||
protected $insert = ['reg_ip'];
|
||||
|
||||
protected $type = [
|
||||
'uid' => 'integer',
|
||||
'reg_time' => 'integer',
|
||||
];
|
||||
|
||||
public $loginVisible = array('uid', 'username', 'nickname', 'access_token'); //用户登录成功返回的字段
|
||||
|
||||
protected function setPasswordAttr($value) {
|
||||
$salt = rand_string(6);
|
||||
$this->set('salt', $salt);
|
||||
return md5($value . $salt);
|
||||
}
|
||||
|
||||
protected function setRegIpAttr($value) {
|
||||
return get_client_ip(1);
|
||||
}
|
||||
|
||||
protected function getAccessTokenAttr($value, $data) {
|
||||
return authcode($data['uid'] . '|' . $data['username'] . '|' . $data['password'], 'ENCODE');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户登录
|
||||
* param username:用户名、手机号码、邮箱 password:密码、手机验证码、开源类型 type:登录类型(账号密码登录、手机号码+验证码登录、开源账号登录)
|
||||
*/
|
||||
public function login($username, $password, $type = 1) {
|
||||
$map = array();
|
||||
if (preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $username)) {
|
||||
$type = 2;
|
||||
} elseif (preg_match("/^1[34578]{1}\d{9}$/", $username)) {
|
||||
$type = 3;
|
||||
}
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$map['username'] = $username;
|
||||
break;
|
||||
case 2:
|
||||
$map['email'] = $username;
|
||||
break;
|
||||
case 3:
|
||||
$map['mobile'] = $username;
|
||||
break;
|
||||
default:
|
||||
return false; //参数错误
|
||||
}
|
||||
if (!$username) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = $this->where($map)->find();
|
||||
if (isset($user['uid']) && $user['uid'] && $user['status']) {
|
||||
/* 验证用户密码 */
|
||||
if (md5($password . $user['salt']) === $user['password']) {
|
||||
/* 更新登录信息 */
|
||||
(new MemberLog())->record($user);
|
||||
return $user->append(array('access_token'))->visible($this->loginVisible)->toArray(); //登录成功,返回用户信息
|
||||
} else {
|
||||
$this->error = "密码错误";
|
||||
return false; //密码错误
|
||||
}
|
||||
} else {
|
||||
$this->error = "用户不存在或被禁用";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title: 注册
|
||||
*/
|
||||
public function register($data) {
|
||||
$result = self::create($data);
|
||||
if (false !== $result) {
|
||||
$user = $this->where('uid', $result->uid)->find();
|
||||
} else {
|
||||
$this->error = "注册失败!";
|
||||
return false;
|
||||
}
|
||||
/* 更新登录信息 */
|
||||
(new MemberLog())->record($user);
|
||||
return $user->append(array('access_token'))->visible($this->loginVisible)->toArray(); //登录成功,返回用户信息
|
||||
}
|
||||
|
||||
/**
|
||||
* @title: 获取用户列表
|
||||
*/
|
||||
public function getUserList() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title: 获取用户信息
|
||||
*/
|
||||
public function getInfo($uid) {
|
||||
|
||||
}
|
||||
|
||||
public function socialite() {
|
||||
return $this->hasMany('MemberSocialite', 'uid', 'uid');
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @title: 用户日志模型
|
||||
*/
|
||||
class MemberLog extends Model {
|
||||
|
||||
public function record($user){
|
||||
/* 更新登录信息 */
|
||||
$data = array(
|
||||
'uid' => $user['uid'],
|
||||
'login' => array('inc', '1'),
|
||||
'last_login_time' => time(),
|
||||
'last_login_ip' => get_client_ip(1),
|
||||
);
|
||||
Member::where(array('uid'=>$user['uid']))->update($data);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?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\common\model;
|
||||
|
||||
/**
|
||||
* 用户模型
|
||||
*/
|
||||
class MemberSocialite extends Base{
|
||||
|
||||
protected $type = array(
|
||||
'uid' => 'integer',
|
||||
);
|
||||
|
||||
public function register(){
|
||||
if ($socialite->where('openid', $data['info']['openid'])->value('id')) {
|
||||
$this->error = "请勿重复注册!";
|
||||
return false;
|
||||
} else {
|
||||
$account = array(
|
||||
'username' => $data['info']['openid'],
|
||||
'password' => rand_string(8),
|
||||
);
|
||||
$result = self::create($account);
|
||||
if (false !== $result) {
|
||||
$socialite_info = $data['info'];
|
||||
$user = $this->where('uid', $result->uid)->find();
|
||||
$socialite_info['uid'] = $user['uid'];
|
||||
$socialite_info['type'] = $data['open_type'];
|
||||
$socialite->register($socialite_info);
|
||||
} else {
|
||||
$this->error = "注册失败!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function wechatLogin($user_info){
|
||||
$socialite = $this->where('openid', $user_info['openid'])->where('type', 'wechat')->find();
|
||||
$member = new Member();
|
||||
if ($socialite) {
|
||||
$this->where('id', $socialite['id'])->update($user_info);
|
||||
if ($socialite['uid'] > 0) {
|
||||
//绑定了用户则自动登录
|
||||
$user = $member->where('uid', $socialite['uid'])->find();
|
||||
$member->autoLogin($user);
|
||||
}
|
||||
}else{
|
||||
$user_info['type'] = 'wechat';
|
||||
$this->insert($user_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* @title: ²Ëµ¥Ä£ÐÍ
|
||||
*/
|
||||
class Menu extends Model {
|
||||
|
||||
/**
|
||||
* @title ÏÔʾ²Ëµ¥
|
||||
*/
|
||||
public function getAuthMenuList(Request $request) {
|
||||
$list = [];
|
||||
$current_controller = '/' . str_replace('.', '/', strtolower($request->controller()));
|
||||
$current_url = $request->url;
|
||||
$menu = Cache::get('menu');
|
||||
if (!$menu) {
|
||||
$res = self::where('is_menu', 1)->order('sort asc, id asc')->select()->toArray();
|
||||
foreach ($res as $key => $item) {
|
||||
$menu[$item['id']] = $item;
|
||||
}
|
||||
Cache::set('menu', $menu);
|
||||
}
|
||||
foreach ($menu as $key => $value) {
|
||||
if ($request->isAdmin || in_array($value['id'], array())) {
|
||||
$list[$value['id']] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$menuList = list_to_tree($list);
|
||||
return $menuList;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Model extends Model
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Rewrite extends Model {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class SeoRule extends Model {
|
||||
|
||||
}
|
||||
9
app/service.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use app\AppService;
|
||||
|
||||
// 系统服务定义文件
|
||||
// 服务在完成全局初始化之后执行
|
||||
return [
|
||||
AppService::class,
|
||||
];
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* php think build 自动生成应用的目录结构的定义示例
|
||||
*/
|
||||
return [
|
||||
// 需要自动创建的文件
|
||||
'__file__' => [],
|
||||
// 需要自动创建的目录
|
||||
'__dir__' => ['controller', 'model', 'view'],
|
||||
// 需要自动创建的控制器
|
||||
'controller' => ['Index'],
|
||||
// 需要自动创建的模型
|
||||
'model' => ['User'],
|
||||
// 需要自动创建的模板
|
||||
'view' => ['index/index'],
|
||||
];
|
||||
@@ -10,42 +10,39 @@
|
||||
"homepage": "http://thinkphp.cn/",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "liu21st",
|
||||
"email": "liu21st@gmail.com"
|
||||
}],
|
||||
"require":
|
||||
{
|
||||
{
|
||||
"name": "liu21st",
|
||||
"email": "liu21st@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "yunwuxin",
|
||||
"email": "448901948@qq.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
"topthink/framework": "^6.0.0",
|
||||
"topthink/think-orm": "^2.0.28",
|
||||
"topthink/think-orm": "^2.0",
|
||||
"topthink/think-trace": "^1.2",
|
||||
"topthink/think-view": "^1.0",
|
||||
"overtrue/wechat": "~4.0",
|
||||
"sent/think-auth": "^1.1",
|
||||
"sent/think-jwt": "^1.0.0",
|
||||
"sent/tree": "^1.0.0"
|
||||
"liliuwei/thinkphp-jump": "^1.4",
|
||||
"sent/think-auth": "^1.2"
|
||||
},
|
||||
"require-dev":
|
||||
{
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^4.2"
|
||||
},
|
||||
"autoload":
|
||||
{
|
||||
"psr-4":
|
||||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"app\\": "app"
|
||||
},
|
||||
"psr-0":
|
||||
{
|
||||
"psr-0": {
|
||||
"": "extend/"
|
||||
}
|
||||
},
|
||||
"config":
|
||||
{
|
||||
"config": {
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"scripts":
|
||||
{
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"@php think service:discover",
|
||||
"@php think vendor:publish"
|
||||
|
||||
1056
composer.lock
generated
Normal file
@@ -3,35 +3,32 @@
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 应用地址
|
||||
'app_host' => Env::get('app.host', ''),
|
||||
'app_host' => env('app.host', ''),
|
||||
// 应用的命名空间
|
||||
'app_namespace' => '',
|
||||
'app_namespace' => '',
|
||||
// 是否启用路由
|
||||
'with_route' => true,
|
||||
'with_route' => true,
|
||||
// 是否启用事件
|
||||
'with_event' => true,
|
||||
// 自动多应用模式
|
||||
'auto_multi_app' => false,
|
||||
// 应用映射(自动多应用模式有效)
|
||||
'app_map' => [],
|
||||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [],
|
||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||
'deny_app_list' => [],
|
||||
'with_event' => true,
|
||||
// 默认应用
|
||||
'default_app' => 'index',
|
||||
'default_app' => 'index',
|
||||
// 默认时区
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
|
||||
// 应用映射(自动多应用模式有效)
|
||||
'app_map' => [],
|
||||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [],
|
||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||
'deny_app_list' => [],
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => true,
|
||||
'show_error_msg' => true,
|
||||
];
|
||||
|
||||
23
app/controller/admin/Attribute.php → config/auth.php
Executable file → Normal file
@@ -6,16 +6,15 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
|
||||
class Attribute extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
}
|
||||
}
|
||||
return [
|
||||
// 权限设置
|
||||
'auth_config' => [
|
||||
'auth_on' => true, // 认证开关
|
||||
'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
|
||||
'auth_group' => 'auth_group', // 用户组数据表名
|
||||
'auth_group_access' => 'auth_group_access', // 用户-用户组关系表
|
||||
'auth_rule' => 'auth_rule', // 权限规则表
|
||||
'auth_user' => 'admin', // 用户信息表
|
||||
],
|
||||
];
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
use think\facade\Env;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 缓存设置
|
||||
@@ -7,7 +6,7 @@ use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 默认缓存驱动
|
||||
'default' => Env::get('cache.driver', 'file'),
|
||||
'default' => env('cache.driver', 'file'),
|
||||
|
||||
// 缓存连接方式配置
|
||||
'stores' => [
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 默认使用的数据库连接配置
|
||||
'default' => Env::get('database.driver', 'mysql'),
|
||||
'default' => env('database.driver', 'mysql'),
|
||||
|
||||
// 自定义时间查询规则
|
||||
'time_query_rule' => [],
|
||||
@@ -20,25 +19,24 @@ return [
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
// 数据库类型
|
||||
'type' => Env::get('database.type', 'mysql'),
|
||||
'type' => env('database.type', 'mysql'),
|
||||
// 服务器地址
|
||||
'hostname' => Env::get('database.hostname', '127.0.0.1'),
|
||||
'hostname' => env('database.hostname', '127.0.0.1'),
|
||||
// 数据库名
|
||||
'database' => Env::get('database.database', ''),
|
||||
'database' => env('database.database', ''),
|
||||
// 用户名
|
||||
'username' => Env::get('database.username', 'root'),
|
||||
'username' => env('database.username', 'root'),
|
||||
// 密码
|
||||
'password' => Env::get('database.password', ''),
|
||||
'password' => env('database.password', ''),
|
||||
// 端口
|
||||
'hostport' => Env::get('database.hostport', '3306'),
|
||||
'hostport' => env('database.hostport', '3306'),
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => Env::get('database.charset', 'utf8'),
|
||||
'charset' => env('database.charset', 'utf8'),
|
||||
// 数据库表前缀
|
||||
'prefix' => Env::get('database.prefix', ''),
|
||||
// 数据库调试模式
|
||||
'debug' => Env::get('database.debug', true),
|
||||
'prefix' => env('database.prefix', ''),
|
||||
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
@@ -51,6 +49,10 @@ return [
|
||||
'fields_strict' => true,
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => false,
|
||||
// 监听SQL
|
||||
'trigger_sql' => env('app_debug', true),
|
||||
// 开启字段缓存
|
||||
'fields_cache' => false,
|
||||
// 字段缓存路径
|
||||
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||
],
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<?php
|
||||
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
'default' => Env::get('filesystem.driver', 'local'),
|
||||
// 默认磁盘
|
||||
'default' => env('filesystem.driver', 'local'),
|
||||
// 磁盘列表
|
||||
'disks' => [
|
||||
'local' => [
|
||||
'type' => 'local',
|
||||
'root' => app()->getRuntimePath() . 'storage',
|
||||
],
|
||||
'public' => [
|
||||
// 磁盘类型
|
||||
'type' => 'local',
|
||||
// 磁盘路径
|
||||
'root' => app()->getRootPath() . 'public/storage',
|
||||
// 磁盘路径对应的外部URL路径
|
||||
'url' => '/storage',
|
||||
// 可见性
|
||||
'visibility' => 'public',
|
||||
],
|
||||
// 更多的磁盘配置信息
|
||||
|
||||
12
config/jump.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: liliuwei
|
||||
* Date: 2019/5/23
|
||||
* Time: 22:50
|
||||
*/
|
||||
return[
|
||||
// 默认跳转页面对应的模板文件
|
||||
'dispatch_success_tmpl' => app()->getRootPath().'/vendor/liliuwei/thinkphp-jump/src/tpl/dispatch_jump.tpl',
|
||||
'dispatch_error_tmpl' => app()->getRootPath().'/vendor/liliuwei/thinkphp-jump/src/tpl/dispatch_jump.tpl',
|
||||
];
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'secret' => env('JWT_SECRET'),
|
||||
//Asymmetric key
|
||||
'public_key' => env('JWT_PUBLIC_KEY'),
|
||||
'private_key' => env('JWT_PRIVATE_KEY'),
|
||||
'password' => env('JWT_PASSWORD'),
|
||||
//JWT time to live
|
||||
'ttl' => env('JWT_TTL', 60),
|
||||
//Refresh time to live
|
||||
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
|
||||
//JWT hashing algorithm
|
||||
'algo' => env('JWT_ALGO', 'HS256'),
|
||||
|
||||
'blacklist_storage' => sent\jwt\provider\storage\Tp6::class,
|
||||
];
|
||||
@@ -3,11 +3,9 @@
|
||||
// | 多语言设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
// 默认语言
|
||||
'default_lang' => Env::get('lang.default_lang', 'zh-cn'),
|
||||
'default_lang' => env('lang.default_lang', 'zh-cn'),
|
||||
// 允许的语言列表
|
||||
'allow_lang_list' => [],
|
||||
// 多语言自动侦测变量名
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
use think\facade\Env;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 日志设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 默认日志记录通道
|
||||
'default' => Env::get('log.channel', 'file'),
|
||||
'default' => env('log.channel', 'file'),
|
||||
// 日志记录级别
|
||||
'level' => [],
|
||||
// 日志类型记录的通道 ['error'=>'email',...]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
//中间件配置
|
||||
// 中间件配置
|
||||
return [
|
||||
//别名或分组
|
||||
// 别名或分组
|
||||
'alias' => [],
|
||||
//优先级设置,此数组中的中间件会按照数组中的顺序优先执行
|
||||
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
|
||||
'priority' => [],
|
||||
];
|
||||
|
||||
@@ -18,12 +18,6 @@ return [
|
||||
'route_rule_merge' => false,
|
||||
// 路由是否完全匹配
|
||||
'route_complete_match' => false,
|
||||
// 是否开启路由缓存
|
||||
'route_check_cache' => false,
|
||||
// 路由缓存连接参数
|
||||
'route_cache_option' => [],
|
||||
// 路由缓存Key
|
||||
'route_check_cache_key' => '',
|
||||
// 访问控制器层名称
|
||||
'controller_layer' => 'controller',
|
||||
// 空控制器名
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// | Trace设置 开启调试模式后有效
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 内置Html 支持扩展
|
||||
// 内置Html和Console两种方式 支持扩展
|
||||
'type' => 'Html',
|
||||
// 读取的日志通道名
|
||||
'channel' => '',
|
||||
|
||||
@@ -10,8 +10,6 @@ return [
|
||||
'auto_rule' => 1,
|
||||
// 模板目录名
|
||||
'view_dir_name' => 'view',
|
||||
// 模板路径
|
||||
'view_path' => '',
|
||||
// 模板后缀
|
||||
'view_suffix' => 'html',
|
||||
// 模板文件名分隔符
|
||||
|
||||
40
index.html
@@ -1,40 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>恭喜,站点创建成功!</title>
|
||||
<style>
|
||||
.container {
|
||||
width: 60%;
|
||||
margin: 10% auto 0;
|
||||
background-color: #f0f0f0;
|
||||
padding: 2% 5%;
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
ul li {
|
||||
line-height: 2.3
|
||||
}
|
||||
|
||||
a {
|
||||
color: #20a53a
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>恭喜, 站点创建成功!</h1>
|
||||
<h3>这是默认index.html,本页面由系统自动生成</h3>
|
||||
<ul>
|
||||
<li>本页面在FTP根目录下的index.html</li>
|
||||
<li>您可以修改、删除或覆盖本页面</li>
|
||||
<li>FTP相关信息,请到“面板系统后台 > FTP” 查看</li>
|
||||
<li>更多功能了解,请查看<a href="https://www.bt.cn" target="_blank">宝塔官网(www.bt.cn)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -13,5 +13,7 @@
|
||||
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
|
||||
return false;
|
||||
} else {
|
||||
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
|
||||
|
||||
require __DIR__ . "/index.php";
|
||||
}
|
||||
|
||||
2
public/static/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Plugin: Full Calendar
|
||||
* ---------------------
|
||||
*/
|
||||
.fc-button {
|
||||
background: #f4f4f4;
|
||||
background-image: none;
|
||||
color: #444;
|
||||
border-color: #ddd;
|
||||
border-bottom-color: #ddd;
|
||||
}
|
||||
.fc-button:hover,
|
||||
.fc-button:active,
|
||||
.fc-button.hover {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.fc-header-title h2 {
|
||||
font-size: 15px;
|
||||
line-height: 1.6em;
|
||||
color: #666;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.fc-header-right {
|
||||
padding-right: 10px;
|
||||
}
|
||||
.fc-header-left {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.fc-widget-header {
|
||||
background: #fafafa;
|
||||
}
|
||||
.fc-grid {
|
||||
width: 100%;
|
||||
border: 0;
|
||||
}
|
||||
.fc-widget-header:first-of-type,
|
||||
.fc-widget-content:first-of-type {
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
.fc-widget-header:last-of-type,
|
||||
.fc-widget-content:last-of-type {
|
||||
border-right: 0;
|
||||
}
|
||||
.fc-toolbar {
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
.fc-day-number {
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.fc-color-picker {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.fc-color-picker > li {
|
||||
float: left;
|
||||
font-size: 30px;
|
||||
margin-right: 5px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.fc-color-picker > li .fa {
|
||||
-webkit-transition: -webkit-transform linear 0.3s;
|
||||
-moz-transition: -moz-transform linear 0.3s;
|
||||
-o-transition: -o-transform linear 0.3s;
|
||||
transition: transform linear 0.3s;
|
||||
}
|
||||
.fc-color-picker > li .fa:hover {
|
||||
-webkit-transform: rotate(30deg);
|
||||
-ms-transform: rotate(30deg);
|
||||
-o-transform: rotate(30deg);
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
#add-new-event {
|
||||
-webkit-transition: all linear 0.3s;
|
||||
-o-transition: all linear 0.3s;
|
||||
transition: all linear 0.3s;
|
||||
}
|
||||
.external-event {
|
||||
padding: 5px 10px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 4px;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
cursor: move;
|
||||
}
|
||||
.external-event:hover {
|
||||
box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
.fc-button{background:#f4f4f4;background-image:none;color:#444;border-color:#ddd;border-bottom-color:#ddd}.fc-button:hover,.fc-button:active,.fc-button.hover{background-color:#e9e9e9}.fc-header-title h2{font-size:15px;line-height:1.6em;color:#666;margin-left:10px}.fc-header-right{padding-right:10px}.fc-header-left{padding-left:10px}.fc-widget-header{background:#fafafa}.fc-grid{width:100%;border:0}.fc-widget-header:first-of-type,.fc-widget-content:first-of-type{border-left:0;border-right:0}.fc-widget-header:last-of-type,.fc-widget-content:last-of-type{border-right:0}.fc-toolbar{padding:10px;margin:0}.fc-day-number{font-size:20px;font-weight:300;padding-right:10px}.fc-color-picker{list-style:none;margin:0;padding:0}.fc-color-picker>li{float:left;font-size:30px;margin-right:5px;line-height:30px}.fc-color-picker>li .fa{-webkit-transition:-webkit-transform linear .3s;-moz-transition:-moz-transform linear .3s;-o-transition:-o-transform linear .3s;transition:transform linear .3s}.fc-color-picker>li .fa:hover{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);-o-transform:rotate(30deg);transform:rotate(30deg)}#add-new-event{-webkit-transition:all linear .3s;-o-transition:all linear .3s;transition:all linear .3s}.external-event{padding:5px 10px;font-weight:bold;margin-bottom:4px;box-shadow:0 1px 1px rgba(0,0,0,0.1);text-shadow:0 1px 1px rgba(0,0,0,0.1);border-radius:3px;cursor:move}.external-event:hover{box-shadow:inset 0 0 90px rgba(0,0,0,0.2)}
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Plugin: Select2
|
||||
* ---------------
|
||||
*/
|
||||
.select2-container--default.select2-container--focus,
|
||||
.select2-selection.select2-container--focus,
|
||||
.select2-container--default:focus,
|
||||
.select2-selection:focus,
|
||||
.select2-container--default:active,
|
||||
.select2-selection:active {
|
||||
outline: none;
|
||||
}
|
||||
.select2-container--default .select2-selection--single,
|
||||
.select2-selection .select2-selection--single {
|
||||
border: 1px solid #d2d6de;
|
||||
border-radius: 0;
|
||||
padding: 6px 12px;
|
||||
height: 34px;
|
||||
}
|
||||
.select2-container--default.select2-container--open {
|
||||
border-color: #3c8dbc;
|
||||
}
|
||||
.select2-dropdown {
|
||||
border: 1px solid #d2d6de;
|
||||
border-radius: 0;
|
||||
}
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #3c8dbc;
|
||||
color: white;
|
||||
}
|
||||
.select2-results__option {
|
||||
padding: 6px 12px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
height: auto;
|
||||
margin-top: -4px;
|
||||
}
|
||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 6px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 28px;
|
||||
right: 3px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
||||
margin-top: 0;
|
||||
}
|
||||
.select2-dropdown .select2-search__field,
|
||||
.select2-search--inline .select2-search__field {
|
||||
border: 1px solid #d2d6de;
|
||||
}
|
||||
.select2-dropdown .select2-search__field:focus,
|
||||
.select2-search--inline .select2-search__field:focus {
|
||||
outline: none;
|
||||
}
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple,
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
border-color: #3c8dbc !important;
|
||||
}
|
||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
||||
color: #999;
|
||||
}
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.select2-container--default .select2-results__option[aria-selected=true],
|
||||
.select2-container--default .select2-results__option[aria-selected=true]:hover {
|
||||
color: #444;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
border: 1px solid #d2d6de;
|
||||
border-radius: 0;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple:focus {
|
||||
border-color: #3c8dbc;
|
||||
}
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border-color: #d2d6de;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #3c8dbc;
|
||||
border-color: #367fa9;
|
||||
padding: 1px 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-right: 5px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 10px;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
.select2-container--default.select2-container--focus,.select2-selection.select2-container--focus,.select2-container--default:focus,.select2-selection:focus,.select2-container--default:active,.select2-selection:active{outline:none}.select2-container--default .select2-selection--single,.select2-selection .select2-selection--single{border:1px solid #d2d6de;border-radius:0;padding:6px 12px;height:34px}.select2-container--default.select2-container--open{border-color:#3c8dbc}.select2-dropdown{border:1px solid #d2d6de;border-radius:0}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#3c8dbc;color:white}.select2-results__option{padding:6px 12px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{padding-left:0;padding-right:0;height:auto;margin-top:-4px}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:6px;padding-left:20px}.select2-container--default .select2-selection--single .select2-selection__arrow{height:28px;right:3px}.select2-container--default .select2-selection--single .select2-selection__arrow b{margin-top:0}.select2-dropdown .select2-search__field,.select2-search--inline .select2-search__field{border:1px solid #d2d6de}.select2-dropdown .select2-search__field:focus,.select2-search--inline .select2-search__field:focus{outline:none}.select2-container--default.select2-container--focus .select2-selection--multiple,.select2-container--default .select2-search--dropdown .select2-search__field{border-color:#3c8dbc !important}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option[aria-selected=true],.select2-container--default .select2-results__option[aria-selected=true]:hover{color:#444}.select2-container--default .select2-selection--multiple{border:1px solid #d2d6de;border-radius:0}.select2-container--default .select2-selection--multiple:focus{border-color:#3c8dbc}.select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#d2d6de}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#3c8dbc;border-color:#367fa9;padding:1px 10px;color:#fff}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{margin-right:5px;color:rgba(255,255,255,0.7)}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#fff}.select2-container .select2-selection--single .select2-selection__rendered{padding-right:10px}
|
||||
8
public/static/admin/css/sentcms.min.css
vendored
|
Before Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 656 KiB |