diff --git a/README.md b/README.md index d2b0383..5ff1caf 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - 勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。 - 系统后台各管理模块,一目了然,操作简单;通用型的后台权限管理框架,前后台用户的操作记录覆盖跟踪,紧随潮流、极低门槛、开箱即用。 - 系统易于功能扩展,代码维护,方便二次开发,帮助开发者简单高效降低二次开发的成本,满足专注业务深度开发的需求。 +- 可以快速基于此系统进行ThinkPHP6的快速开发,免去每次都写一次后台基础的痛苦。 - 可去前台版权,真正意义的永久免费,可商用的后台系统。 ### 目录结构 @@ -81,6 +82,62 @@ www 系统部署目录(或者子目录) ├─think 命令行入口文件 ~~~ + +### 主要功能 + +- 后台登录验证 +- 系统配置 +- 系统操作日志管理 +- 用户(组)管理 +- 用户(组)权限 +- 功能管理(同是也是后台菜单来源) +- 导航设置 +- 网站地图 +- 轮播广告 +- TAG关键字管理 +- 文件上传 +- 数据备份/还原 +- 文章功能 +- 用户管理 +- 用户操作日志 +- 前台注册/登录 + +具体功能树如下: + +~~~ +系统 +│ +├─系统管理 +│ ├─系统配置 +│ ├─功能菜单 +│ ├─功能节点 +│ ├─权限角色 +│ ├─管 理 员 +│ ├─操作日志 +│ ├─数据备份 +│ ├─系统配置 +│ ├─数据还原 +│ +├─基础数据 +│ ├─导航设置 +│ ├─网站地图 +│ ├─轮播广告 +│ ├─SEO关键字 +│ ├─搜索关键词 +│ +├─平台用户 +│ ├─用户列表 +│ ├─操作记录 +│ ├─操作日志 +│ +├─资讯中心 +│ ├─文章分类 +│ ├─文章列表 +│ +├─... +~~~ + + ### 安装教程 一、勾股CMS推荐你使用阿里云和腾讯云服务器。 diff --git a/app/admin/view/login/index.html b/app/admin/view/login/index.html index 6f77990..b248311 100644 --- a/app/admin/view/login/index.html +++ b/app/admin/view/login/index.html @@ -51,10 +51,10 @@
- +
- +
diff --git a/app/api/common.php b/app/api/common.php index 2c26559..90ca6f0 100644 --- a/app/api/common.php +++ b/app/api/common.php @@ -1,4 +1,9 @@ ['except' => ['index','login','reg'] ] ]; @@ -31,6 +31,7 @@ class Index extends BaseController { $list = Db::name('Article')->select(); $seo = get_system_config('web'); + add_user_log('api', '首页'); $this->apiSuccess('请求成功',['list' => $list,'seo' => $seo]); } @@ -76,6 +77,7 @@ class Index extends BaseController //获取jwt的句柄 $jwtAuth = JwtAuth::getInstance(); $token = $jwtAuth->setUid($user['id'])->encode()->getToken(); + add_user_log('api', '登录'); $this->apiSuccess('登录成功',['token' => $token]); } } @@ -110,6 +112,7 @@ class Index extends BaseController $char = mb_substr($param['username'], 0, 1, 'utf-8'); $uid = Db::name('User')->strict(false)->field(true)->insertGetId($param); if($uid){ + add_user_log('api', '注册'); $this->apiSuccess('注册成功'); }else{ $this->apiError('注册失败'); @@ -131,6 +134,7 @@ class Index extends BaseController $jwtAuth = JwtAuth::getInstance(); $uid = $jwtAuth->getUid(); $userInfo = Db::name('User')->where(['id' => $uid])->find(); + add_user_log('api', '测试页面'); $this->apiSuccess('请求成功',['list' => $list,'user' => $userInfo]); } diff --git a/app/common.php b/app/common.php index 5ff6e6c..b6d9049 100644 --- a/app/common.php +++ b/app/common.php @@ -273,6 +273,122 @@ function get_file($id) } +//获取当前登录用户的信息 +function get_login_user($key = "") +{ + $session_user = get_config('app.session_user'); + if (\think\facade\Session::has($session_user)) { + $gougu_user = \think\facade\Session::get($session_user); + if (!empty($key)) { + if (isset($gougu_user[$key])) { + return $gougu_user[$key]; + } else { + return ''; + } + } else { + return $gougu_user; + } + } else { + return ''; + } +} +/** + * 客户操作日志 + * @param string $type 操作类型 login reg add edit view delete down join sign play order pay + * @param string $param_str 操作内容 + * @param int $param_id 操作内容id + * @param array $param 提交的参数 + */ +function add_user_log($type, $param_str = '', $param_id = 0, $param = []) +{ + $request = request(); + switch ($type) { + case 'login': + $title = '登录'; + break; + case 'reg': + $title = '注册'; + break; + case 'add': + $title = '新增'; + break; + case 'edit': + $title = '编辑'; + break; + case 'view': + $title = '查看'; + break; + case 'delete': + $title = '删除'; + break; + case 'down': + $title = '下载'; + break; + case 'join': + $title = '报名'; + break; + case 'sign': + $title = '签到'; + break; + case 'play': + $title = '播放'; + break; + case 'order': + $title = '下单'; + break; + case 'pay': + $title = '支付'; + break; + case 'api': + $title = 'API请求'; + break; + case 'install': + $title = '安装'; + break; + default: + $title = '未知'; + break; + } + if ($type == 'login') { + $login_user = \think\facade\Db::name('user')->where(array('id' => $param_id))->find(); + if ($login_user['nickname'] == '') { + $login_user['nickname'] = $login_user['name']; + } + if ($login_user['nickname'] == '') { + $login_user['nickname'] = $login_user['username']; + } + } else { + $login_user = get_login_user(); + if (empty($login_user)) { + $login_user = []; + $login_user['id'] = 0; + $login_user['nickname'] = '游客'; + } else { + if ($login_user['nickname'] == '') { + $login_user['nickname'] = $login_user['username']; + } + } + } + $content = $login_user['nickname'] . '在' . date('Y-m-d H:i:s') . '执行了' . $title . '操作'; + if ($param_str != '') { + $content = $login_user['nickname'] . '在' . date('Y-m-d H:i:s') . $title . '了' . $param_str; + } + $data = []; + $data['uid'] = $login_user['id']; + $data['nickname'] = $login_user['nickname']; + $data['type'] = $type; + $data['title'] = $title; + $data['content'] = $content; + $data['param_id'] = $param_id; + $data['param'] = json_encode($param); + $data['module'] = \think\facade\App::initialize()->http->getName(); + $data['controller'] = app('request')->controller(); + $data['function'] = app('request')->action(); + $data['ip'] = $request->ip(); + $data['create_time'] = time(); + \think\facade\Db::name('user_log')->strict(false)->field(true)->insert($data); +} + /** * 判断是否是手机浏览器 * @return bool diff --git a/app/home/common.php b/app/home/common.php index ed02abf..0b1f61a 100644 --- a/app/home/common.php +++ b/app/home/common.php @@ -6,114 +6,6 @@ */ // 这是home公共文件 -//获取当前登录用户的信息 -function get_login_user($key = "") -{ - $session_user = get_config('app.session_user'); - if (\think\facade\Session::has($session_user)) { - $gougu_user = \think\facade\Session::get($session_user); - if (!empty($key)) { - if (isset($gougu_user[$key])) { - return $gougu_user[$key]; - } else { - return ''; - } - } else { - return $gougu_user; - } - } else { - return ''; - } -} -/** - * 客户操作日志 - * @param string $type 操作类型 login add edit view delete,pay - * @param int $param_id 操作类型 - * @param array $param 提交的参数 - */ -function add_user_log($type, $param_str = '', $param_id = 0, $param = []) -{ - $request = request(); - switch ($type) { - case 'login': - $title = '登录'; - break; - case 'reg': - $title = '注册'; - break; - case 'add': - $title = '新增'; - break; - case 'edit': - $title = '编辑'; - break; - case 'view': - $title = '查看'; - break; - case 'delete': - $title = '删除'; - break; - case 'down': - $title = '下载'; - break; - case 'join': - $title = '报名'; - break; - case 'sign': - $title = '签到'; - break; - case 'play': - $title = '播放'; - break; - case 'order': - $title = '下单'; - break; - case 'pay': - $title = '支付'; - break; - default: - $title = '未知'; - break; - } - if ($type == 'login') { - $login_user = \think\facade\Db::name('user')->where(array('id' => $param_id))->find(); - if ($login_user['nickname'] == '') { - $login_user['nickname'] = $login_user['name']; - } - if ($login_user['nickname'] == '') { - $login_user['nickname'] = $login_user['username']; - } - } else { - $login_user = get_login_user(); - if (empty($login_user)) { - $login_user = []; - $login_user['id'] = 0; - $login_user['nickname'] = '游客'; - } else { - if ($login_user['nickname'] == '') { - $login_user['nickname'] = $login_user['username']; - } - } - } - $content = $login_user['nickname'] . '在' . date('Y-m-d H:i:s') . '执行了' . $title . '操作'; - if ($param_str != '') { - $content = $login_user['nickname'] . '在' . date('Y-m-d H:i:s') . $title . '了' . $param_str; - } - $data = []; - $data['uid'] = $login_user['id']; - $data['nickname'] = $login_user['nickname']; - $data['type'] = $type; - $data['title'] = $title; - $data['content'] = $content; - $data['param_id'] = $param_id; - $data['param'] = json_encode($param); - $data['module'] = \think\facade\App::initialize()->http->getName(); - $data['controller'] = app('request')->controller(); - $data['function'] = app('request')->action(); - $data['ip'] = $request->ip(); - $data['create_time'] = time(); - \think\facade\Db::name('user_log')->strict(false)->field(true)->insert($data); -} //读取导航列表,用于前台 function get_navs($name) diff --git a/app/home/controller/Index.php b/app/home/controller/Index.php index 0cb6374..d29d3d6 100644 --- a/app/home/controller/Index.php +++ b/app/home/controller/Index.php @@ -21,6 +21,12 @@ class Index extends BaseController $count = \think\facade\Db::name('UserLog')->where(array('type' => 'down'))->count(); return View('',['version'=>$version,'count'=>$count]); } + + public function logs() + { + add_user_log('view', '开发日志'); + return View(''); + } public function down() { diff --git a/app/home/controller/Login.php b/app/home/controller/Login.php index c05be0d..0898bed 100644 --- a/app/home/controller/Login.php +++ b/app/home/controller/Login.php @@ -30,6 +30,17 @@ class Login public function errorshow() { return View(); + } + //系统安装提交 + function install_ajax() + { + add_user_log('install', '系统'); + if (!empty($_GET['callback'])) { + return $_GET['callback'] . '("install ok!")'; // jsonp + } + else{ + return to_assign(0, 'install ok!'); + } } //提交登录 public function login_submit() diff --git a/app/home/view/common/footer.html b/app/home/view/common/footer.html index 835e38a..fb81dad 100644 --- a/app/home/view/common/footer.html +++ b/app/home/view/common/footer.html @@ -3,24 +3,24 @@