完善项目描述

This commit is contained in:
hdm 2021-07-26 17:41:59 +08:00
parent dcd1734132
commit 2731fee4df
62 changed files with 1120 additions and 685 deletions

View File

@ -30,3 +30,8 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
勾股CMS遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2021 by gouguCMS (https://www.gougucms.com)
All rights reserved。

View File

@ -1,17 +1,23 @@
# 勾股CMS
## 链接
[![勾股CMS](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://gitee.com/gougucms/gougucms/)
[![勾股CMS](https://img.shields.io/badge/GouguCMS-1.0.0-brightgreen.svg)](https://gitee.com/gougucms/gougucms/)
[![star](https://gitee.com/gougucms/gougucms/badge/star.svg?theme=dark)](https://gitee.com/gougucms/gougucms/stargazers)
[![fork](https://gitee.com/gougucms/gougucms/badge/fork.svg?theme=dark)](https://gitee.com/gougucms/gougucms/members)
### 链接
- 勾股CMShttps://www.gougucms.com
- giteehttps://gitee.com/gougucms/gougucms.git
## 相关链接
### 相关链接
- [开源项目系列之勾股CMS](https://www.gougucms.com)
- [开源项目系列之勾股博客](https://blog.gougucms.com)
### 介绍
1. 勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。
2. 系统后台各管理模块,一目了然,操作简单;通用型的后台权限管理框架,前后台用户的操作记录覆盖跟踪,紧随潮流、极低门槛、开箱即用。
3. 系统易于功能扩展,代码维护,方便二次开发,帮助开发者简单高效降低二次开发的成本,满足专注业务深度开发的需求。
- 勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。
- 系统后台各管理模块,一目了然,操作简单;通用型的后台权限管理框架,前后台用户的操作记录覆盖跟踪,紧随潮流、极低门槛、开箱即用。
- 系统易于功能扩展,代码维护,方便二次开发,帮助开发者简单高效降低二次开发的成本,满足专注业务深度开发的需求。
- 可去前台版权,真正意义的永久免费,可商用的后台系统。
### 目录结构
@ -77,14 +83,16 @@ www 系统部署目录(或者子目录)
### 安装教程
1. 勾股CMS推荐你使用阿里云和腾讯云服务器
一、勾股CMS推荐你使用阿里云和腾讯云服务器
阿里云服务器官方长期折扣优惠地址: (https://www.aliyun.com/activity/daily/bestoffer?userCode=dmrcx154)
腾讯云服务器官方长期折扣优惠地址: (https://curl.qcloud.com/PPEgI0oV)
2. 服务器运行环境要求
二、服务器运行环境要求。
~~~
PHP >= 7.1
Mysql >= 5.5.0 (需支持innodb引擎)
Apache 或 Nginx
@ -92,41 +100,56 @@ www 系统部署目录(或者子目录)
MBstring PHP Extension
CURL PHP Extension
Composer (用于管理第三方扩展包)
~~~
3. 完整包安装
三、系统安装
前往官网下载页面 (https://www.gougucms.com/) 下载完整包解压到你的项目目录
添加站点并绑定域名到项目中的public目录为运行目录
访问 http://www.yoursite.com/install/index 进行安装
**方式一:完整包安装**
4. 命令行安装
第一步:前往官网下载页面 (https://www.gougucms.com) 下载完整包解压到你的项目目录
强烈建议使用命令行安装因为采用命令行安装的方式可以和勾股CMS随时保持更新同步。使用命令行安装请提前准备好Git、Composer、Linux下勾股CMS的安装请使用以下命令进行安装。
第二步添加虚拟主机并绑定到项目的public目录
克隆勾股CMS到你本地
第三步:访问 http://www.yoursite.com/install/index 进行安装
**方式二:命令行安装(推荐)**
推荐使用命令行安装因为采用命令行安装的方式可以和勾股CMS随时保持更新同步。使用命令行安装请提前准备好Git、Composer。
Linux下勾股CMS的安装请使用以下命令进行安装。
第一步克隆勾股CMS到你本地
git clone https://gitee.com/gougucms/gougucms.git
进入目录
第二步:进入目录
cd gougucms
下载PHP依赖包composer的版本最好是2.0.8版本否则可能下载PHP依赖包失败composer降级composer self-update 2.0.8
第三步下载PHP依赖包
composer install
注意composer的版本最好是2.0.8版本否则可能下载PHP依赖包失败composer降级composer self-update 2.0.8
添加虚拟主机并绑定到项目的public目录
第四步:添加虚拟主机并绑定到项目的public目录
访问 http://www.yoursite.com/install/index 进行安装
第五步:访问 http://www.yoursite.com/install/index 进行安装
### 常见问题
1. 安装失败可能存在php配置文件禁止了putenv 和 proc_open函数。解决方法查找php.ini文件位置打开php.ini搜索 disable_functions 项看是否禁用了putenv 和 proc_open函数。如果在禁用列表里移除putenv proc_open然后退出重启php即可。
2. 如果安装后打开页面提示404错误请检查服务器伪静态配置宝塔伪静态请配置使用thinkphp规则
3. 如果提示当前权限不足无法写入配置文件config/database.php请检查database.php是否可读还有可能是当前安装程序无法访问父目录请检查PHP的open_basedir配置
4. 如果composer install失败请尝试在命令行进行切换配置到国内源命令如下composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
5. 如果composer install失败请尝试composer降级composer self-update 2.0.8
6. 访问 http://www.yoursite.com/install/index请注意查看伪静态请配置是否设置了thinkphp规则
7. 遇到问题请到QQ群24641076 反馈
2. 如果安装后打开页面提示404错误请检查服务器伪静态配置如果是宝塔面板网站伪静态请配置使用thinkphp规则。
3. 如果提示当前权限不足无法写入配置文件config/database.php请检查database.php是否可读还有可能是当前安装程序无法访问父目录请检查PHP的open_basedir配置。
4. 如果composer install失败请尝试在命令行进行切换配置到国内源命令如下composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/。
5. 如果composer install失败请尝试composer降级composer self-update 2.0.8。
6. 访问 http://www.yoursite.com/install/index 请注意查看伪静态请配置是否设置了thinkphp规则。
7. 遇到问题请到QQ群24641076 反馈。
### 截图预览
![输入图片说明](https://images.gitee.com/uploads/images/2021/0225/002705_51fd21e2_8633021.png "p1.png")

View File

@ -1,10 +1,17 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin;
use think\App;
use think\exception\HttpResponseException;
use think\facade\Request;
use think\App;
/**
* 控制器基础类

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -32,8 +38,7 @@ class Admin extends BaseController
$item->last_login_time = empty($item->last_login_time) ? '-' : date('Y-m-d H:i', $item->last_login_time);
});
return table_assign(1, '', $admin);
}
else{
} else {
return view();
}
}
@ -254,8 +259,7 @@ class Admin extends BaseController
$content->offsetSet($k, $data);
}
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -208,7 +214,8 @@ class Api extends BaseController
}
// 测试邮件发送
public function email_test(){
public function email_test()
{
$sender = get_params('email');
//检查是否邮箱格式
if (!is_email($sender)) {

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -18,12 +24,11 @@ class Conf extends BaseController
$where = array();
$where[] = ['status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$content = Db::name('config')
$content = Db::name('Config')
->where($where)
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}
@ -33,7 +38,7 @@ class Conf extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$config = Db::name('config')->where(['id' => $id])->find();
$config = Db::name('Config')->where(['id' => $id])->find();
View::assign('config', $config);
}
View::assign('id', $id);
@ -54,12 +59,18 @@ class Conf extends BaseController
if (!empty($param['id']) && $param['id'] > 0) {
$param['update_time'] = time();
$res = Db::name('config')->strict(false)->field(true)->update($param);
if($res) add_log('edit',$param['id'],$param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
$param['create_time'] = time();
$insertId = Db::name('config')->strict(false)->field(true)->insertGetId($param);
if($insertId) add_log('add',$insertId,$param);
$insertId = Db::name('Config')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
@ -71,7 +82,7 @@ class Conf extends BaseController
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('config')->update($data) !== false) {
if (Db::name('Config')->update($data) !== false) {
add_log('delete', $id, $data);
return to_assign(1, "删除成功");
} else {
@ -83,7 +94,7 @@ class Conf extends BaseController
public function edit()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$conf = Db::name('config')->where('id',$id)->find();
$conf = Db::name('Config')->where('id', $id)->find();
$config = [];
if ($conf['content']) {
$config = unserialize($conf['content']);
@ -98,10 +109,12 @@ class Conf extends BaseController
$data['content'] = serialize($param);
$data['update_time'] = time();
$data['id'] = $param['id'];
$res = Db::name('config')->strict(false)->field(true)->update($data);
$conf = Db::name('config')->where('id',$param['id'])->find();
$res = Db::name('Config')->strict(false)->field(true)->update($data);
$conf = Db::name('Config')->where('id', $param['id'])->find();
clear_cache('system_config' . $conf['name']);
if($res) add_log('edit',$param['id'],$param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -11,13 +17,14 @@ use think\facade\View;
class Database extends BaseController
{
protected $db = '', $datadir;
function initialize(){
public function initialize()
{
parent::initialize();
$this->config = array(
'path' => './backup/', // 数据库备份路径
'part' => 20971520, // 数据库备份卷大小
'compress' => 0, // 数据库备份文件是否启用压缩 0不压缩 1 压缩
'level' => 9 // 数据库备份文件压缩级别 1普通 4 一般 9最高
'level' => 9, // 数据库备份文件压缩级别 1普通 4 一般 9最高
);
$this->db = new Backup($this->config);
}
@ -60,7 +67,8 @@ class Database extends BaseController
}
// 优化
public function optimize() {
public function optimize()
{
$tables = get_params('id');
if (empty($tables)) {
return to_assign(1, '请选择要优化的表!');
@ -75,7 +83,8 @@ class Database extends BaseController
}
// 修复
public function repair() {
public function repair()
{
$tables = get_params('id');
if (empty($tables)) {
return to_assign(0, '请选择要修复的表!');
@ -89,8 +98,6 @@ class Database extends BaseController
}
}
// ===========================
// 还原列表
public function backuplist()
{

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -18,9 +24,9 @@ class Index extends BaseController
public function main()
{
$adminCount=Db::name('admin')->where('status','1')->count();
$userCount=Db::name('user')->where('status','1')->count();
$articleCount=Db::name('article')->where('status','1')->count();
$adminCount = Db::name('Admin')->where('status', '1')->count();
$userCount = Db::name('User')->where('status', '1')->count();
$articleCount = Db::name('Article')->where('status', '1')->count();
$install = false;
if (file_exists(CMS_ROOT . 'app/install')) {
$install = true;

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -26,8 +32,7 @@ class Keywords extends BaseController
->where($where)
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}
@ -58,7 +63,10 @@ class Keywords extends BaseController
}
$param['update_time'] = time();
$res = Db::name('Keywords')->strict(false)->field(true)->update($param);
if($res) add_log('edit',$param['id'],$param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
@ -69,7 +77,10 @@ class Keywords extends BaseController
}
$param['create_time'] = time();
$insertId = Db::name('Keywords')->strict(false)->field(true)->insertGetId($param);
if($insertId) add_log('add',$insertId,$param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -31,7 +37,7 @@ class Login
return to_assign(0, $e->getError());
}
$admin = Db::name('admin')->where(['username' => $param['username']])->find();
$admin = Db::name('Admin')->where(['username' => $param['username']])->find();
if (empty($admin)) {
return to_assign(0, '用户名或密码错误');
}

View File

@ -1,4 +1,9 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
@ -17,8 +22,7 @@ class Menu extends BaseController
if (request()->isAjax()) {
$menu = Db::name('AdminMenu')->order('sort asc')->select();
return to_assign(0, '', $menu);
}
else{
} else {
return view();
}
}

View File

@ -1,4 +1,9 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
@ -27,8 +32,7 @@ class Nav extends BaseController
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $nav);
}
else{
} else {
return view();
}
}
@ -38,7 +42,7 @@ class Nav extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$nav = Db::name('nav')->where(['id' => $id])->find();
$nav = Db::name('Nav')->where(['id' => $id])->find();
View::assign('nav', $nav);
}
View::assign('id', $id);
@ -112,8 +116,7 @@ class Nav extends BaseController
->order('sort asc')
->select();
return to_assign(0, '', $navInfoList);
}
else{
} else {
return view('', [
'nav_id' => $param['id'],
]);

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -25,8 +31,7 @@ class Role extends BaseController
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $group);
}
else{
} else {
return view();
}
}
@ -36,7 +41,7 @@ class Role extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$role = Db::name('admin_group')->where(['id' => $id])->find();
$role = Db::name('AdminGroup')->where(['id' => $id])->find();
View::assign('role', $role);
}
View::assign('id', $id);
@ -68,7 +73,7 @@ class Role extends BaseController
$param['menus'] = implode(',', $param['menus']);
}
*/
Db::name('admin_group')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
Db::name('AdminGroup')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
add_log('edit', $param['id'], $param);
} else {
try {
@ -85,7 +90,7 @@ class Role extends BaseController
$param['menus'] = implode(',', $param['menus']);
}
*/
$gid = Db::name('admin_group')->strict(false)->field(true)->insertGetId($param);
$gid = Db::name('AdminGroup')->strict(false)->field(true)->insertGetId($param);
add_log('add', $gid, $param);
}
//清除菜单\权限缓存

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -16,8 +22,7 @@ class Rule extends BaseController
if (request()->isAjax()) {
$rule = Db::name('adminRule')->order('create_time asc')->select();
return to_assign(0, '', $rule);
}
else{
} else {
return view();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -23,8 +29,7 @@ class Search extends BaseController
->where($where)
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -28,8 +34,7 @@ class Sitemap extends BaseController
->order('sort desc, id desc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $SitemapCate);
}
else{
} else {
return view();
}
}
@ -60,7 +65,10 @@ class Sitemap extends BaseController
}
$param['update_time'] = time();
$res = SitemapCate::where('id', $param['id'])->strict(false)->field(true)->update($param);
if($res) add_log('edit', $param['id'], $param);
if ($res) {
add_log('edit', $param['id'], $param);
}
// 删除菜单缓存
clear_cache('homeSitemap');
return to_assign();
@ -73,7 +81,10 @@ class Sitemap extends BaseController
}
$param['create_time'] = time();
$sid = SitemapCate::strict(false)->field(true)->insertGetId($param);
if($sid) add_log('add', $sid, $param);
if ($sid) {
add_log('add', $sid, $param);
}
// 删除菜单缓存
clear_cache('homeSitemap');
return to_assign();
@ -115,8 +126,7 @@ class Sitemap extends BaseController
->order('sort desc, id desc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $sitemap);
}
else{
} else {
return view('', [
'sitemap_cate_id' => $param['id'],
]);
@ -152,7 +162,10 @@ class Sitemap extends BaseController
$param['update_time'] = time();
$param['name'] = htmlspecialchars($param['name']);
$res = SitemapInfo::where(['id' => $param['id']])->strict(false)->field(true)->update($param);
if($res) add_log('edit',$param['id'],$param);
if ($res) {
add_log('edit', $param['id'], $param);
}
// 删除导航缓存
clear_cache('homeSitemap');
return to_assign();
@ -166,7 +179,10 @@ class Sitemap extends BaseController
$param['name'] = htmlspecialchars($param['name']);
$param['create_time'] = time();
$sid = SitemapInfo::strict(false)->field(true)->insertGetId($param);
if($sid) add_log('add', $sid, $param);
if ($sid) {
add_log('add', $sid, $param);
}
// 删除导航缓存
clear_cache('homeSitemap');
return to_assign();

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -26,8 +32,7 @@ class Slide extends BaseController
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $slide);
}
else{
} else {
return view();
}
}
@ -37,7 +42,7 @@ class Slide extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$slide = Db::name('slide')->where(['id' => $id])->find();
$slide = Db::name('Slide')->where(['id' => $id])->find();
View::assign('slide', $slide);
}
View::assign('id', $id);
@ -58,7 +63,10 @@ class Slide extends BaseController
}
$param['update_time'] = time();
$res = SlideList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if($res) add_log('edit', $param['id'], $param);
if ($res) {
add_log('edit', $param['id'], $param);
}
clear_cache('homeSlide');
return to_assign();
} else {
@ -70,7 +78,10 @@ class Slide extends BaseController
}
$param['create_time'] = time();
$sid = SlideList::strict(false)->field(true)->insertGetId($param);
if($sid) add_log('add', $sid, $param);
if ($sid) {
add_log('add', $sid, $param);
}
// 删除banner缓存
clear_cache('homeSlide');
return to_assign();
@ -86,7 +97,7 @@ class Slide extends BaseController
'slide_id' => $id,
])->count();
if ($count > 0) {
return to_assign(0, '该组下还有幻灯片,无法删除');
return to_assign(0, '该组下还有Banner,无法删除');
}
if (Db::name('Slide')->delete($id) !== false) {
add_log('delete', $id);
@ -107,13 +118,12 @@ class Slide extends BaseController
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$slideInfoList = SlideInfo::where($where)
->alias('s')
->join('file f', 's.img=f.id', 'LEFT')
->join('File f', 's.img=f.id', 'LEFT')
->field('s.*,f.filepath')
->order('s.sort desc, s.id desc')
->paginate($rows, false, ['query' => $param]);
return table_assign(1, '', $slideInfoList);
}
else{
} else {
return view('', [
'slide_id' => $param['id'],
]);
@ -129,7 +139,7 @@ class Slide extends BaseController
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$slideInfoList = SlideInfo::where($where)
->alias('s')
->join('file f', 's.img=f.id', 'LEFT')
->join('File f', 's.img=f.id', 'LEFT')
->field('s.*,f.filepath')
->order('s.sort desc, s.id desc')
->paginate($rows, false, ['query' => $param]);
@ -165,7 +175,10 @@ class Slide extends BaseController
}
$param['update_time'] = time();
$res = SlideInfo::where(['id' => $param['id']])->strict(false)->field(true)->update($param);
if($res) add_log('edit',$param['id'],$param);
if ($res) {
add_log('edit', $param['id'], $param);
}
// 删除缓存
clear_cache('homeSlide');
return to_assign();
@ -178,7 +191,10 @@ class Slide extends BaseController
}
$param['create_time'] = time();
$sid = SlideInfo::strict(false)->field(true)->insertGetId($param);
if($sid) add_log('add', $sid, $param);
if ($sid) {
add_log('add', $sid, $param);
}
// 删除缓存
clear_cache('homeSlide');
return to_assign();

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
@ -43,8 +49,7 @@ class User extends BaseController
$item->register_time = empty($item->register_time) ? '-' : date('Y-m-d H:i', $item->register_time);
});
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}
@ -53,7 +58,7 @@ class User extends BaseController
public function edit()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$user = Db::name('user')->where(['id' => $id])->find();
$user = Db::name('User')->where(['id' => $id])->find();
View::assign('user', $user);
return view();
}
@ -64,7 +69,7 @@ class User extends BaseController
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
$res = Db::name('user')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
$res = Db::name('User')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
return to_assign();
@ -79,7 +84,7 @@ class User extends BaseController
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$user = Db::name('user')->where(['id' => $id])->find();
$user = Db::name('User')->where(['id' => $id])->find();
add_log('view', get_params('id'));
View::assign('user', $user);
return view();
@ -90,7 +95,7 @@ class User extends BaseController
$id = get_params("id");
$data['status'] = get_params("status");
$data['id'] = $id;
if (Db::name('user')->update($data) !== false) {
if (Db::name('User')->update($data) !== false) {
add_log('edit', $id);
return to_assign(1, "操作成功");
} else {
@ -98,6 +103,7 @@ class User extends BaseController
}
}
//日志
public function log()
{
if (request()->isAjax()) {
@ -107,7 +113,7 @@ class User extends BaseController
$where[] = ['nickname|title', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$content = DB::name('user_log')
$content = DB::name('UserLog')
->field("id,uid,nickname,title,content,ip,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
->order('create_time desc')
->where($where)
@ -128,12 +134,12 @@ class User extends BaseController
$content->offsetSet($k, $data);
}
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}
//记录
public function record()
{
if (request()->isAjax()) {
@ -143,7 +149,7 @@ class User extends BaseController
$where[] = ['nickname|title', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$content = DB::name('user_log')
$content = DB::name('UserLog')
->field("id,uid,nickname,title,content,ip,param,create_time")
->order('create_time desc')
->where($where)
@ -165,8 +171,7 @@ class User extends BaseController
$content->offsetSet($k, $data);
}
return table_assign(1, '', $content);
}
else{
} else {
return view();
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\middleware;
@ -26,8 +32,7 @@ class Auth
if (!Session::has($session_admin)) {
if ($request->isAjax()) {
return to_assign(404, '请先登录');
}
else{
} else {
redirect('/admin/login/index.html')->send();
exit;
}
@ -38,8 +43,7 @@ class Auth
if (!$this->checkAuth($controller, $pathInfo, $action, Session::get($session_admin)['id'])) {
if ($request->isAjax()) {
return to_assign(202, '你没有权限,请联系超级管理员!');
}
else{
} else {
echo '<div style="text-align:center;color:red;margin-top:20%;">您没有权限,请联系超级管理员</div>';exit;
}
}
@ -62,9 +66,9 @@ class Auth
if (!Cache::get('RulesSrc' . $uid) || !Cache::get('RulesSrc0')) {
//用户所在权限组及所拥有的权限
// 执行查询
$user_groups = Db::name('admin_group_access')
$user_groups = Db::name('AdminGroupAccess')
->alias('a')
->join("admin_group g", "a.group_id=g.id", 'LEFT')
->join("AdminGroup g", "a.group_id=g.id", 'LEFT')
->where("a.uid='{$uid}' and g.status='1'")
->select()
->toArray();
@ -76,9 +80,9 @@ class Auth
}
$ids = array_unique($ids);
//读取所有权限规则
$rules_all = Db::name('admin_rule')->field('src')->select();
$rules_all = Db::name('AdminRule')->field('src')->select();
//读取用户组所有权限规则
$rules = Db::name('admin_rule')->where('id', 'in', $ids)->field('src')->select();
$rules = Db::name('AdminRule')->where('id', 'in', $ids)->field('src')->select();
//循环规则,判断结果。
$auth_list_all = [];
$auth_list = [];
@ -99,8 +103,7 @@ class Auth
$pathUrl = $controller . '/' . $pathInfo;
if (!in_array($pathUrl, $auth_list) && !in_array($pathUrl, $auth_list_all)) {
return false;
}
else{
} else {
return true;
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\middleware;

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class Admin extends Model
{

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class AdminGroup extends Model
{

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\model;
@ -20,7 +26,7 @@ class AdminLog extends Model
}
$where['status'] = 1;
$rows = empty($param['limit']) ? get_config('app.pages') : $param['limit'];
$content = \think\facade\Db::name('admin_log')
$content = \think\facade\Db::name('AdminLog')
->field("id,uid,nickname,type,title,module,controller,function,param,content,create_time")
->order('create_time desc')
->where($where)

View File

@ -1,13 +1,21 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
use app\admin\model\Keywords;
use think\Model;
class Article extends Model
{
// 获取文章详情
public function detail($id)
{
$article = \think\facade\Db::name('article')->where(['id' => $id])->find();
$article = \think\facade\Db::name('Article')->where(['id' => $id])->find();
if (empty($article)) {
return $this->error('文章不存在');
}
@ -25,7 +33,8 @@ class Article extends Model
}
//插入关键字
public function insertKeyword($keywordArray=[],$aid){
public function insertKeyword($keywordArray = [], $aid)
{
$insert = [];
$time = time();
foreach ($keywordArray as $key => $value) {
@ -35,7 +44,7 @@ class Article extends Model
$keywords_id = (new Keywords())->increase($value);
$insert[] = ['aid' => $aid,
'keywords_id' => $keywords_id,
'create_time' => $time
'create_time' => $time,
];
}
$res = \think\facade\Db::name('ArticleKeywords')->strict(false)->field(true)->insertAll($insert);

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class ArticleCate extends Model
{

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
// 关键字模型
class Keywords extends Model
{

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class Nav extends Model
{

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class NavInfo extends Model
{

View File

@ -1,4 +1,9 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;

View File

@ -1,6 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class SitemapCate extends Model

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class Slide extends Model
{

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class SlideInfo extends Model
{

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use think\Model;
class User extends Model

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class AdminCheck extends Validate

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class ArticleCateCheck extends Validate

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class ArticleCheck extends Validate
@ -9,7 +16,7 @@ class ArticleCheck extends Validate
'content' => 'require',
'id' => 'require',
'article_cate_id' => 'require',
'status' => 'require'
'status' => 'require',
];
protected $message = [

View File

@ -1,18 +1,25 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class ConfCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:config',
'name' => 'require|unique:config'
'name' => 'require|unique:config',
];
protected $message = [
'title.require' => '配置名称不能为空',
'name.require' => '配置标识不能为空',
'title.unique' => '同样的配置名称已经存在',
'name.unique' => '同样的配置标识已经存在'
'name.unique' => '同样的配置标识已经存在',
];
}

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class GroupCheck extends Validate
@ -7,7 +14,7 @@ class GroupCheck extends Validate
protected $rule = [
'title' => 'require|unique:admin_group',
'id' => 'require',
'status' => 'require|checkStatus:-1,1'
'status' => 'require|checkStatus:-1,1',
];
protected $message = [

View File

@ -1,7 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
use think\facade\Db;
use think\Validate;
class KeywordsCheck extends Validate
{
@ -18,7 +25,7 @@ class KeywordsCheck extends Validate
protected $scene = [
'add' => ['title'],
'edit' => ['id','title']
'edit' => ['id', 'title'],
];
//自定义验证规则

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class MenuCheck extends Validate

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
@ -10,7 +16,7 @@ class NavCheck extends Validate
'name' => 'require|unique:nav',
'id' => 'require',
'status' => 'require',
'slide_id' => 'require'
'slide_id' => 'require',
];
protected $message = [

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;

View File

@ -1,6 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class SitemapCateCheck extends Validate
{
protected $rule = [

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class SitemapCheck extends Validate

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class SlideCheck extends Validate

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class UserCheck extends Validate

View File

@ -1,4 +1,9 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 应用公共文件
use think\facade\Cache;
use think\facade\Config;

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home;

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是home公共文件
//获取当前登录用户的信息
function get_login_user($key = "")
@ -80,8 +86,7 @@ function add_user_log($type, $param_str='', $param_id = 0, $param = [])
$login_user = [];
$login_user['id'] = 0;
$login_user['nickname'] = '游客';
}
else{
} else {
if ($login_user['nickname'] == '') {
$login_user['nickname'] = $login_user['username'];
}

View File

@ -1,10 +1,15 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\home\BaseController;
use think\facade\Db;
use think\facade\View;
class Index extends BaseController

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
@ -36,7 +42,7 @@ class Login
return to_assign(0, $e->getError());
}
$user = Db::name('user')->where(['username' => $param['username']])->find();
$user = Db::name('User')->where(['username' => $param['username']])->find();
if (empty($user)) {
return to_assign(0, '用户名或密码错误');
}
@ -118,7 +124,7 @@ class Login
return to_assign(0, $e->getError());
}
$user = Db::name('user')->where(['username' => $param['username']])->find();
$user = Db::name('User')->where(['username' => $param['username']])->find();
if (!empty($user)) {
return to_assign(0, '该账户已经存在');
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
@ -37,8 +43,7 @@ class User extends BaseController
if ($res !== false) {
add_user_log('edit', '个人信息', $param['id'], $param);
to_assign(1, '操作成功');
}
else{
} else {
to_assign(0, '操作失败');
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\middleware;

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\middleware;

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class UserCheck extends Validate
@ -23,7 +30,7 @@ class UserCheck extends Validate
protected $scene = [
'login' => ['username', 'password', 'captcha'],
'reg' => ['username', 'pwd','captcha']
'reg' => ['username', 'pwd', 'captcha'],
];
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\install\controller;
@ -9,7 +15,8 @@ use think\facade\View;
class Index
{
function __construct(){
public function __construct()
{
// 检测是否安装过
if (is_installed()) {
echo '你已经安装过勾股cms系统!';
@ -147,8 +154,8 @@ return [
'prefix' => '{$data['DB_PREFIX']}',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库编码默认采用utf8mb4
'charset' => 'utf8mb4',
// 数据库调试模式
'debug' => false,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)

View File

@ -1,7 +1,10 @@
/*
Date: 2021-01-08 18:00:00
/**
* @copyright Copyright (c) 2021
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------

View File

@ -1,5 +1,12 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\install\validate;
use think\Validate;
class InstallCheck extends Validate

View File

@ -1,4 +1,9 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 全局中间件定义文件
return [
// 全局请求缓存
@ -6,5 +11,5 @@ return [
// 多语言加载
// \think\middleware\LoadLangPack::class,
// Session初始化
'think\middleware\SessionInit'
'think\middleware\SessionInit',
];

View File

@ -1,4 +1,10 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// [ 应用入口文件 ]
namespace think;
@ -7,7 +13,7 @@ require __DIR__ . '/../vendor/autoload.php';
// 定义当前版本号
define('CMS_VERSION','1.0.0');
// 定义Layui版本号
// 定义ThinkPHP版本号
define('TP_VERSION','6.0.5');
// 定义Layui版本号