勾股CMS2.0版本,重构了系统菜单功能模块、权限模块,新增商品功能,以及其他功能模块的优化。

This commit is contained in:
hdm 2022-02-16 15:39:29 +08:00
parent f2d8f60445
commit 1d15617cb0
13 changed files with 82 additions and 86 deletions

View File

@ -28,7 +28,7 @@ class Admin extends BaseController
$where[] = ['id|username|nickname|desc|mobile', 'like', '%' . $param['keywords'] . '%'];
}
$where[] = ['status','>=',0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$admin = AdminList::where($where)
->order('create_time asc')
->paginate($rows, false, ['query' => $param])
@ -46,72 +46,9 @@ class Admin extends BaseController
//添加
public function add()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$admin = get_admin(get_params('id'));
View::assign('admin', $admin);
}
View::assign('id', $id);
return view();
}
public function to_avatars($char)
{
$defaultData = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'S', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾',
'一', '二', '三', '四', '五', '六', '七', '八', '九', '十');
if (isset($char)) {
$Char = $char;
} else {
$Char = $defaultData[mt_rand(0, count($defaultData) - 1)];
}
$OutputSize = min(512, empty($_GET['size']) ? 36 : intval($_GET['size']));
$Avatar = new MDAvatars($Char, 256, 1);
$avatar_name = '/avatars/avatar_256_' . set_salt(10) . time() . '.png';
$path = get_config('filesystem.disks.public.url') . $avatar_name;
$res = $Avatar->Save('.' . $path, 256);
$Avatar->Free();
/*
if ($res) {
//写入到附件表
$data = [];
$data['filepath'] = $path;
$data['name'] = $Char;
$data['mimetype'] = 'image/png';
$data['fileext'] = 'png';
$data['filesize'] = 0;
$data['filename'] = $avatar_name;
$data['sha1'] = '';
$data['md5'] = '';
$data['module'] = \think\facade\App::initialize()->http->getName();
$data['action'] = app('request')->action();
$data['uploadip'] = app('request')->ip();
$data['create_time'] = time();
$data['user_id'] = get_login_admin('id') ? get_login_admin('id') : 0;
if ($data['module'] = 'admin') {
//通过后台上传的文件直接审核通过
$data['status'] = 1;
$data['admin_id'] = $data['user_id'];
$data['audit_time'] = time();
}
$data['use'] = 'avatar'; //附件用处
$fid = Db::name('file')->insertGetId($data);
return $fid;
}
*/
return $path;
}
//提交添加
public function post_submit()
{
if (request()->isAjax()) {
$param = get_params();
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(AdminCheck::class)->scene('edit')->check($param);
@ -200,7 +137,66 @@ class Admin extends BaseController
}
}
return to_assign();
}
else{
$id = empty(get_params('id')) ? 0 : get_params('id');
if ($id > 0) {
$admin = get_admin(get_params('id'));
View::assign('admin', $admin);
}
View::assign('id', $id);
return view();
}
}
public function to_avatars($char)
{
$defaultData = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'S', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾',
'一', '二', '三', '四', '五', '六', '七', '八', '九', '十');
if (isset($char)) {
$Char = $char;
} else {
$Char = $defaultData[mt_rand(0, count($defaultData) - 1)];
}
$OutputSize = min(512, empty($_GET['size']) ? 36 : intval($_GET['size']));
$Avatar = new MDAvatars($Char, 256, 1);
$avatar_name = '/avatars/avatar_256_' . set_salt(10) . time() . '.png';
$path = get_config('filesystem.disks.public.url') . $avatar_name;
$res = $Avatar->Save('.' . $path, 256);
$Avatar->Free();
/*
if ($res) {
//写入到附件表
$data = [];
$data['filepath'] = $path;
$data['name'] = $Char;
$data['mimetype'] = 'image/png';
$data['fileext'] = 'png';
$data['filesize'] = 0;
$data['filename'] = $avatar_name;
$data['sha1'] = '';
$data['md5'] = '';
$data['module'] = \think\facade\App::initialize()->http->getName();
$data['action'] = app('request')->action();
$data['uploadip'] = app('request')->ip();
$data['create_time'] = time();
$data['user_id'] = get_login_admin('id') ? get_login_admin('id') : 0;
if ($data['module'] = 'admin') {
//通过后台上传的文件直接审核通过
$data['status'] = 1;
$data['admin_id'] = $data['user_id'];
$data['audit_time'] = time();
}
$data['use'] = 'avatar'; //附件用处
$fid = Db::name('file')->insertGetId($data);
return $fid;
}
*/
return $path;
}
//查看
@ -263,7 +259,7 @@ class Admin extends BaseController
if (!empty($param['rule_menu'])) {
$where['rule_menu'] = $param['rule_menu'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = DB::name('AdminLog')
->field("id,uid,nickname,title,content,rule_menu,ip,param_id,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
->order('create_time desc')

View File

@ -129,7 +129,7 @@ class Article extends BaseController
$where[] = ['a.article_cate_id', '=', $param['article_cate_id']];
}
$where[] = ['a.status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = ArticleList::where($where)
->field('a.*,w.id as cate_id,a.id as id,w.title as cate_title,a.title as title')
->alias('a')

View File

@ -23,7 +23,7 @@ class Conf extends BaseController
$param = get_params();
$where = array();
$where[] = ['status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = Db::name('Config')
->where($where)
->paginate($rows, false, ['query' => $param]);

View File

@ -129,7 +129,7 @@ class Goods extends BaseController
$where[] = ['a.cate_id', '=', $param['cate_id']];
}
$where[] = ['a.status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = GoodsList::where($where)
->field('a.*,a.id as id,w.title as cate_title,a.title as title')
->alias('a')

View File

@ -26,7 +26,7 @@ class Keywords extends BaseController
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
}
$where[] = ['status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = Db::name('Keywords')
->order('create_time desc')
->where($where)

View File

@ -27,7 +27,7 @@ class Log extends BaseController
if (!empty($param['action'])) {
$where['action'] = $param['action'];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$rows = empty($param['limit']) ? get_config(''app . page_size'') : $param['limit'];
$content = DB::name('AdminLog')
->field("id,uid,nickname,action,title,content,rule_menu,ip,param_id,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
->order('create_time desc')

View File

@ -27,7 +27,7 @@ class Nav extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['id|name|title|desc', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$nav = NavList::where($where)
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);

View File

@ -26,7 +26,7 @@ class Role extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['id|title|desc', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$group = AdminGroup::where($where)
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);

View File

@ -23,7 +23,7 @@ class Search extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = Db::name('SearchKeywords')
->order('id desc')
->where($where)

View File

@ -29,7 +29,7 @@ class Sitemap extends BaseController
$where[] = ['id|name', 'like', '%' . $param['keywords'] . '%'];
}
$where[] = ['status', '=', 1];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$SitemapCate = SitemapCate::where($where)
->order('sort desc, id desc')
->paginate($rows, false, ['query' => $param]);
@ -118,7 +118,7 @@ class Sitemap extends BaseController
$where = array();
$where[] = ['sitemap_cate_id', '=', $param['id']];
$where[] = ['status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$sitemap = SitemapInfo::where($where)
->order('sort desc, id desc')
->paginate($rows, false, ['query' => $param]);

View File

@ -27,7 +27,7 @@ class Slide extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['id|name|title|desc', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$slide = SlideList::where($where)
->order('create_time asc')
->paginate($rows, false, ['query' => $param]);
@ -112,7 +112,7 @@ class Slide extends BaseController
if (request()->isAjax()) {
$where = array();
$where[] = ['s.slide_id', '=', $param['id']];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$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')
@ -133,7 +133,7 @@ class Slide extends BaseController
$param = get_params();
$where = array();
$where[] = ['s.slide_id', '=', $param['id']];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$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')

View File

@ -41,7 +41,7 @@ class User extends BaseController
$where['register_time'] = array('elt', $end_time);
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = UserList::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
@ -116,7 +116,7 @@ class User extends BaseController
if (!empty($param['action'])) {
$where['title'] = $param['action'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = DB::name('UserLog')
->field("id,uid,nickname,title,content,ip,param_id,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
->order('create_time desc')
@ -154,7 +154,7 @@ class User extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['nickname|title', 'like', '%' . $param['keywords'] . '%'];
}
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = DB::name('UserLog')
->field("id,uid,nickname,title,content,ip,param,create_time")
->order('create_time desc')

View File

@ -9,7 +9,7 @@
namespace think;
if (empty(file_exists(__DIR__ . '/../vendor/autoload.php'))) {
echo '您还未安装PHP依赖包请输入命令安装composer install安装教程点击<a href="https://gitee.com/gougucms/gougucms" target="_blank">这里</a>。';
echo '您还未安装PHP依赖包请输入命令安装composer install安装教程点击<a href="https://blog.gougucms.com/home/book/detail/bid/1/id/2.html" target="_blank">这里</a>。';
exit;
}
require __DIR__ . '/../vendor/autoload.php';
@ -18,7 +18,7 @@ require __DIR__ . '/../vendor/autoload.php';
define('CMS_VERSION','2.0.11');
// 定义ThinkPHP版本号
define('TP_VERSION','6.0.9');
define('TP_VERSION','6.0.12');
// 定义Layui版本号
define('LAYUI_VERSION','2.6.8');