From a151be4cdfd80b957d4caf1bafbe29144227cb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=AC=E9=9B=A8?= <389625819@qq.com> Date: Wed, 1 Apr 2020 09:59:41 +0800 Subject: [PATCH] no message --- .gitignore | 5 + .travis.yml | 42 + LICENSE.txt | 32 + README.md | 62 + app/.htaccess | 1 + app/BaseController.php | 99 ++ app/ExceptionHandle.php | 58 + app/Request.php | 8 + app/admin/BaseController.php | 118 ++ app/admin/common.php | 90 ++ app/admin/config/session.php | 19 + app/admin/config/view.php | 28 + app/admin/controller/Admin.php | 164 +++ app/admin/controller/Cate.php | 213 ++++ app/admin/controller/Conf.php | 146 +++ app/admin/controller/Content.php | 225 ++++ app/admin/controller/Group.php | 139 ++ app/admin/controller/Index.php | 256 ++++ app/admin/controller/Menu.php | 141 ++ app/admin/controller/Nav.php | 209 +++ app/admin/controller/Publicer.php | 66 + app/admin/controller/Route.php | 132 ++ app/admin/controller/Slide.php | 209 +++ app/admin/event.php | 16 + app/admin/middleware.php | 10 + app/admin/middleware/Auth.php | 93 ++ app/admin/middleware/Install.php | 17 + app/admin/provider.php | 5 + app/admin/template/admin/add.html | 113 ++ app/admin/template/admin/edit.html | 121 ++ app/admin/template/admin/edit_admin_info.html | 94 ++ app/admin/template/admin/index.html | 110 ++ app/admin/template/cate/add_cate.html | 101 ++ app/admin/template/cate/add_group.html | 83 ++ app/admin/template/cate/cate_index.html | 102 ++ app/admin/template/cate/edit_cate.html | 108 ++ app/admin/template/cate/edit_group.html | 84 ++ app/admin/template/cate/index.html | 110 ++ app/admin/template/common/foot.html | 2 + app/admin/template/common/head.html | 11 + app/admin/template/conf/index.html | 196 +++ app/admin/template/content/add_content.html | 120 ++ app/admin/template/content/add_group.html | 93 ++ app/admin/template/content/content_index.html | 103 ++ app/admin/template/content/edit_content.html | 127 ++ app/admin/template/content/edit_group.html | 94 ++ app/admin/template/content/index.html | 110 ++ app/admin/template/group/add.html | 101 ++ app/admin/template/group/edit.html | 111 ++ app/admin/template/group/index.html | 108 ++ app/admin/template/index/console.html | 255 ++++ app/admin/template/index/error_show.html | 30 + app/admin/template/index/index.html | 153 +++ app/admin/template/menu/add.html | 80 ++ app/admin/template/menu/edit.html | 82 ++ app/admin/template/menu/index.html | 101 ++ app/admin/template/nav/add_group.html | 83 ++ app/admin/template/nav/add_nav.html | 96 ++ app/admin/template/nav/edit_group.html | 84 ++ app/admin/template/nav/edit_nav.html | 103 ++ app/admin/template/nav/index.html | 110 ++ app/admin/template/nav/nav_index.html | 103 ++ .../template/publicer/admin_login_page.html | 88 ++ app/admin/template/route/add.html | 63 + app/admin/template/route/edit.html | 71 ++ app/admin/template/route/index.html | 114 ++ app/admin/template/slide/add_group.html | 83 ++ app/admin/template/slide/add_slide.html | 89 ++ app/admin/template/slide/edit_group.html | 84 ++ app/admin/template/slide/edit_slide.html | 96 ++ app/admin/template/slide/index.html | 110 ++ app/admin/template/slide/slide_index.html | 102 ++ app/common.php | 220 ++++ app/event.php | 17 + app/install/controller/Install.php | 198 +++ app/install/data/vaethink.sql | 306 +++++ app/install/validate/Index.php | 45 + app/install/view/install/step1.html | 42 + app/install/view/install/step2.html | 164 +++ app/install/view/install/step3.html | 171 +++ app/middleware.php | 10 + app/middleware/Route.php | 54 + app/provider.php | 9 + composer.json | 48 + composer.lock | 1129 +++++++++++++++++ config/app.php | 36 + config/cache.php | 30 + config/captcha.php | 39 + config/console.php | 9 + config/cookie.php | 18 + config/database.php | 59 + config/filesystem.php | 26 + config/lang.php | 27 + config/log.php | 46 + config/middleware.php | 8 + config/route.php | 45 + config/session.php | 19 + config/trace.php | 10 + config/view.php | 25 + install.lock | 1 + public/.htaccess | 8 + public/favicon.ico | Bin 0 -> 4286 bytes public/index.php | 24 + public/robots.txt | 2 + public/router.php | 17 + public/static/.gitignore | 2 + route/app.php | 17 + think | 10 + 108 files changed, 9876 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 app/.htaccess create mode 100644 app/BaseController.php create mode 100644 app/ExceptionHandle.php create mode 100644 app/Request.php create mode 100644 app/admin/BaseController.php create mode 100644 app/admin/common.php create mode 100644 app/admin/config/session.php create mode 100644 app/admin/config/view.php create mode 100644 app/admin/controller/Admin.php create mode 100644 app/admin/controller/Cate.php create mode 100644 app/admin/controller/Conf.php create mode 100644 app/admin/controller/Content.php create mode 100644 app/admin/controller/Group.php create mode 100644 app/admin/controller/Index.php create mode 100644 app/admin/controller/Menu.php create mode 100644 app/admin/controller/Nav.php create mode 100644 app/admin/controller/Publicer.php create mode 100644 app/admin/controller/Route.php create mode 100644 app/admin/controller/Slide.php create mode 100644 app/admin/event.php create mode 100644 app/admin/middleware.php create mode 100644 app/admin/middleware/Auth.php create mode 100644 app/admin/middleware/Install.php create mode 100644 app/admin/provider.php create mode 100644 app/admin/template/admin/add.html create mode 100644 app/admin/template/admin/edit.html create mode 100644 app/admin/template/admin/edit_admin_info.html create mode 100644 app/admin/template/admin/index.html create mode 100644 app/admin/template/cate/add_cate.html create mode 100644 app/admin/template/cate/add_group.html create mode 100644 app/admin/template/cate/cate_index.html create mode 100644 app/admin/template/cate/edit_cate.html create mode 100644 app/admin/template/cate/edit_group.html create mode 100644 app/admin/template/cate/index.html create mode 100644 app/admin/template/common/foot.html create mode 100644 app/admin/template/common/head.html create mode 100644 app/admin/template/conf/index.html create mode 100644 app/admin/template/content/add_content.html create mode 100644 app/admin/template/content/add_group.html create mode 100644 app/admin/template/content/content_index.html create mode 100644 app/admin/template/content/edit_content.html create mode 100644 app/admin/template/content/edit_group.html create mode 100644 app/admin/template/content/index.html create mode 100644 app/admin/template/group/add.html create mode 100644 app/admin/template/group/edit.html create mode 100644 app/admin/template/group/index.html create mode 100644 app/admin/template/index/console.html create mode 100644 app/admin/template/index/error_show.html create mode 100644 app/admin/template/index/index.html create mode 100644 app/admin/template/menu/add.html create mode 100644 app/admin/template/menu/edit.html create mode 100644 app/admin/template/menu/index.html create mode 100644 app/admin/template/nav/add_group.html create mode 100644 app/admin/template/nav/add_nav.html create mode 100644 app/admin/template/nav/edit_group.html create mode 100644 app/admin/template/nav/edit_nav.html create mode 100644 app/admin/template/nav/index.html create mode 100644 app/admin/template/nav/nav_index.html create mode 100644 app/admin/template/publicer/admin_login_page.html create mode 100644 app/admin/template/route/add.html create mode 100644 app/admin/template/route/edit.html create mode 100644 app/admin/template/route/index.html create mode 100644 app/admin/template/slide/add_group.html create mode 100644 app/admin/template/slide/add_slide.html create mode 100644 app/admin/template/slide/edit_group.html create mode 100644 app/admin/template/slide/edit_slide.html create mode 100644 app/admin/template/slide/index.html create mode 100644 app/admin/template/slide/slide_index.html create mode 100644 app/common.php create mode 100644 app/event.php create mode 100644 app/install/controller/Install.php create mode 100644 app/install/data/vaethink.sql create mode 100644 app/install/validate/Index.php create mode 100644 app/install/view/install/step1.html create mode 100644 app/install/view/install/step2.html create mode 100644 app/install/view/install/step3.html create mode 100644 app/middleware.php create mode 100644 app/middleware/Route.php create mode 100644 app/provider.php create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 config/app.php create mode 100644 config/cache.php create mode 100644 config/captcha.php create mode 100644 config/console.php create mode 100644 config/cookie.php create mode 100644 config/database.php create mode 100644 config/filesystem.php create mode 100644 config/lang.php create mode 100644 config/log.php create mode 100644 config/middleware.php create mode 100644 config/route.php create mode 100644 config/session.php create mode 100644 config/trace.php create mode 100644 config/view.php create mode 100644 install.lock create mode 100644 public/.htaccess create mode 100644 public/favicon.ico create mode 100644 public/index.php create mode 100644 public/robots.txt create mode 100644 public/router.php create mode 100644 public/static/.gitignore create mode 100644 route/app.php create mode 100644 think diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d465120 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/.idea +/.vscode +/vendor +*.log +.env \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36f7b6f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +sudo: false + +language: php + +branches: + only: + - stable + +cache: + directories: + - $HOME/.composer/cache + +before_install: + - composer self-update + +install: + - composer install --no-dev --no-interaction --ignore-platform-reqs + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . + - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" + - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . + +script: + - php think unit + +deploy: + provider: releases + api_key: + secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= + file: + - ThinkPHP_Core.zip + - ThinkPHP_Full.zip + skip_cleanup: true + on: + tags: true diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..574a39c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..abb0098 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +vaeThink 2.0 +=============== + +## 介绍 + +本项目是面向PHP开发者的轻量级内容管理(权限管理)框架 + +本项目采用ThinkPHP6.X + Layui2.X开发 + +本项目包含了权限、多角色、菜单、路由、配置、内容管理等几乎每个项目都需要的基础性功能 + +本项目旨在帮助开发者们直接开始自己的业务逻辑开发 + +> 运行环境要求PHP7.1+。 + +## 特性 + +* 包含所有ThinkPHP6.X的特性 +* 包含所有Layui2.X的特性 +* 原汁原味的ThinkPHP6体验 +* 帮助开发者直接开始自己的业务逻辑 + +## 安装 + +~~~ +1.请配置域名指向项目的public目录 +2.访问你配置的域名并完成安装引导 +~~~ + +如果需要更新ThinkPHP框架请使用 +~~~ +composer update topthink/framework +~~~ + +如果需要更新Layui框架请使用 +~~~ +1.下载最新的Layui +2.替换public/static/admin_static/lib/layui下的所有文件 +~~~ + +## 文档 + +[ThinkPHP6.X完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) +[Layui2.X完全开发手册](https://www.layui.com/doc/) + +## 版权 + +vaeThink遵循Apache2开源协议发布,并提供免费使用。 + +本项目包含的第三方源码和二进制文件之版权信息另行标注。 + +版权所有Copyright © 2018-2020 by vaeThink (http://vaethink.com) + +All rights reserved。 + +## 鸣谢 + +感谢ThinkPHP + +感谢Layui + +感谢所有支持者。 diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/app/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/app/BaseController.php b/app/BaseController.php new file mode 100644 index 0000000..d8ea0d9 --- /dev/null +++ b/app/BaseController.php @@ -0,0 +1,99 @@ +app = $app; + $this->request = $this->app->request; + + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + {} + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @return array|string|true + * @throws ValidateException + */ + protected function validate(array $data, $validate, array $message = [], bool $batch = false) + { + if (is_array($validate)) { + $v = new Validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); + $v = new $class(); + if (!empty($scene)) { + $v->scene($scene); + } + } + + $v->message($message); + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + return $v->failException(true)->check($data); + } + +} diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php new file mode 100644 index 0000000..453d126 --- /dev/null +++ b/app/ExceptionHandle.php @@ -0,0 +1,58 @@ +app = $app; + $this->request = $this->app->request; + + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + $this->user = Session::get('adminToken'); + $this->param = $this->request->param(); + // Session::delete('adminToken'); + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @return array|string|true + * @throws ValidateException + */ + protected function validate(array $data, $validate, array $message = [], bool $batch = false) + { + if (is_array($validate)) { + $v = new Validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); + $v = new $class(); + if (!empty($scene)) { + $v->scene($scene); + } + } + + $v->message($message); + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + try { + $v->failException(true)->check($data); + } catch (\Exception $e) { + return vae_assign(202,$e->getMessage()); + } + + // 系统默认认为需要验证的表单同样需要验证令牌 + $this->checkFormToken(); + + // return $v->failException(true)->check($data); + } + + protected function checkFormToken() + { + $check = $this->request->checkToken('__token__', $this->request->param()); + + if(false === $check) { + return vae_assign(202, '令牌无效,请刷新页面'); + } + + // ... + } +} diff --git a/app/admin/common.php b/app/admin/common.php new file mode 100644 index 0000000..d529de0 --- /dev/null +++ b/app/admin/common.php @@ -0,0 +1,90 @@ +toArray(); + } + if(!empty($data['total'])){ + $res['count'] = $data['total']; + } else { + $res['count'] = 0; + } + $res['data'] = $data['data']; + $response = \think\Response::create($res, "json",$httpCode, $header, $options); + throw new \think\exception\HttpResponseException($response); +} + +//接收参数方法,方便后期解密 +function vae_input($name='') +{ + if($name) { + $param = Request::param($name); + } + else + { + $param = Request::param(); + } + return $param; +} + +//随机字符串,默认长度10 +function vae_set_salt($num = 10){ + $str = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'; + $salt = substr(str_shuffle($str), 10, $num); + return $salt; +} + +//递归排序 +function vae_set_recursion($result,$pid=0,$format="L "){ + /*记录排序后的类别数组*/ + static $list=array(); + + foreach ($result as $k => $v){ + if($v['pid']==$pid){ + if($pid!=0){ + $v['title']=' '.$format.$v['title']; + } + /*将该类别的数据放入list中*/ + $list[]=$v; + vae_set_recursion($result,$v['id'],"  ".$format); + } + } + + return $list; +} + +function vae_list_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'children', $root = 0) +{ + // 创建Tree + $tree = array(); + if (is_array($list)) { + // 创建基于主键的数组引用 + $refer = array(); + foreach ($list as $key => $data) { + $refer[$data[$pk]] =& $list[$key]; + } + foreach ($list as $key => $data) { + // 判断是否存在parent + $parentId = $data[$pid]; + if ($root == $parentId) { + $tree[] =& $list[$key]; + } else { + if (isset($refer[$parentId])) { + $parent =& $refer[$parentId]; + $parent[$child][] =& $list[$key]; + } + } + } + } + return $tree; +} + +//vaeThink加密方式 +function vae_set_password($pwd, $salt){ + return md5(md5($pwd.$salt).$salt); +} \ No newline at end of file diff --git a/app/admin/config/session.php b/app/admin/config/session.php new file mode 100644 index 0000000..60d5bb3 --- /dev/null +++ b/app/admin/config/session.php @@ -0,0 +1,19 @@ + 'PHPSESSID', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // 驱动方式 支持file cache + 'type' => 'file', + // 存储连接标识 当type使用cache的时候有效 + 'store' => null, + // 过期时间 + 'expire' => 1440, + // 前缀 + 'prefix' => 'VAE_ADMIN_', +]; diff --git a/app/admin/config/view.php b/app/admin/config/view.php new file mode 100644 index 0000000..e6ec71b --- /dev/null +++ b/app/admin/config/view.php @@ -0,0 +1,28 @@ + 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, + // 模板目录名 + 'view_dir_name' => 'template', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', + 'tpl_replace_string' => [ + '__AVIEW__' => '/static/admin_static' + ] +]; diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php new file mode 100644 index 0000000..e10e51d --- /dev/null +++ b/app/admin/controller/Admin.php @@ -0,0 +1,164 @@ +request->isAjax()) + { + $param = $this->param; + $where = []; + if(!empty($param['keywords'])) { + $where[] = ['nickname|username|desc','like',$param['keywords'].'%']; + } + $list = Db::name('admin') + ->field('id,username,nickname,status,last_login_time,desc,thumb,groups,last_login_ip') + ->where($where) + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]) + ->each(function($item, $key){ + $item['groupName'] = implode('|',Db::name('admin_group')->where('id','in',explode(',',$item['groups']))->column('title')); + $item['last_login_time'] = date('Y-m-d H:i:s',$item['last_login_time']); + return $item; + }); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + } + + /** + * 添加管理员 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function add() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'username' => 'require|unique:admin', + 'password' => 'require|confirm', + 'nickname' => 'require', + 'thumb' => 'require', + 'group_id' => 'require', + ]); + + $param['salt'] = vae_set_salt(20); + $param['pwd'] = vae_set_password($param['password'],$param['salt']); + $param['groups'] = implode(',',$param['group_id']); + $param['create_time'] = time(); + + if(false == Db::name('admin')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('group',Db::name('admin_group')->where('status',1)->select()->toArray()); + return View::fetch(); + } + + } + + /** + * 修改管理员 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function edit() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'nickname' => 'require', + 'thumb' => 'require', + 'group_id' => 'require', + ]); + + // 不允许其他管理员修改id=1的管理员 + if($param['id'] == 1 and Session::get('admin_tiken')['id'] !== 1) + { + return vae_assign(202,'不允许其他人修改系统所有者'); + } + + unset($param['username']); + if(!empty($param['password'])) { + //重置密码 + if(empty($param['password_confirm']) or $param['password_confirm'] !== $param['password']) { + return vae_assign(202,'两次密码不一致'); + } + $param['salt'] = vae_set_salt(20); + $param['pwd'] = vae_set_password($param['password'],$param['salt']); + } else { + unset($param['pwd']); + unset($param['salt']); + } + $param['groups'] = implode(',',$param['group_id']); + $param['update_time'] = time(); + + if(false == Db::name('admin')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + Cache::delete('uRulesSrc'.$param['id']); + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('admin')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):$data['groups']=explode(',', $data['groups']); + View::assign('data',$data); + View::assign('group',Db::name('admin_group')->where('status',1)->select()->toArray()); + return View::fetch(); + } + } + + /** + * 删除管理员 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function delete() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if ($id == 1) { + return vae_assign(202,"系统拥有者,无法删除!"); + } + if (Db::name('admin')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除管理员成功!"); + } +} diff --git a/app/admin/controller/Cate.php b/app/admin/controller/Cate.php new file mode 100644 index 0000000..d642b00 --- /dev/null +++ b/app/admin/controller/Cate.php @@ -0,0 +1,213 @@ +request->isAjax()) + { + $param = $this->param; + + $list = Db::name('cate_group') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + } + + /** + * 添加导航组 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function addGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'name' => 'require|unique:cate_group', + 'key' => 'require|unique:cate_group', + ]); + + if(false == Db::name('cate_group')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + return View::fetch(); + } + + } + + /** + * 修改导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function editGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'name' => 'require|unique:cate_group', + 'key' => 'require|unique:cate_group', + ]); + + if(false == Db::name('cate_group')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('cate_group')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + /** + * 删除导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function deleteGroup() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + $count = Db::name('cate')->where(["cate_group_id" => $id])->count(); + if ($count > 0) { + return vae_assign(202,"该分组下还存在分类,请先删除分类数据"); + } + if (Db::name('cate_group')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } + + public function cateIndex() + { + $param = $this->param; + + if($this->request->isAjax()) + { + if(empty($param['cate_group_id'])) + { + return vae_assign(202,'非法请求'); + } + + $list = Db::name('cate') + ->where('cate_group_id',$param['cate_group_id']) + ->order('sort desc') + ->select() + ->toArray(); + return vae_assign(0,'',vae_set_recursion($list)); + } + else + { + View::assign('cate_group_id',$param['cate_group_id']); + return View::fetch(); + } + } + + public function addCate() + { + $param = $this->param; + + if($this->request->isPost()) + { + $this->validate($param,[ + 'title' => 'require', + 'cate_group_id' => 'require', + 'pid' => 'require' + ]); + + if(false == Db::name('cate')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('cate_group_id',$param['cate_group_id']); + View::assign('cate',Db::name('cate')->where('cate_group_id',$param['cate_group_id'])->select()->toArray()); + return View::fetch(); + } + + } + + public function editCate() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'title' => 'require', + 'pid' => 'require' + ]); + + if(false == Db::name('cate')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('cate')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + View::assign('cate',Db::name('cate')->where('cate_group_id',$data['cate_group_id'])->select()->toArray()); + return View::fetch(); + } + } + + public function deleteCate() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if(Db::name('cate')->where('pid',$id)->count() > 0) { + return vae_assign(202,'删除失败,该分类下还存在子分类'); + } + if (Db::name('cate')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/controller/Conf.php b/app/admin/controller/Conf.php new file mode 100644 index 0000000..1214074 --- /dev/null +++ b/app/admin/controller/Conf.php @@ -0,0 +1,146 @@ + +// +--------------------------------------------------------------------- +namespace app\admin\controller; +use app\admin\BaseController; +use think\facade\Config; +use think\facade\View; + +class Conf extends BaseController +{ + /** + * 配置首页 + * @Author 听雨 + * @DateTime 2020-03-16 + * @return [type] [description] + */ + public function index() + { + // web配置 + $webconf = Config::get('web'); + View::assign('webConf',[ + 'title' => empty($webconf['title']) ? '' : $webconf['title'], + 'keywords' => empty($webconf['keywords']) ? '' : $webconf['keywords'], + 'desc' => empty($webconf['desc']) ? '' : $webconf['desc'], + 'logo' => empty($webconf['logo']) ? '' : $webconf['logo'], + 'icp' => empty($webconf['icp']) ? '' : $webconf['icp'], + 'code' => empty($webconf['code']) ? '' : $webconf['code'], + ]); + + // email配置 + $emailconf = Config::get('email'); + View::assign('emailConf',[ + 'smtp' => empty($emailconf['smtp']) ? '' : $emailconf['smtp'], + 'username' => empty($emailconf['username']) ? '' : $emailconf['username'], + 'password' => empty($emailconf['password']) ? '' : $emailconf['password'], + 'port' => empty($emailconf['port']) ? '' : $emailconf['port'], + 'email' => empty($emailconf['email']) ? '' : $emailconf['email'], + 'from' => empty($emailconf['from']) ? '' : $emailconf['from'], + ]); + + // 大鱼配置 + $dayuconf = Config::get('dayu'); + View::assign('dayuConf',[ + 'appkey' => empty($dayuconf['appkey']) ? '' : $dayuconf['appkey'], + 'secretkey' => empty($dayuconf['secretkey']) ? '' : $dayuconf['secretkey'], + 'FreeSignName' => empty($dayuconf['FreeSignName']) ? '' : $dayuconf['FreeSignName'] + ]); + + return View::fetch(); + + } + + /** + * 配置提交 + * @Author 听雨 + * @DateTime 2020-03-16 + * @return [type] [description] + */ + public function confSubmit() + { + $param = $this->param; + + switch ($param['type']) { + case 'web': + $this->webConfSubmit($param); + break; + + case 'email': + $this->emailConfSubmit($param); + break; + + default: + $this->dayuConfSubmit($param); + break; + } + } + + //提交网站信息 + private function webConfSubmit($param) + { + $this->validate($param,[ + 'title|网站标题' => 'require', + ]); + + + $conf = "'{$param["title"]}','keywords'=>'{$param["keywords"]}','logo'=>'{$param["logo"]}','desc'=>'{$param["desc"]}','icp'=>'{$param["icp"]}','code'=>'{$param["code"]}'];"; + + try { + file_put_contents(config_path() . "web.php",$conf); + } catch (\Exception $e) { + return vae_assign(202,'配置失败:'.$e->getMessage()); + } + + return vae_assign(200,'配置成功'); + } + + //提交邮箱配置 + private function emailConfSubmit($param) + { + $this->validate($param,[ + 'smtp|smtp服务器' => 'require', + 'username|账户' => 'require', + 'password|密码' => 'require', + 'port|端口' => 'require', + 'email|发件邮箱' => 'require', + 'from|发件人' => 'require', + ]); + + $conf = "'{$param["smtp"]}','username'=>'{$param["username"]}','password'=>'{$param["password"]}','port'=>'{$param["port"]}','email'=>'{$param["email"]}','from'=>'{$param["from"]}'];"; + + try { + file_put_contents(config_path() . "email.php",$conf); + } catch (\Exception $e) { + return vae_assign(202,'配置失败:'.$e->getMessage()); + } + + return vae_assign(200,'配置成功'); + } + + //提交大鱼短信配置 + private function dayuConfSubmit($param) + { + $this->validate($param,[ + 'appkey' => 'require', + 'secretkey' => 'require', + 'FreeSignName|签名' => 'require', + ]); + + $conf = "'{$param["appkey"]}','secretkey'=>'{$param["secretkey"]}','FreeSignName'=>'{$param["FreeSignName"]}'];"; + + try { + file_put_contents(config_path() . "dayu.php",$conf); + } catch (\Exception $e) { + return vae_assign(202,'配置失败:'.$e->getMessage()); + } + + return vae_assign(200,'配置成功'); + } +} diff --git a/app/admin/controller/Content.php b/app/admin/controller/Content.php new file mode 100644 index 0000000..dfac312 --- /dev/null +++ b/app/admin/controller/Content.php @@ -0,0 +1,225 @@ +request->isAjax()) + { + $param = $this->param; + + $list = Db::name('content_group') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + } + + /** + * 添加导航组 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function addGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'name' => 'require|unique:content_group', + 'key' => 'require|unique:content_group', + 'cate_group_id' => 'require', + ]); + + if(false == Db::name('content_group')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('cate_group',Db::name('cate_group')->select()->toArray()); + return View::fetch(); + } + + } + + /** + * 修改导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function editGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'name' => 'require|unique:content_group', + 'key' => 'require|unique:content_group', + 'cate_group_id' => 'require', + ]); + + if(false == Db::name('content_group')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('content_group')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + View::assign('cate_group',Db::name('cate_group')->select()->toArray()); + return View::fetch(); + } + } + + /** + * 删除导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function deleteGroup() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + $count = Db::name('content')->where(["content_group_id" => $id])->count(); + if ($count > 0) { + return vae_assign(202,"该分组下还存在内容,请先删除内容数据"); + } + if (Db::name('content_group')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } + + public function contentIndex() + { + $param = $this->param; + + if($this->request->isAjax()) + { + if(empty($param['content_group_id'])) + { + return vae_assign(202,'非法请求'); + } + + $list = Db::name('content') + ->where('content_group_id',$param['content_group_id']) + ->order('sort create_time desc') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]) + ->each(function($item, $key){ + // $item['img'] = explode(',',$item['img']); + $item['create_time'] = date('Y-m-d',$item['create_time']); + $item['cate_name'] = Db::name('cate')->where('id',$item['cate_id'])->value('title'); + return $item; + }); + return vae_table_assign(0,'',$list); + } + else + { + View::assign('content_group_id',$param['content_group_id']); + return View::fetch(); + } + } + + public function addContent() + { + $param = $this->param; + + if($this->request->isPost()) + { + $this->validate($param,[ + 'title' => 'require', + 'img' => 'require', + 'content_group_id' => 'require', + ]); + + // $param['img'] = implode(',', $param['img']); + + if(false == Db::name('content')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('content_group_id',$param['content_group_id']); + View::assign('cate',Db::name('cate')->where('cate_group_id',Db::name('content_group')->where('id',$param['content_group_id'])->value('cate_group_id'))->select()->toArray()); + return View::fetch(); + } + + } + + public function editContent() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'title' => 'require', + 'img' => 'require', + ]); + + if(false == Db::name('content')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('content')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + View::assign('cate',Db::name('cate')->where('cate_group_id',Db::name('content_group')->where('id',$data['content_group_id'])->value('cate_group_id'))->select()->toArray()); + return View::fetch(); + } + } + + public function deleteContent() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if (Db::name('content')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/controller/Group.php b/app/admin/controller/Group.php new file mode 100644 index 0000000..5099366 --- /dev/null +++ b/app/admin/controller/Group.php @@ -0,0 +1,139 @@ +request->isAjax()) + { + $param = $this->param; + $where = []; + if(!empty($param['keywords'])) { + $where[] = ['title|desc','like',$param['keywords'].'%']; + } + $list = Db::name('admin_group') + ->field('id,title,status,desc') + ->where($where) + ->paginate([ + 'list_rows' => isset($param['list_rows']) ? $param['list_rows'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + + } + + /** + * 添加权限组 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function add() + { + if($this->request->isAjax()) + { + $param = $this->param; + + $this->validate($param,[ + 'title' => 'require|unique:admin_group', + ]); + + $param['rules'] = empty($param['rules'])?'':implode(',',$param['rules']); + $param['create_time'] = time(); + + if(false == Db::name('admin_group')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + return View::fetch(); + } + + } + + /** + * 修改权限组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function edit() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'title' => 'require|unique:admin_group', + ]); + + $param['rules'] = empty($param['rules'])?'':implode(',',$param['rules']); + + $param['update_time'] = time(); + + if(false == Db::name('admin_group')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + Cache::tag('adminRulesSrc')->clear(); + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + + $group = Db::name('admin_group')->find($id); + if(empty($group)) { + return vae_assign(202,'查询的数据不存在'); + } + // 为了配合layui的tree组件存在的bug,这里将已勾选的id倒叙 + $group['rules'] = array_reverse(explode(',',$group['rules'])); + View::assign('group',$group); + return View::fetch(); + } + + } + + /** + * 删除权限组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function delete() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if (Db::name('admin_group')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + Cache::tag('adminRulesSrc')->clear(); + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php new file mode 100644 index 0000000..51d2137 --- /dev/null +++ b/app/admin/controller/Index.php @@ -0,0 +1,256 @@ +user['id']); + if(!Cache::get('uRulesMenu'.$this->user['id'])) + { + //用户所在权限组及所拥有的权限 + if($this->user['id'] == 1) + { + //id=1的管理员默认拥有所有权限 + $uRulesMenu = Db::name('admin_rule')->where('is_menu',1)->order('sort desc')->field('id,pid,title,src as href,font_family as fontFamily,icon')->select()->toArray(); + } + else + { + $uGroupIds = explode(',',Db::name('admin')->where('id',$this->user['id'])->value('groups')); + $uRuleIds = Db::name('admin_group')->where('id','IN',$uGroupIds)->where('status',1)->column('rules','id'); + + $uRules = []; + foreach ($uRuleIds as $k => $v) { + $uRules = array_keys(array_flip($uRules)+array_flip(explode(',',$v))); + } + + //用户所拥有的所有菜单 + $uRulesMenu = Db::name('admin_rule')->where('id','in',$uRules)->where('is_menu',1)->order('sort desc')->field('id,pid,title,src as href,font_family as fontFamily,icon')->select()->toArray(); + } + + foreach ($uRulesMenu as $k => $v) { + if(!empty($v['href'])) { + $uRulesMenu[$k]['href'] = (string)url($v['href']); + } + } + + // 在菜单列表的开头添加首页 + array_unshift($uRulesMenu,['id'=>-1,'pid'=>0,'title'=>'首页','href'=>'','fontFamily'=>'','icon'=>'layui-icon-home']); + + array_push($uRulesMenu,['id'=>-2,'pid'=>0,'title'=>'文档','href'=>'http://vaethink.com','fontFamily'=>'','icon'=>'layui-icon-read']); + + $uRulesMenu = vae_list_to_tree($uRulesMenu); + + Cache::tag('adminRulesSrc')->set('uRulesMenu'.$this->user['id'],$uRulesMenu,36000); + } + $uRulesMenu = Cache::get('uRulesMenu'.$this->user['id']); + + return vae_assign(200,'',$uRulesMenu); + } + + /** + * 清空系统缓存 + * @Author 听雨 + * @DateTime 2020-03-09 + * @return [type] [description] + */ + public function cacheClear() + { + try { + Cache::clear(); + } catch (\Exception $e) { + return vae_assign(202,$e->getMessage()); + } + return vae_assign(200,'清除成功'); + } + + /** + * 管理员退出登录 + * @Author 听雨 + * @DateTime 2020-03-07 + * @return [type] [description] + */ + public function adminLogout() + { + try { + Session::delete('adminToken'); + } catch (\Exception $e) { + return vae_assign(202,$e->getMessage()); + } + return vae_assign(200,'已为您注销登录,再会!',(string)url('admin/publicer/adminLoginPage')); + } + + /** + * 权限节点,用于添加和修改权限组 + * @Author 听雨 + * @DateTime 2020-03-11 + * @return [type] [description] + */ + public function getRuleList() + { + if($this->request->isAjax()) + { + $list = Db::name('admin_rule') + ->field('id,pid,title,is_menu') + ->select() + ->toArray(); + // 配合layui树形组件提供的额外数据 + foreach ($list as $k => $v) { + // 默认全部展开 + // $list[$k]['spread'] = true; + // 标注菜单和纯权限节点 + $v['is_menu'] == 1?$list[$k]['title'] = '权限 菜单 ' . $v['title']:$list[$k]['title'] = '权限 ' . $v['title']; + + // if(!empty($this->param['id'])){ + // $sele = explode(',',Db::name('admin_group')->where('id',$this->param['id'])->value('rules')); + // if(in_array($v['id'], $sele)){ + // // $list[$k]['checked'] = true; + // }else{ + // $list[$k]['checked'] = false; + // } + // } + } + return vae_assign(200,'',vae_list_to_tree($list)); + } + else + { + return vae_assign(202,'非法请求'); + } + } + + /** + * 文件上传 + * @Author 听雨 + * @DateTime 2019-12-04 + * @return [type] [description] + */ + public function upload(){ + // 获取表单上传文件 例如上传了001.jpg + $param['image'] = request()->file('file'); + + // dump($param['image']);die; + + $validate = \think\facade\Validate::rule([ + 'image' => 'require|fileSize:102400|fileExt:jpg,png,jpeg,gif', + ]); + + if (!$validate->check($param)) { + return vae_assign(202,$validate->getError()); + } + // + + $file = $param['image']; + $savename = \think\facade\Filesystem::disk('public')->putFile( 'topic', $file); + + if($savename) { + $path = Config::get('filesystem.disks.public.url'); + $data = $path.'/'.$savename; + return vae_assign(200,'上传成功',$data); + } + else + { + return vae_assign(202,'上传失败,请稍后再试'); + } + } + + /** + * 异常提示页 + * @Author 听雨 + * @DateTime 2020-03-12 + * @param string $msg [description] + * @return [type] [description] + */ + public function errorShow($msg = '你没有这个操作的权限呀~') + { + View::assign('msg',$msg); + return View::fetch(); + } + + /** + * 修改个人资料 + * @Author 听雨 + * @DateTime 2020-03-12 + * @return [type] [description] + */ + public function editAdminInfo() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'nickname' => 'require', + 'thumb' => 'require', + ]); + + if(!empty($param['password'])) + { + //重置密码 + if(empty($param['password_confirm']) or $param['password_confirm'] !== $param['password']) { + return vae_assign(202,'两次密码不一致'); + } + $param['salt'] = vae_set_salt(20); + $param['pwd'] = vae_set_password($param['password'],$param['salt']); + } + else + { + unset($param['pwd']); + unset($param['salt']); + } + + $param['update_time'] = time(); + $param['id'] = Session::get('adminToken')['id']; + + unset($param['groups']); + + if(false == Db::name('admin')->strict(false)->field(true)->update($param)) + { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功,重新登录后生效'); + } + else + { + View::assign('admin',Session::get('adminToken')); + return View::fetch('admin@admin/edit_admin_info'); + } + } +} diff --git a/app/admin/controller/Menu.php b/app/admin/controller/Menu.php new file mode 100644 index 0000000..6f20288 --- /dev/null +++ b/app/admin/controller/Menu.php @@ -0,0 +1,141 @@ +request->isAjax()) + { + $where = []; + if(!empty($param['keywords'])) { + // dump($param['keywords']);die; + $where[] = ['title','like',$this->param['keywords'].'%']; + } + $list = Db::name('admin_rule') + ->field('id,pid,title,is_menu') + ->where($where) + ->select() + ->toArray(); + // 配合layui树形组件提供的额外数据 + foreach ($list as $k => $v) { + // 默认全部展开 + // $list[$k]['spread'] = true; + // 标注菜单和纯权限节点 + $v['is_menu'] == 1?$list[$k]['title'] = '权限 菜单 ' . $v['title']:$list[$k]['title'] = '权限 ' . $v['title']; + } + return vae_assign(200,'',vae_list_to_tree($list)); + } + else + { + return View::fetch(); + } + } + + /** + * 添加 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function add() + { + if($this->request->isAjax()) { + $param = $this->param; + + $this->validate($param,[ + 'pid' => 'require', + 'title' => 'require', + ]); + + $param['is_menu'] = empty($param['is_menu'])?0:$param['is_menu']; + + if(false == Db::name('admin_rule')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + //清除所有菜单缓存 + Cache::tag('adminRulesSrc')->clear(); + return vae_assign(200,'添加成功'); + } else { + View::assign('menu',Db::name('admin_rule')->select()->toArray()); + return View::fetch(); + } + } + + /** + * 修改 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function edit() + { + if($this->request->isPost()) { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'pid' => 'require', + 'title' => 'require', + ]); + + $param['is_menu'] = empty($param['is_menu'])?0:$param['is_menu']; + + if(false == Db::name('admin_rule')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + //清除所有菜单缓存 + Cache::tag('adminRulesSrc')->clear(); + return vae_assign(200,'修改成功'); + } else { + $id = $this->param['id']; + + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + + $data = Db::name('admin_rule')->field('id,pid,title,src,is_menu,font_family,icon,sort')->find($id); + + if(empty($data)) { + return vae_assign(202,'查询的数据不存在'); + } + View::assign('data',$data); + View::assign('menu',Db::name('admin_rule')->select()->toArray()); + return View::fetch(); + } + + } + + /** + * 删除 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function delete() + { + $id = $this->param['id']; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + $count = Db::name('admin_rule')->where(["pid" => $id])->count(); + if ($count > 0) { + return vae_assign(202,"该菜单下还存在子菜单,请先删除子菜单!"); + } + if (Db::name('admin_rule')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/controller/Nav.php b/app/admin/controller/Nav.php new file mode 100644 index 0000000..d8a13bf --- /dev/null +++ b/app/admin/controller/Nav.php @@ -0,0 +1,209 @@ +request->isAjax()) + { + $param = $this->param; + + $list = Db::name('nav_group') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + } + + /** + * 添加导航组 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function addGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'name' => 'require|unique:nav_group', + 'key' => 'require|unique:nav_group', + ]); + + if(false == Db::name('nav_group')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + return View::fetch(); + } + + } + + /** + * 修改导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function editGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'name' => 'require|unique:nav_group', + 'key' => 'require|unique:nav_group', + ]); + + if(false == Db::name('nav_group')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('nav_group')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + /** + * 删除导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function deleteGroup() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + $count = Db::name('nav')->where(["nav_group_id" => $id])->count(); + if ($count > 0) { + return vae_assign(202,"该分组下还存在导航,请先删除导航数据"); + } + if (Db::name('nav_group')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } + + public function navIndex() + { + $param = $this->param; + + if($this->request->isAjax()) + { + if(empty($param['nav_group_id'])) + { + return vae_assign(202,'非法请求'); + } + + $list = Db::name('nav') + ->where('nav_group_id',$param['nav_group_id']) + ->order('sort desc') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + View::assign('nav_group_id',$param['nav_group_id']); + return View::fetch(); + } + } + + public function addNav() + { + $param = $this->param; + + if($this->request->isPost()) + { + $this->validate($param,[ + 'title' => 'require', + 'nav_group_id' => 'require', + ]); + + if(false == Db::name('nav')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('nav_group_id',$param['nav_group_id']); + return View::fetch(); + } + + } + + public function editNav() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'title' => 'require', + ]); + + if(false == Db::name('nav')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('nav')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + public function deleteNav() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if (Db::name('nav')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/controller/Publicer.php b/app/admin/controller/Publicer.php new file mode 100644 index 0000000..1326039 --- /dev/null +++ b/app/admin/controller/Publicer.php @@ -0,0 +1,66 @@ +param; + $this->validate($param,[ + // 'captcha|验证码'=>'require|captcha', + 'username|用户名' => 'require', + 'password|密码' => 'require' + ]); + + $admin = Db::name('admin')->where(['username'=>$param['username']])->find(); + if(empty($admin)) { + return vae_assign(202,'用户名或密码错误'); + } + $param['pwd'] = vae_set_password($param['password'],$admin['salt']); + if($admin['pwd'] !== $param['pwd']) { + return vae_assign(202,'用户名或密码错误'); + } + if($admin['status'] == 0){ + return vae_assign(202,'该用户禁止登陆,请于系统所有者联系'); + } + + Session::set('adminToken', [ + 'id' => $admin['id'], + 'thumb' => $admin['thumb'], + 'nickname' => $admin['nickname'] + ]); + + $data = [ + 'last_login_time' => time(), + 'last_login_ip' => $this->request->ip(), + ]; + Db::name('admin')->where(['id'=>$admin['id']])->update($data); + return vae_assign(200,'登入成功'); + } +} diff --git a/app/admin/controller/Route.php b/app/admin/controller/Route.php new file mode 100644 index 0000000..67f84a8 --- /dev/null +++ b/app/admin/controller/Route.php @@ -0,0 +1,132 @@ + +// +--------------------------------------------------------------------- +namespace app\admin\controller; +use app\admin\BaseController; +use think\facade\Db; +use think\facade\View; +use think\facade\Cache; + +class Route extends BaseController +{ + /** + * 链接美化首页 + * @Author 听雨 + * @DateTime 2020-03-19 + * @return [type] [description] + */ + public function index() + { + if($this->request->isAjax()) + { + $param = $this->param; + $where = array(); + if(!empty($param['keywords'])) { + $where[] = ['id|full_url|url','like',$param['keywords'].'%']; + } + $route = Db::name('route') + ->order('create_time asc') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$route); + } + else + { + return View::fetch(); + } + } + + /** + * 添加链接美化 + * @Author 听雨 + * @DateTime 2020-03-19 + */ + public function add() + { + if($this->request->isPost()) + { + $param = $this->param; + $this->validate($param,[ + 'module' => 'require', + 'full_url' => 'require|unique:route', + 'url' => 'require|unique:route', + ]); + $param['create_time'] = time(); + + if(false == Db::name('route')->strict(false)->field(true)->insert($param)) + { + return vae_assign(202,'创建失败,请稍后再试'); + } + Cache::delete('route_'.$param['module']); + return vae_assign(200,'创建成功'); + } + else + { + return View::fetch(); + } + } + + /** + * 修改链接美化 + * @Author 听雨 + * @DateTime 2020-03-19 + * @return [type] [description] + */ + public function edit() + { + $param = $this->param; + + if($this->request->isPost()) + { + $this->validate($param,[ + 'module' => 'require', + 'full_url' => 'require|unique:route', + 'url' => 'require|unique:route', + 'status' => 'require', + 'id' => 'require', + ]); + + $param['update_time'] = time(); + + if(false == Db::name('route')->strict(false)->field(true)->update($param)) + { + return vae_assign(202,'修改失败,请稍后再试'); + } + Cache::delete('route_'.$param['module']); + return vae_assign(200,'修改成功'); + } + else + { + $data = Db::name('route')->find($param['id']); + empty($data)?vae_assign('202','查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + /** + * 删除链接美化 + * @Author 听雨 + * @DateTime 2020-03-19 + * @return [type] [description] + */ + public function delete() + { + $param = $this->param; + if (Db::name('Route')->delete($param['id']) !== false) { + Cache::delete('route_'.$param['module']); + return vae_assign(200,"删除成功!"); + } else { + return vae_assign(202,"删除失败!"); + } + } +} diff --git a/app/admin/controller/Slide.php b/app/admin/controller/Slide.php new file mode 100644 index 0000000..fe2d745 --- /dev/null +++ b/app/admin/controller/Slide.php @@ -0,0 +1,209 @@ +request->isAjax()) + { + $param = $this->param; + + $list = Db::name('slide_group') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + return View::fetch(); + } + } + + /** + * 添加导航组 + * @Author 听雨 + * @DateTime 2019-11-21 + */ + public function addGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'name' => 'require|unique:slide_group', + 'key' => 'require|unique:slide_group', + ]); + + if(false == Db::name('slide_group')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + return View::fetch(); + } + + } + + /** + * 修改导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function editGroup() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'name' => 'require|unique:slide_group', + 'key' => 'require|unique:slide_group', + ]); + + if(false == Db::name('slide_group')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('slide_group')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + /** + * 删除导航组 + * @Author 听雨 + * @DateTime 2019-11-22 + * @return [type] [description] + */ + public function deleteGroup() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + $count = Db::name('slide')->where(["slide_group_id" => $id])->count(); + if ($count > 0) { + return vae_assign(202,"该分组下还存在轮播图,请先删除轮播图数据"); + } + if (Db::name('slide_group')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } + + public function slideIndex() + { + $param = $this->param; + + if($this->request->isAjax()) + { + if(empty($param['slide_group_id'])) + { + return vae_assign(202,'非法请求'); + } + + $list = Db::name('slide') + ->where('slide_group_id',$param['slide_group_id']) + ->order('sort desc') + ->paginate([ + 'list_rows' => isset($param['limit']) ? $param['limit'] : 20, + 'page' => isset($param['page']) ? $param['page'] : 1, + 'query' => $param + ]); + return vae_table_assign(0,'',$list); + } + else + { + View::assign('slide_group_id',$param['slide_group_id']); + return View::fetch(); + } + } + + public function addSlide() + { + $param = $this->param; + + if($this->request->isPost()) + { + $this->validate($param,[ + 'icon' => 'require', + 'slide_group_id' => 'require', + ]); + + if(false == Db::name('slide')->strict(false)->field(true)->insert($param)) { + return vae_assign(202,'创建失败,请稍后再试'); + } + return vae_assign(200,'创建成功'); + } + else + { + View::assign('slide_group_id',$param['slide_group_id']); + return View::fetch(); + } + + } + + public function editSlide() + { + if($this->request->isPost()) + { + $param = $this->param; + + $this->validate($param,[ + 'id' => 'require', + 'icon' => 'require', + ]); + + if(false == Db::name('slide')->strict(false)->field(true)->update($param)) { + return vae_assign(202,'修改失败,请稍后再试'); + } + + return vae_assign(200,'修改成功'); + } + else + { + $id = $this->param['id']; + $data = Db::name('slide')->find($id); + empty($data)?vae_assign(202,'查询的数据不存在'):View::assign('data',$data); + return View::fetch(); + } + } + + public function deleteSlide() + { + $id = $this->param["id"]; + if(!$id) { + return vae_assign(202,'缺少必要条件'); + } + if (Db::name('slide')->delete($id) == false) { + return vae_assign(202,"删除失败!"); + } + return vae_assign(200,"删除成功!"); + } +} diff --git a/app/admin/event.php b/app/admin/event.php new file mode 100644 index 0000000..94d78e5 --- /dev/null +++ b/app/admin/event.php @@ -0,0 +1,16 @@ + [ + ], + + 'listen' => [ + 'HttpRun' => [], + 'HttpEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], + ], + + 'subscribe' => [ + ], +]; diff --git a/app/admin/middleware.php b/app/admin/middleware.php new file mode 100644 index 0000000..568ec8b --- /dev/null +++ b/app/admin/middleware.php @@ -0,0 +1,10 @@ +ext(),'',$request->pathInfo())); + + if(count($pathInfo) !== 2) + { + // 由于中间件里不能正常使用$request->controller()获取用户访问的控制器及方法,因此只能通过pathInfo来获取url并进行截取,但这就要求用户访问时必须输入完整的url,不然就抛出异常 + return abort(202, '非法请求,请输入完整的url'); + } + + $controller = strtolower($pathInfo[0]); + $action = strtolower($pathInfo[1]); + + //验证用户登录 + if($controller !== 'publicer') + { + if(!Session::has('adminToken')) + { + return $request->isAjax()?vae_assign(404,'请先登录'):redirect((string)url('/admin/publicer/adminLoginPage')); + } + + // 验证用户访问权限 + if($controller !== 'index') + { + if(!$this->checkAuth($controller,$action,Session::get('adminToken')['id'])) + { + return $request->isAjax()?vae_assign(202,'你没有权限!'):redirect((string)url('/admin/index/errorShow')); + } + } + } + + return $next($request); + } + + /** + * 验证用户访问权限 + * @Author 听雨 + * @DateTime 2019-11-21 + * @param string $controller 当前访问控制器 + * @param string $action 当前访问方法 + * @param string $uid 当前用户id + * @return [type] + */ + protected function checkAuth($controller,$action,$uid) + { + // Cache::delete('uRulesSrc'.$uid); + if($uid == 1) + { + // id=1的管理员默认拥有所有权限 + return true; + } + else + { + if(!Cache::get('uRulesSrc'.$uid)) + { + + //用户所在权限组及所拥有的权限 + $uGroupIds = explode(',',Db::name('admin')->where('id',$uid)->value('groups')); + $uRuleIds = Db::name('admin_group')->where('id','IN',$uGroupIds)->where('status',1)->column('rules','id'); + + $uRules = []; + foreach ($uRuleIds as $k => $v) { + $uRules = array_keys(array_flip($uRules)+array_flip(explode(',',$v))); + } + //用户所拥有的所有权限节点 + $uRulesSrc = Db::name('admin_rule')->where('id','in',$uRules)->column('src','id'); + Cache::tag('adminRulesSrc')->set('uRulesSrc'.$uid,$uRulesSrc,36000); + } + else + { + $uRulesSrc = Cache::get('uRulesSrc'.$uid); + } + + if(!in_array((string)$controller.'/'.$action, $uRulesSrc)) + { + return false; + } + + return true; + } + } +} diff --git a/app/admin/middleware/Install.php b/app/admin/middleware/Install.php new file mode 100644 index 0000000..293128b --- /dev/null +++ b/app/admin/middleware/Install.php @@ -0,0 +1,17 @@ +isAjax()?vae_assign(202,'请先完成系统安装引导'):redirect((string)url('/install/install/index')); + } + + return $next($request); + } +} diff --git a/app/admin/provider.php b/app/admin/provider.php new file mode 100644 index 0000000..5a99e25 --- /dev/null +++ b/app/admin/provider.php @@ -0,0 +1,5 @@ + + +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ {volist name="$group" id="v"} + + {/volist} +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+ + +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/admin/edit.html b/app/admin/template/admin/edit.html new file mode 100644 index 0000000..697832a --- /dev/null +++ b/app/admin/template/admin/edit.html @@ -0,0 +1,121 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ {volist name="$group" id="v"} + + {/volist} +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/admin/edit_admin_info.html b/app/admin/template/admin/edit_admin_info.html new file mode 100644 index 0000000..0daa454 --- /dev/null +++ b/app/admin/template/admin/edit_admin_info.html @@ -0,0 +1,94 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/admin/index.html b/app/admin/template/admin/index.html new file mode 100644 index 0000000..c8d0467 --- /dev/null +++ b/app/admin/template/admin/index.html @@ -0,0 +1,110 @@ +{include file="common/head"} + +
+ + +
+
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/cate/add_cate.html b/app/admin/template/cate/add_cate.html new file mode 100644 index 0000000..fc36706 --- /dev/null +++ b/app/admin/template/cate/add_cate.html @@ -0,0 +1,101 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/cate/add_group.html b/app/admin/template/cate/add_group.html new file mode 100644 index 0000000..f63a2de --- /dev/null +++ b/app/admin/template/cate/add_group.html @@ -0,0 +1,83 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/cate/cate_index.html b/app/admin/template/cate/cate_index.html new file mode 100644 index 0000000..623fbbc --- /dev/null +++ b/app/admin/template/cate/cate_index.html @@ -0,0 +1,102 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/cate/edit_cate.html b/app/admin/template/cate/edit_cate.html new file mode 100644 index 0000000..9d63610 --- /dev/null +++ b/app/admin/template/cate/edit_cate.html @@ -0,0 +1,108 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/cate/edit_group.html b/app/admin/template/cate/edit_group.html new file mode 100644 index 0000000..0b79f2e --- /dev/null +++ b/app/admin/template/cate/edit_group.html @@ -0,0 +1,84 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/cate/index.html b/app/admin/template/cate/index.html new file mode 100644 index 0000000..48a3dc4 --- /dev/null +++ b/app/admin/template/cate/index.html @@ -0,0 +1,110 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/common/foot.html b/app/admin/template/common/foot.html new file mode 100644 index 0000000..6736652 --- /dev/null +++ b/app/admin/template/common/foot.html @@ -0,0 +1,2 @@ + + diff --git a/app/admin/template/common/head.html b/app/admin/template/common/head.html new file mode 100644 index 0000000..e15809b --- /dev/null +++ b/app/admin/template/common/head.html @@ -0,0 +1,11 @@ + + + + + vaeThink + + + + + + \ No newline at end of file diff --git a/app/admin/template/conf/index.html b/app/admin/template/conf/index.html new file mode 100644 index 0000000..fc9bc6a --- /dev/null +++ b/app/admin/template/conf/index.html @@ -0,0 +1,196 @@ +{include file="common/head"} + +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+
+
+
+
+ +
+ +
如qq邮箱的SMTP服务器地址是smtp.qq.com
+
+
+
+ +
+ +
+
+
+ +
+ +
不一定是登录密码,如qq的第三方授权登录码,要自己去开启,在邮箱的设置->账户->POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务
+
+
+
+ +
+ +
如qq邮箱的ssl协议方式端口号是465/587
+
+
+
+ +
+ +
可以不同于上面的账户,用于显示发送方的邮箱
+
+
+
+ +
+ +
如:vaeThink
+
+
+ {:token_meta()} +
+
+ + + +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+
+
+
+ + + +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/content/add_content.html b/app/admin/template/content/add_content.html new file mode 100644 index 0000000..1c2d4ce --- /dev/null +++ b/app/admin/template/content/add_content.html @@ -0,0 +1,120 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + + + + + \ No newline at end of file diff --git a/app/admin/template/content/add_group.html b/app/admin/template/content/add_group.html new file mode 100644 index 0000000..d650974 --- /dev/null +++ b/app/admin/template/content/add_group.html @@ -0,0 +1,93 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/content/content_index.html b/app/admin/template/content/content_index.html new file mode 100644 index 0000000..8841c8e --- /dev/null +++ b/app/admin/template/content/content_index.html @@ -0,0 +1,103 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/content/edit_content.html b/app/admin/template/content/edit_content.html new file mode 100644 index 0000000..21f5556 --- /dev/null +++ b/app/admin/template/content/edit_content.html @@ -0,0 +1,127 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + + + + + \ No newline at end of file diff --git a/app/admin/template/content/edit_group.html b/app/admin/template/content/edit_group.html new file mode 100644 index 0000000..bb7d5d1 --- /dev/null +++ b/app/admin/template/content/edit_group.html @@ -0,0 +1,94 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/content/index.html b/app/admin/template/content/index.html new file mode 100644 index 0000000..89c3629 --- /dev/null +++ b/app/admin/template/content/index.html @@ -0,0 +1,110 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/group/add.html b/app/admin/template/group/add.html new file mode 100644 index 0000000..2da16b0 --- /dev/null +++ b/app/admin/template/group/add.html @@ -0,0 +1,101 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+ +
+ +
+
+
+
+ + + +
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ + +{include file="common/foot"} + + \ No newline at end of file diff --git a/app/admin/template/group/edit.html b/app/admin/template/group/edit.html new file mode 100644 index 0000000..4d4a3fd --- /dev/null +++ b/app/admin/template/group/edit.html @@ -0,0 +1,111 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ + +{include file="common/foot"} + + \ No newline at end of file diff --git a/app/admin/template/group/index.html b/app/admin/template/group/index.html new file mode 100644 index 0000000..a1176f5 --- /dev/null +++ b/app/admin/template/group/index.html @@ -0,0 +1,108 @@ +{include file="common/head"} + +
+ + +
+
+ + + + + + + +{include file="common/foot"} + + + + + \ No newline at end of file diff --git a/app/admin/template/index/console.html b/app/admin/template/index/console.html new file mode 100644 index 0000000..5b3623b --- /dev/null +++ b/app/admin/template/index/console.html @@ -0,0 +1,255 @@ + + + + + vaeThink + + + + + + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+ + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/app/admin/template/index/error_show.html b/app/admin/template/index/error_show.html new file mode 100644 index 0000000..92574e7 --- /dev/null +++ b/app/admin/template/index/error_show.html @@ -0,0 +1,30 @@ + + + + + 异常 + + + + +
+ + {$msg} +
+ + \ No newline at end of file diff --git a/app/admin/template/index/index.html b/app/admin/template/index/index.html new file mode 100644 index 0000000..dda3783 --- /dev/null +++ b/app/admin/template/index/index.html @@ -0,0 +1,153 @@ + + + + + vaeThink-超好用的PHP(ThinkPHP6,Layui)内容管理框架 + + + + + + +
+ +
+ + +
+ +
+ +
+
+
+ + + +

欢迎,{$uInfo.nickname}

+
+ + +
+
+ + +
+
+
+
+ + +
    +
  • + + + 首页 +
  • +
+ +
+
+ +
+
+
+
+ +
+
+ + + + + diff --git a/app/admin/template/menu/add.html b/app/admin/template/menu/add.html new file mode 100644 index 0000000..9766f9f --- /dev/null +++ b/app/admin/template/menu/add.html @@ -0,0 +1,80 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/menu/edit.html b/app/admin/template/menu/edit.html new file mode 100644 index 0000000..be1d01d --- /dev/null +++ b/app/admin/template/menu/edit.html @@ -0,0 +1,82 @@ +{include file="common/head"} + +
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/menu/index.html b/app/admin/template/menu/index.html new file mode 100644 index 0000000..159a16c --- /dev/null +++ b/app/admin/template/menu/index.html @@ -0,0 +1,101 @@ +{include file="common/head"} +
+ +
+ +
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/nav/add_group.html b/app/admin/template/nav/add_group.html new file mode 100644 index 0000000..9742450 --- /dev/null +++ b/app/admin/template/nav/add_group.html @@ -0,0 +1,83 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/nav/add_nav.html b/app/admin/template/nav/add_nav.html new file mode 100644 index 0000000..0a34e14 --- /dev/null +++ b/app/admin/template/nav/add_nav.html @@ -0,0 +1,96 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/nav/edit_group.html b/app/admin/template/nav/edit_group.html new file mode 100644 index 0000000..fd160cc --- /dev/null +++ b/app/admin/template/nav/edit_group.html @@ -0,0 +1,84 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/nav/edit_nav.html b/app/admin/template/nav/edit_nav.html new file mode 100644 index 0000000..2ab1b83 --- /dev/null +++ b/app/admin/template/nav/edit_nav.html @@ -0,0 +1,103 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/nav/index.html b/app/admin/template/nav/index.html new file mode 100644 index 0000000..5369e1f --- /dev/null +++ b/app/admin/template/nav/index.html @@ -0,0 +1,110 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/nav/nav_index.html b/app/admin/template/nav/nav_index.html new file mode 100644 index 0000000..ef0d951 --- /dev/null +++ b/app/admin/template/nav/nav_index.html @@ -0,0 +1,103 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/publicer/admin_login_page.html b/app/admin/template/publicer/admin_login_page.html new file mode 100644 index 0000000..b9fbbcf --- /dev/null +++ b/app/admin/template/publicer/admin_login_page.html @@ -0,0 +1,88 @@ + + + + + 登录 + + + + +
+ +
+
+ +
+
+ +
+
+
+ {:token_meta()} +
+ +
+
+ + + + \ No newline at end of file diff --git a/app/admin/template/route/add.html b/app/admin/template/route/add.html new file mode 100644 index 0000000..ecb930d --- /dev/null +++ b/app/admin/template/route/add.html @@ -0,0 +1,63 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
url格式一般为name/:参数1/:参数2
+
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/route/edit.html b/app/admin/template/route/edit.html new file mode 100644 index 0000000..4ca5e70 --- /dev/null +++ b/app/admin/template/route/edit.html @@ -0,0 +1,71 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
url格式一般为name/:参数1/:参数2
+
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/route/index.html b/app/admin/template/route/index.html new file mode 100644 index 0000000..aa60d76 --- /dev/null +++ b/app/admin/template/route/index.html @@ -0,0 +1,114 @@ +{include file="common/head"} + +
+ + +
+
+ + + + + + + +{include file="common/foot"} + + + + + \ No newline at end of file diff --git a/app/admin/template/slide/add_group.html b/app/admin/template/slide/add_group.html new file mode 100644 index 0000000..20c1d3b --- /dev/null +++ b/app/admin/template/slide/add_group.html @@ -0,0 +1,83 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/slide/add_slide.html b/app/admin/template/slide/add_slide.html new file mode 100644 index 0000000..f0e819c --- /dev/null +++ b/app/admin/template/slide/add_slide.html @@ -0,0 +1,89 @@ +{include file="common/head"} + +
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/slide/edit_group.html b/app/admin/template/slide/edit_group.html new file mode 100644 index 0000000..359880a --- /dev/null +++ b/app/admin/template/slide/edit_group.html @@ -0,0 +1,84 @@ +{include file="common/head"} + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/slide/edit_slide.html b/app/admin/template/slide/edit_slide.html new file mode 100644 index 0000000..be52173 --- /dev/null +++ b/app/admin/template/slide/edit_slide.html @@ -0,0 +1,96 @@ +{include file="common/head"} + +
+
+ +
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ {:token_meta()} +
+
+ + + +
+
+
+ +{include file="common/foot"} + + + + \ No newline at end of file diff --git a/app/admin/template/slide/index.html b/app/admin/template/slide/index.html new file mode 100644 index 0000000..810e612 --- /dev/null +++ b/app/admin/template/slide/index.html @@ -0,0 +1,110 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/admin/template/slide/slide_index.html b/app/admin/template/slide/slide_index.html new file mode 100644 index 0000000..1b154da --- /dev/null +++ b/app/admin/template/slide/slide_index.html @@ -0,0 +1,102 @@ +{include file="common/head"} + +
+ + + + + + +{include file="common/foot"} + + + + + diff --git a/app/common.php b/app/common.php new file mode 100644 index 0000000..7cf8b5b --- /dev/null +++ b/app/common.php @@ -0,0 +1,220 @@ +$code]; + $res['msg']=$msg; + $res['url']=$url; + if(is_object($data)){ + $data=$data->toArray(); + } + $res['data']=$data; + $response = \think\Response::create($res, "json",$httpCode, $header, $options); + throw new \think\exception\HttpResponseException($response); +} + +/** + * 发邮件 + * @Author 听雨 + * @DateTime 2020-03-20 + * @param [type] $toemail 收件邮箱 + * @param [type] $toName 收件人称呼 + * @param [type] $title 邮件标题 + * @param [type] $content 邮件正文 + * @param string $fromEmail 发件邮箱 + * @param string $fromName 发件人称呼 + * @param string $replyEmail 回复邮箱 + * @param string $replyName 回复人称呼 + * @return [type] [description] + */ +function vae_send_email($toemail, $toName, $title, $content, $fromEmail = "", $fromName = "", $replyEmail = "", $replyName=""){ + $config = Config::get('email'); + + if(NULL == $config) { + abort(0,'请先在系统->配置->邮箱配置中配置您的SMTP信息且完成提交'); + } + + $fromEmail = $fromEmail?$fromEmail:$config['email']; + $fromName = $fromName?$fromName:$config['from']; + $replyEmail = $replyEmail?$replyEmail:$fromEmail; + $replyName = $replyName?$replyName:$fromName; + + $mail = new PHPMailer(true); + + //Server settings + // $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output + $mail->isSMTP(); // Send using SMTP + $mail->CharSet = "utf8"; // 编码格式为utf8,不设置编码的话,中文会出现乱码 + $mail->Host = $config['smtp']; // Set the SMTP server to send through + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $config['username']; // SMTP username + $mail->Password = $config['password']; // SMTP password + $mail->SMTPSecure = 'ssl'; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged + $mail->Port = $config['port']; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above + + //Recipients + $mail->setFrom($fromEmail, "=?UTF-8?B?".base64_encode($fromName)."?="); + $mail->addAddress($toemail, "=?UTF-8?B?".base64_encode($toName)."?="); // Add a recipient + // $mail->addAddress('ellen@example.com'); // Name is optional + $mail->addReplyTo($replyEmail, "=?UTF-8?B?".base64_encode($replyName)."?="); + // $mail->addCC('cc@example.com'); + // $mail->addBCC('bcc@example.com'); + + // Attachments + // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments + // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name + + // Content + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = "=?UTF-8?B?".base64_encode($title)."?="; + $mail->Body = $content; + // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; + + $mail->send(); +} + +/** + * 阿里大鱼发短信 + * @Author 听雨 + * @DateTime 2020-03-16 + * @param [type] $phone [description] + * @param [type] $param [description] + * @param [type] $code [description] + * @param string $type [description] + * @return [type] [description] + */ +function vae_send_sms($phone, $param, $code, $type = "normal") +{ + // 配置信息 + include root_path()."extend/dayu/top/TopClient.php"; + include root_path()."extend/dayu/top/TopLogger.php"; + include root_path()."extend/dayu/top/request/AlibabaAliqinFcSmsNumSendRequest.php"; + include root_path()."extend/dayu/top/ResultSet.php"; + include root_path()."extend/dayu/top/RequestCheckUtil.php"; + + $c = new \TopClient(); + $conf = Config::get('dayu'); + $c ->appkey = $conf['appkey']; + $c ->secretKey = $conf['secretkey']; + + $req = new \AlibabaAliqinFcSmsNumSendRequest(); + //公共回传参数,在“消息返回”中会透传回该参数。非必须 + $req ->setExtend(""); + //短信类型,传入值请填写normal + $req ->setSmsType($type); + //短信签名,传入的短信签名必须是在阿里大于“管理中心-验证码/短信通知/推广短信-配置短信签名”中的可用签名。 + $req ->setSmsFreeSignName($conf['FreeSignName']); + //短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。 + $req ->setSmsParam($param); + //短信接收号码。支持单个或多个手机号码,传入号码为11位手机号码,不能加0或+86。群发短信需传入多个号码,以英文逗号分隔,一次调用最多传入200个号码。 + $req ->setRecNum($phone); + //短信模板ID,传入的模板必须是在阿里大于“管理中心-短信模板管理”中的可用模板。 + $req ->setSmsTemplateCode($code); + //发送 + $resp = $c ->execute($req); +} + +/** + * url中现有的参数+点击的连接中包含的参数合并计算 + * @Author 听雨 + * @DateTime 2020-03-16 + * @param array $params [description] + * @param string $url [description] + * @return [type] [description] + */ +function vae_get_route_url($params = [], $url = '') +{ + $get = request()->param(); + foreach ($get as $urlparam => $value) { + if (strpos($urlparam, $request()->action())) { + unset($get[$urlparam]); + } else { + $get[$urlparam] = urldecode($value); + } + } + + if (is_array($params)) { + $get = array_merge($get, $params); + } + if (empty($url)) { + return url($request()->action(), $get); + } else { + return url($url, $get); + } + +} + +/** + * 根据导航组的标识获取导航数据集 + * @Author 听雨 + * @DateTime 2020-03-19 + * @param string $key [description] + * @return [type] [description] + */ +function vae_get_nav(string $key) +{ + if(Cache::has('NAV_'.$key)) + { + $nav = Cache::get('NAV_'.$key); + } + else + { + $groupId = Db::name('nav_group')->where('key',$key)->value('id'); + if(!$groupId) + { + return abort('404','导航组不存在'); + } + $nav = Db::name('nav')->where('nav_group_id',$groupId)->field('title,icon,app_src,wechat_src,sort')->select()->toArray(); + foreach ($nav as $k => $v) { + $nav[$k]['icon'] = Config::get('web.domain').$v['icon']; + } + Cache::set('NAV_'.$key,$nav); + } + return $nav; +} + +/** + * 根据轮播组的标识获取轮播数据集 + * @Author 听雨 + * @DateTime 2020-03-19 + * @param string $key [description] + * @return [type] [description] + */ +function vae_get_slide(string $key) +{ + if(Cache::has('SLIDE_'.$key)) + { + $slide = Cache::get('SLIDE_'.$key); + } + else + { + $groupId = Db::name('slide_group')->where('key',$key)->value('id'); + if(!$groupId) + { + return abort('404','轮播组不存在'); + } + $slide = Db::name('slide')->where('slide_group_id',$groupId)->field('title,icon,src,sort')->select()->toArray(); + foreach ($slide as $k => $v) { + $slide[$k]['icon'] = Config::get('web.domain').$v['icon']; + } + Cache::set('SLIDE_'.$key,$slide); + } + return $slide; +} \ No newline at end of file diff --git a/app/event.php b/app/event.php new file mode 100644 index 0000000..e9851bb --- /dev/null +++ b/app/event.php @@ -0,0 +1,17 @@ + [ + ], + + 'listen' => [ + 'AppInit' => [], + 'HttpRun' => [], + 'HttpEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], + ], + + 'subscribe' => [ + ], +]; diff --git a/app/install/controller/Install.php b/app/install/controller/Install.php new file mode 100644 index 0000000..9fb0873 --- /dev/null +++ b/app/install/controller/Install.php @@ -0,0 +1,198 @@ + +// +--------------------------------------------------------------------- +namespace app\install\controller; +use app\BaseController; +use think\facade\View; +use app\install\validate\Index; +use mysqli; + +class Install extends BaseController +{ + public function _initialize() + { + parent::_initialize(); + + static $vaeIsInstalled; + if (empty($vaeIsInstalled)) { + $vaeIsInstalled = file_exists(root_path() . 'install.lock'); + + if ($vaeIsInstalled) { + return json('你已经安装过该系统!'); + } + } + } + + public function index() + { + return View::fetch('step1'); + } + + public function step2() + { + if(!$this->request->param('accept') or $this->request->param('accept') !== 1) + { + json(['code'=>0,'请先接受上一步的条款']); + } + $data = [ + 'pdo' => class_exists('pdo')?1:0, + 'pdo_mysql' => extension_loaded('pdo_mysql')?1:0, + 'curl' => extension_loaded('curl')?1:0, + 'upload_size' => ini_get('file_uploads')?ini_get('upload_max_filesize'):0, + 'session' => function_exists('session_start')?1:0 + ]; + + return View::fetch('',['data'=>$data]); + } + + + public function step3() + { + if(!$this->request->param('accept') or $this->request->param('accept') !== 2) + { + json(['code'=>0,'请先通过上一步的安装环境监测']); + } + return View::fetch(); + } + + public function createData() + { + if($this->request->isPost()){ + $data = $this->request->post(); + try { + validate(Index::class)->check($data); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return json(['code'=>0,'msg'=>$e->getMessage()]); + } + + // 连接数据库 + $link=@new mysqli("{$data['DB_HOST']}:{$data['DB_PORT']}",$data['DB_USER'],$data['DB_PWD']); + // 获取错误信息 + $error=$link->connect_error; + if (!is_null($error)) { + // 转义防止和alert中的引号冲突 + $error=addslashes($error); + return json(['code'=>0,'msg'=>'数据库链接失败:'.$error]);die; + } + // 设置字符集 + $link->query("SET NAMES 'utf8'"); + if($link->server_info < 5.0){ + return json(['code'=>0,'msg'=>'请将您的mysql升级到5.0以上']);die; + } + // 创建数据库并选中 + if(!$link->select_db($data['DB_NAME'])){ + $create_sql='CREATE DATABASE IF NOT EXISTS '.$data['DB_NAME'].' DEFAULT CHARACTER SET utf8;'; + if(!$link->query($create_sql)){ + return json(['code'=>0,'msg'=>'数据库连接失败']);die; + } + $link->select_db($data['DB_NAME']); + } + // 导入sql数据并创建表 + $vaethink_sql=file_get_contents(app_path() . 'data/vaethink.sql'); + $sql_array=preg_split("/;[\r\n]+/", str_replace("vae_",$data['DB_PREFIX'],$vaethink_sql)); + foreach ($sql_array as $k => $v) { + if (!empty($v)) { + $link->query($v); + } + } + + //插入管理员 + $username = $data['username']; + $password = $data['password']; + $nickname = 'Admin'; + $thumb = '/static/admin_static/images/vae.jpg'; + $salt = substr(str_shuffle('qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'), 10, 20); + $password = md5(md5($password.$salt).$salt); + $create_time = time(); + $update_time = time(); + + $caeate_admin_sql = "INSERT INTO ".$data['DB_PREFIX']."admin ". + "(username,pwd, nickname,thumb,salt,create_time,update_time) " + ."VALUES " + ."('$username','$password','$nickname','$thumb','$salt','$create_time','$update_time')"; + if(!$link->query($caeate_admin_sql)) { + return json(['code'=>0,'msg'=>'创建管理员信息失败']); + } + $link->close(); + $db_str=" + 'mysql', + + // 自定义时间查询规则 + 'time_query_rule' => [], + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => 'mysql', + // 服务器地址 + 'hostname' => '{$data['DB_HOST']}', + // 数据库名 + 'database' => '{$data['DB_NAME']}', + // 用户名 + 'username' => '{$data['DB_USER']}', + // 密码 + 'password' => '{$data['DB_PWD']}', + // 端口 + 'hostport' => '{$data['DB_PORT']}', + // 数据库表前缀 + 'prefix' => '{$data['DB_PREFIX']}', + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要断线重连 + 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => true, + // 开启字段缓存 + 'fields_cache' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + ], + + // 更多的数据库配置信息 + ] +];"; + + + // 创建数据库配置文件 + if(false == file_put_contents(root_path() . "config/database.php",$db_str)) { + return json(['code'=>0,'msg'=>'创建数据库配置文件失败,请检查目录权限']); + } + if(false == file_put_contents(root_path() . "install.lock",'vaeThink安装鉴定文件,勿删!!!!!此次安装时间:'.date('Y-m-d H:i:s',time()))) { + return josn(['code'=>0,'msg'=>'创建安装鉴定文件失败,请检查目录权限']); + } + + return json(['code'=>1,'msg'=>'安装成功']); + } + } +} + diff --git a/app/install/data/vaethink.sql b/app/install/data/vaethink.sql new file mode 100644 index 0000000..687044b --- /dev/null +++ b/app/install/data/vaethink.sql @@ -0,0 +1,306 @@ +/* +Navicat MySQL Data Transfer + +Source Server : 本地 +Source Server Version : 80012 +Source Host : 127.0.0.1:3306 +Source Database : pwtp6 + +Target Server Type : MYSQL +Target Server Version : 80012 +File Encoding : 65001 + +Date: 2020-03-31 18:00:21 +*/ + +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for vae_admin +-- ---------------------------- +DROP TABLE IF EXISTS `vae_admin`; +CREATE TABLE `vae_admin` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(255) NOT NULL DEFAULT '', + `pwd` varchar(255) NOT NULL DEFAULT '', + `salt` varchar(50) NOT NULL DEFAULT '', + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常-1禁止登陆', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + `last_login_time` int(11) NOT NULL DEFAULT '0', + `last_login_ip` varchar(100) NOT NULL DEFAULT '', + `nickname` varchar(255) DEFAULT '', + `desc` text COMMENT '备注', + `thumb` varchar(200) DEFAULT NULL, + `groups` varchar(255) NOT NULL DEFAULT '' COMMENT '权限组,隔开', + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`id`,`username`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员'; + +-- ---------------------------- +-- Records of vae_admin +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_admin_group +-- ---------------------------- +DROP TABLE IF EXISTS `vae_admin_group`; +CREATE TABLE `vae_admin_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL DEFAULT '', + `status` int(1) NOT NULL DEFAULT '1', + `rules` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '用户组拥有的规则id, 多个规则","隔开', + `desc` text COMMENT '备注', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `id` (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限分组'; + +-- ---------------------------- +-- Records of vae_admin_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_admin_rule +-- ---------------------------- +DROP TABLE IF EXISTS `vae_admin_rule`; +CREATE TABLE `vae_admin_rule` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `pid` int(11) unsigned NOT NULL DEFAULT '0', + `src` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '规则', + `title` varchar(255) NOT NULL DEFAULT '', + `is_menu` int(1) NOT NULL DEFAULT '1' COMMENT '1是菜单2不是', + `font_family` varchar(50) DEFAULT '' COMMENT '图标来源', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,越大越靠前', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL COMMENT '0', + PRIMARY KEY (`id`), + KEY `name` (`src`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 COMMENT='权限节点'; + +-- ---------------------------- +-- Records of vae_admin_rule +-- ---------------------------- +INSERT INTO `vae_admin_rule` VALUES ('1', '0', '', '系统', '1', '', 'layui-icon-windows', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('2', '1', 'menu/index', '菜单', '1', '', 'layui-icon-tree', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('3', '2', 'menu/add', '添加菜单', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('4', '2', 'menu/edit', '修改菜单', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('5', '2', 'menu/delete', '删除菜单', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('6', '14', 'admin/index', '管理员', '1', '', 'layui-icon-friends', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('7', '6', 'admin/add', '添加管理员', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('8', '6', 'admin/edit', '修改管理员', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('9', '6', 'admin/delete', '删除管理员', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('10', '14', 'group/index', '管理组', '1', '', 'layui-icon-user', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('11', '10', 'group/add', '添加权限组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('12', '10', 'group/edit', '修改权限组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('13', '10', 'group/delete', '删除权限组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('14', '1', '', '安全', '1', '', 'layui-icon-auz', '-1', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('15', '1', 'conf/index', '配置', '1', '', 'layui-icon-set', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('16', '15', 'conf/confsubmit', '提交配置', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('17', '0', '', '应用', '1', '', 'layui-icon-app', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('18', '17', 'nav/index', '导航', '1', '', 'layui-icon-component', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('19', '18', 'nav/addgroup', '添加导航组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('20', '18', 'nav/editgroup', '修改导航组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('21', '18', 'nav/deletegroup', '删除导航组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('22', '18', 'nav/navindex', '导航集', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('23', '18', 'nav/addnav', '添加导航', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('24', '18', 'nav/editnav', '修改导航', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('25', '18', 'nav/deletenav', '删除导航', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('26', '1', 'route/index', '路由', '1', '', 'layui-icon-link', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('27', '26', 'route/add', '添加美化', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('28', '26', 'route/edit', '修改美化', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('29', '26', 'route/delete', '删除美化', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('31', '17', 'slide/index', '轮播', '1', '', 'layui-icon-carousel', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('32', '17', 'cate/index', '分类', '1', '', 'layui-icon-tree', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('34', '31', 'slide/addgroup', '添加轮播组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('35', '31', 'slide/editgroup', '修改轮播组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('36', '31', 'slide/deletegroup', '删除轮播组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('37', '31', 'slide/slideindex', '轮播集', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('38', '31', 'slide/addslide', '添加轮播图', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('39', '31', 'slide/editslide', '修改轮播图', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('40', '31', 'slide/deleteslide', '删除轮播图', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('41', '32', 'cate/addgroup', '添加分类组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('42', '32', 'cate/editgroup', '修改分类组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('43', '32', 'cate/deletegroup', '删除分类组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('44', '32', 'cate/cateindex', '分类集', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('45', '32', 'cate/addcate', '添加分类', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('46', '32', 'cate/editcate', '修改分类', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('47', '32', 'cate/deletecate', '删除分类', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('48', '17', 'content/index', '内容', '1', '', 'layui-icon-template-1', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('49', '48', 'content/addgroup', '添加内容组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('50', '48', 'content/editgroup', '修改内容组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('51', '48', 'content/deletegroup', '删除内容组', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('52', '48', 'content/addcontent', '添加内容', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('53', '48', 'content/editcontent', '修改内容', '0', '', '', '0', '0', '0'); +INSERT INTO `vae_admin_rule` VALUES ('54', '48', 'content/deletecontent', '删除内容', '0', '', '', '0', '0', '0'); + +-- ---------------------------- +-- Table structure for vae_cate +-- ---------------------------- +DROP TABLE IF EXISTS `vae_cate`; +CREATE TABLE `vae_cate` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(50) NOT NULL, + `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, + `pid` int(11) NOT NULL DEFAULT '0', + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架', + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前', + `cate_group_id` int(11) NOT NULL DEFAULT '0', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类'; + +-- ---------------------------- +-- Records of vae_cate +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_cate_group +-- ---------------------------- +DROP TABLE IF EXISTS `vae_cate_group`; +CREATE TABLE `vae_cate_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `key` varchar(50) NOT NULL, + `desc` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类分组'; + +-- ---------------------------- +-- Records of vae_cate_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_content +-- ---------------------------- +DROP TABLE IF EXISTS `vae_content`; +CREATE TABLE `vae_content` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `img` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '图片,多图用,隔开', + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架', + `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `desc` varchar(500) DEFAULT NULL COMMENT '概要', + `content` text COMMENT '详情', + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前', + `content_group_id` int(11) NOT NULL DEFAULT '0', + `cate_id` int(11) NOT NULL DEFAULT '0', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='内容'; + +-- ---------------------------- +-- Records of vae_content +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_content_group +-- ---------------------------- +DROP TABLE IF EXISTS `vae_content_group`; +CREATE TABLE `vae_content_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `key` varchar(50) NOT NULL, + `cate_group_id` int(11) NOT NULL DEFAULT '0' COMMENT '分类组id', + `desc` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='内容分组'; + +-- ---------------------------- +-- Records of vae_content_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_nav +-- ---------------------------- +DROP TABLE IF EXISTS `vae_nav`; +CREATE TABLE `vae_nav` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(50) NOT NULL, + `icon` varchar(255) NOT NULL, + `src` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架', + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前', + `nav_group_id` int(11) NOT NULL DEFAULT '0', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导航'; + +-- ---------------------------- +-- Records of vae_nav +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_nav_group +-- ---------------------------- +DROP TABLE IF EXISTS `vae_nav_group`; +CREATE TABLE `vae_nav_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `key` varchar(50) NOT NULL, + `desc` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导航分组'; + +-- ---------------------------- +-- Records of vae_nav_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_route +-- ---------------------------- +DROP TABLE IF EXISTS `vae_route`; +CREATE TABLE `vae_route` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `module` varchar(255) NOT NULL DEFAULT '' COMMENT '应用名', + `full_url` varchar(255) NOT NULL DEFAULT '', + `url` varchar(255) NOT NULL DEFAULT '', + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1启用-1禁用', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='路由设置'; + +-- ---------------------------- +-- Records of vae_route +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_slide +-- ---------------------------- +DROP TABLE IF EXISTS `vae_slide`; +CREATE TABLE `vae_slide` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `icon` varchar(255) NOT NULL, + `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架', + `src` varchar(255) DEFAULT NULL, + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前', + `slide_group_id` int(11) NOT NULL DEFAULT '0', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='轮播'; + +-- ---------------------------- +-- Records of vae_slide +-- ---------------------------- + +-- ---------------------------- +-- Table structure for vae_slide_group +-- ---------------------------- +DROP TABLE IF EXISTS `vae_slide_group`; +CREATE TABLE `vae_slide_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `key` varchar(50) NOT NULL, + `desc` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='轮播分组'; + +-- ---------------------------- +-- Records of vae_slide_group +-- ---------------------------- diff --git a/app/install/validate/Index.php b/app/install/validate/Index.php new file mode 100644 index 0000000..f2e3221 --- /dev/null +++ b/app/install/validate/Index.php @@ -0,0 +1,45 @@ + +// +--------------------------------------------------------------------- +namespace app\install\validate; +use think\Validate; + +class Index extends Validate +{ + protected $rule = [ + 'DB_TYPE' => 'require|eq:mysql', + 'DB_HOST' => 'require', + 'DB_PORT' => 'require', + 'DB_USER' => 'require', + 'DB_PWD' => 'require', + 'DB_NAME' => 'require', + 'DB_PREFIX' => 'require', + 'username' => 'require', + 'password' => 'require|confirm', + ]; + + protected $message = [ + 'DB_TYPE.require' => '数据库类型不能为空', + 'DB_TYPE.eq' => '数据库类型固定为mysql', + 'DB_HOST.require' => '数据库地址不能为空', + 'DB_PORT.require' => '数据库端口不能为空', + 'DB_USER.require' => '数据库用户名不能为空', + 'DB_PWD.require' => '数据库密码不能为空', + 'DB_NAME.require' => '数据库名字不能为空', + 'DB_PREFIX.require' => '表前缀不能为空', + 'username.require' => '管理员账户不能为空', + 'password.require' => '密码不能为空', + 'password.confirm' => '两次密码不一致', + ]; + + protected $scene = [ + + ]; +} \ No newline at end of file diff --git a/app/install/view/install/step1.html b/app/install/view/install/step1.html new file mode 100644 index 0000000..435e355 --- /dev/null +++ b/app/install/view/install/step1.html @@ -0,0 +1,42 @@ + + + + + vaeThink + + + + + + +
+
+
+ +
+
+

+ 欢迎使用vaeThink,vaeThink搭载了最新的ThinkPHP6.x和最新的Layui2.x,是一款轻量级、高速度的PHP权限管理系统。
+ 您在使用中如有任何问题都可以登录vaeThink官方网站获取帮助。

+ 开源协议:
+ vaeThink遵循Apache Lisense 2.0开源协议发布,并提供免费使用。
+ Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,允许代码修改,再作为开源或商业软件发布。需要满足的条件:
+ 1、需要给用户一份Apache Licence ;
+ 2、如果你修改了代码,需要在被修改的文件中说明;
+ 3、在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明;
+ 4、如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有本协议内容。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。

+ 免责声明:
+ 1、使用vaeThink构建的网站的任何信息内容以及导致的任何版权纠纷和法律争议及后果,vaeThink官方不承担任何责任。 + 2、您一旦安装使用vaeThink,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。 +

+
+ 接受协议 +
+
+
+
+ + + + + \ No newline at end of file diff --git a/app/install/view/install/step2.html b/app/install/view/install/step2.html new file mode 100644 index 0000000..5f1ca40 --- /dev/null +++ b/app/install/view/install/step2.html @@ -0,0 +1,164 @@ + + + + + vaeThink + + + + + + +
+
+
+ +
+
+

环境检测

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
环境最低配置当前配置是否符合
操作系统不限
php版本≥ 7.1 + =7 && $php_version['1']>=1): ?> + + + + +
+

模块检测

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
环境最低配置当前配置是否符合
session支持{eq name="$data.session" value="1"}支持{else /}不支持{/eq}
PDO开启{eq name="$data.pdo" value="1"}已开启{else /}未开启{/eq}
PDO_Mysql开启{eq name="$data.pdo_mysql" value="1"}已开启{else /}未开启{/eq}
上传限制≥ 2M{eq name="$data.upload_size" value="0"}不支持{else /}{$data.upload_size}{/eq}
+

目录权限

+ + + + + + + + + + + + + + + + + + + + + + + + +
环境最低配置当前配置是否符合
config可写 + + 可写 + + 不可写 + + + + + + + +
+
+ 上一步 + 下一步 +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/app/install/view/install/step3.html b/app/install/view/install/step3.html new file mode 100644 index 0000000..b6ab0c1 --- /dev/null +++ b/app/install/view/install/step3.html @@ -0,0 +1,171 @@ + + + + + vaeThink + + + + + + +
+
+
+ +
+
+

数据库配置


+
+
+ +
+ +
+
固定为mysql
+
+
+ +
+ +
+
本地数据库地址一般为127.0.0.1
+
+
+ +
+ +
+
数据库端口,一般为3306
+
+
+ +
+ +
+
你数据库的连接用户名
+
+
+ +
+ +
+
你数据库的连接密码
+
+
+ +
+ +
+
不能有"-"等特殊符号
+
+
+ +
+ +
+
建议使用默认,同一个数据库安装多个vaeThink时需更改,否则会覆盖
+
+ +
+

管理员配置


+
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ + + +
+
+ 上一步 + +
+
+
+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/app/middleware.php b/app/middleware.php new file mode 100644 index 0000000..e3b90c5 --- /dev/null +++ b/app/middleware.php @@ -0,0 +1,10 @@ +getName(); + if(!file_exists(root_path() . '/route/'.$module.'/app.php')) + { + $route = Db::name('route')->where('module',$module)->where('status',1)->count(); + if($route > 0) + { + if (!file_exists(root_path() . '/route/'.$module)) + { + mkdir (root_path() . '/route/'.$module,0777); + } + $route_str=' +getName(); + +if(Cache::has("route_".$module)) { + $runtimeRoute = Cache::get("route".$module); +} else { + $runtimeRoute = Db::name("route")->where("module",$module)->where("status", 1)->order("create_time asc")->column("full_url","url"); + Cache::set("route".$module,$runtimeRoute); +} + +foreach ($runtimeRoute as $k => $v) { + Route::rule($k,$v); +}'; + + + // 创建应用路由配置文件 + if(false == file_put_contents(root_path() . '/route/'.$module.'/app.php',$route_str)) { + return abort(404,'创建路由配置文件失败,请检查route目录的权限'); + } + } + } + } + + return $next($request); + } +} diff --git a/app/provider.php b/app/provider.php new file mode 100644 index 0000000..73d99fa --- /dev/null +++ b/app/provider.php @@ -0,0 +1,9 @@ + Request::class, + 'think\exception\Handle' => ExceptionHandle::class, +]; diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..098da57 --- /dev/null +++ b/composer.json @@ -0,0 +1,48 @@ +{ + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0", + "topthink/think-orm": "^2.0", + "topthink/think-multi-app": "^1.0", + "topthink/think-view": "^1.0", + "topthink/think-captcha": "^3.0", + "phpmailer/phpmailer": "^6.1" + }, + "require-dev": { + "symfony/var-dumper": "^4.2", + "topthink/think-trace":"^1.0" + }, + "autoload": { + "psr-4": { + "app\\": "app" + }, + "psr-0": { + "": "extend/" + } + }, + "config": { + "preferred-install": "dist" + }, + "scripts": { + "post-autoload-dump": [ + "@php think service:discover", + "@php think vendor:publish" + ] + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..9e8e72f --- /dev/null +++ b/composer.lock @@ -0,0 +1,1129 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ef6a590c6de674d04d781877dc79a632", + "packages": [ + { + "name": "league/flysystem", + "version": "1.0.57", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2019-10-16T21:01:05+00:00" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "time": "2018-07-09T20:51:04+00:00" + }, + { + "name": "opis/closure", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/e79f851749c3caa836d7ccc01ede5828feb762c7", + "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2019-10-19T18:38:51+00:00" + }, + { + "name": "phpmailer/phpmailer", + "version": "v6.1.5", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "a8bf068f64a580302026e484ee29511f661b2ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a8bf068f64a580302026e484ee29511f661b2ad3", + "reference": "a8bf068f64a580302026e484ee29511f661b2ad3", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-ctype": "*", + "ext-filter": "*", + "php": ">=5.5.0" + }, + "require-dev": { + "doctrine/annotations": "^1.2", + "friendsofphp/php-cs-fixer": "^2.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-mbstring": "Needed to send email in multibyte encoding charset", + "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "league/oauth2-google": "Needed for Google XOAUTH2 authentication", + "psr/log": "For optional PSR-3 debug logging", + "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPMailer\\PHPMailer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "time": "2020-03-14T14:23:48+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "topthink/framework", + "version": "v6.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/framework.git", + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf", + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "league/flysystem": "^1.0", + "league/flysystem-cached-adapter": "^1.0", + "opis/closure": "^3.1", + "php": ">=7.1.0", + "psr/container": "~1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "topthink/think-helper": "^3.1.1", + "topthink/think-orm": "^2.0" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "autoload": { + "files": [], + "psr-4": { + "think\\": "src/think/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP Framework.", + "homepage": "http://thinkphp.cn/", + "keywords": [ + "framework", + "orm", + "thinkphp" + ], + "time": "2020-01-13T05:48:05+00:00" + }, + { + "name": "topthink/think-captcha", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-captcha.git", + "reference": "0b4305da19e118cefd934007875a8112f9352f01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-captcha/zipball/0b4305da19e118cefd934007875a8112f9352f01", + "reference": "0b4305da19e118cefd934007875a8112f9352f01", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\captcha\\CaptchaService" + ], + "config": { + "captcha": "src/config.php" + } + } + }, + "autoload": { + "psr-4": { + "think\\captcha\\": "src/" + }, + "files": [ + "src/helper.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "captcha package for thinkphp", + "time": "2019-10-03T07:45:11+00:00" + }, + { + "name": "topthink/think-helper", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-helper.git", + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + }, + "files": [ + "src/helper.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP6 Helper Package", + "time": "2019-09-30T02:36:48+00:00" + }, + { + "name": "topthink/think-multi-app", + "version": "v1.0.11", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-multi-app.git", + "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/215f4a6bb88e53ad41b448c61957336eb55ce6f9", + "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\app\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "think\\app\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp6 multi app support", + "time": "2019-10-29T06:34:59+00:00" + }, + { + "name": "topthink/think-orm", + "version": "v2.0.27", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-orm.git", + "reference": "02affaaccade2cdd8bbb2d2f5d15e46113e6eb50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/02affaaccade2cdd8bbb2d2f5d15e46113e6eb50", + "reference": "02affaaccade2cdd8bbb2d2f5d15e46113e6eb50", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "php": ">=7.1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "topthink/think-helper": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + }, + "files": [] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "think orm", + "keywords": [ + "database", + "orm" + ], + "time": "2019-10-23T02:16:50+00:00" + }, + { + "name": "topthink/think-template", + "version": "v2.0.7", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-template.git", + "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-template/zipball/e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", + "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "psr/simple-cache": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "the php template engine", + "time": "2019-09-20T15:31:04+00:00" + }, + { + "name": "topthink/think-view", + "version": "v1.0.13", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-view.git", + "reference": "90803b73f781db5d42619082c4597afc58b2d4c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-view/zipball/90803b73f781db5d42619082c4597afc58b2d4c5", + "reference": "90803b73f781db5d42619082c4597afc58b2d4c5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/think-template": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\view\\driver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp template driver", + "time": "2019-10-07T12:23:10+00:00" + } + ], + "packages-dev": [ + { + "name": "symfony/polyfill-mbstring", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "04ce3335667451138df4307d6a9b61565560199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", + "reference": "04ce3335667451138df4307d6a9b61565560199e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.3.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "bde8957fc415fdc6964f33916a3755737744ff05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/bde8957fc415fdc6964f33916a3755737744ff05", + "reference": "bde8957fc415fdc6964f33916a3755737744ff05", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2019-10-04T19:48:13+00:00" + }, + { + "name": "topthink/think-trace", + "version": "v1.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-trace.git", + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc", + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\trace\\Service" + ], + "config": { + "trace": "src/config.php" + } + } + }, + "autoload": { + "psr-4": { + "think\\trace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp debug trace", + "time": "2019-10-17T02:14:09+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [] +} diff --git a/config/app.php b/config/app.php new file mode 100644 index 0000000..3bba167 --- /dev/null +++ b/config/app.php @@ -0,0 +1,36 @@ + Env::get('app.host', ''), + // 应用的命名空间 + 'app_namespace' => '', + // 是否启用路由 + 'with_route' => true, + // 是否启用事件 + 'with_event' => true, + // 默认应用 + 'default_app' => 'index', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + + // 应用映射(自动多应用模式有效) + 'app_map' => [], + // 域名绑定(自动多应用模式有效) + 'domain_bind' => [], + // 禁止URL访问的应用列表(自动多应用模式有效) + 'deny_app_list' => [], + + // 异常页面的模板文件 + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, +]; diff --git a/config/cache.php b/config/cache.php new file mode 100644 index 0000000..dd492df --- /dev/null +++ b/config/cache.php @@ -0,0 +1,30 @@ + Env::get('cache.driver', 'file'), + + // 缓存连接方式配置 + 'stores' => [ + 'file' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + // 缓存标签前缀 + 'tag_prefix' => 'tag:', + // 序列化机制 例如 ['serialize', 'unserialize'] + 'serialize' => [], + ], + // 更多的缓存连接 + ], +]; diff --git a/config/captcha.php b/config/captcha.php new file mode 100644 index 0000000..9661b06 --- /dev/null +++ b/config/captcha.php @@ -0,0 +1,39 @@ + 5, + // 验证码字符集合 + 'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY', + // 验证码过期时间 + 'expire' => 1800, + // 是否使用中文验证码 + 'useZh' => false, + // 是否使用算术验证码 + 'math' => true, + // 是否使用背景图 + 'useImgBg' => false, + //验证码字符大小 + 'fontSize' => 25, + // 是否使用混淆曲线 + 'useCurve' => true, + //是否添加杂点 + 'useNoise' => true, + // 验证码字体 不设置则随机 + 'fontttf' => '', + //背景颜色 + 'bg' => [243, 251, 254], + // 验证码图片高度 + 'imageH' => 0, + // 验证码图片宽度 + 'imageW' => 0, + + // 添加额外的验证码设置 + // verify => [ + // 'length'=>4, + // ... + //], +]; diff --git a/config/console.php b/config/console.php new file mode 100644 index 0000000..a818a98 --- /dev/null +++ b/config/console.php @@ -0,0 +1,9 @@ + [ + ], +]; diff --git a/config/cookie.php b/config/cookie.php new file mode 100644 index 0000000..f728024 --- /dev/null +++ b/config/cookie.php @@ -0,0 +1,18 @@ + 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => false, + // 是否使用 setcookie + 'setcookie' => true, +]; diff --git a/config/database.php b/config/database.php new file mode 100644 index 0000000..99d4e94 --- /dev/null +++ b/config/database.php @@ -0,0 +1,59 @@ + + 'mysql', + + // 自定义时间查询规则 + 'time_query_rule' => [], + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => 'mysql', + // 服务器地址 + 'hostname' => '127.0.0.1', + // 数据库名 + 'database' => 'pwtp6', + // 用户名 + 'username' => 'root', + // 密码 + 'password' => 'root', + // 端口 + 'hostport' => '3306', + // 数据库表前缀 + 'prefix' => 'vae_', + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要断线重连 + 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => true, + // 开启字段缓存 + 'fields_cache' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + ], + + // 更多的数据库配置信息 + ] +]; \ No newline at end of file diff --git a/config/filesystem.php b/config/filesystem.php new file mode 100644 index 0000000..c851aed --- /dev/null +++ b/config/filesystem.php @@ -0,0 +1,26 @@ + Env::get('filesystem.driver', 'local'), + // 磁盘列表 + 'disks' => [ + 'local' => [ + 'type' => 'local', + 'root' => app()->getRuntimePath() . 'storage', + ], + 'public' => [ + // 磁盘类型 + 'type' => 'local', + // 磁盘路径 + 'root' => app()->getRootPath() . 'public/storage', + // 磁盘路径对应的外部URL路径 + 'url' => '/storage', + // 可见性 + 'visibility' => 'public', + ], + // 更多的磁盘配置信息 + ], +]; diff --git a/config/lang.php b/config/lang.php new file mode 100644 index 0000000..33232bd --- /dev/null +++ b/config/lang.php @@ -0,0 +1,27 @@ + Env::get('lang.default_lang', 'zh-cn'), + // 允许的语言列表 + 'allow_lang_list' => [], + // 多语言自动侦测变量名 + 'detect_var' => 'lang', + // 是否使用Cookie记录 + 'use_cookie' => true, + // 多语言cookie变量 + 'cookie_var' => 'think_lang', + // 扩展语言包 + 'extend_list' => [], + // Accept-Language转义为对应语言包名称 + 'accept_language' => [ + 'zh-hans-cn' => 'zh-cn', + ], + // 是否支持语言分组 + 'allow_group' => false, +]; diff --git a/config/log.php b/config/log.php new file mode 100644 index 0000000..5f7afcb --- /dev/null +++ b/config/log.php @@ -0,0 +1,46 @@ + Env::get('log.channel', 'file'), + // 日志记录级别 + 'level' => [], + // 日志类型记录的通道 ['error'=>'email',...] + 'type_channel' => [], + // 关闭全局日志写入 + 'close' => false, + // 全局日志处理 支持闭包 + 'processor' => null, + + // 日志通道列表 + 'channels' => [ + 'file' => [ + // 日志记录方式 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, + // 使用JSON格式记录 + 'json' => false, + // 日志处理 + 'processor' => null, + // 关闭通道日志写入 + 'close' => false, + // 日志输出格式化 + 'format' => '[%s][%s] %s', + // 是否实时写入 + 'realtime_write' => false, + ], + // 其它日志通道配置 + ], + +]; diff --git a/config/middleware.php b/config/middleware.php new file mode 100644 index 0000000..7e1972f --- /dev/null +++ b/config/middleware.php @@ -0,0 +1,8 @@ + [], + // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行 + 'priority' => [], +]; diff --git a/config/route.php b/config/route.php new file mode 100644 index 0000000..955eeec --- /dev/null +++ b/config/route.php @@ -0,0 +1,45 @@ + '/', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => true, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 访问控制器层名称 + 'controller_layer' => 'controller', + // 空控制器名 + 'empty_controller' => 'Error', + // 是否使用控制器后缀 + 'controller_suffix' => false, + // 默认的路由变量规则 + 'default_route_pattern' => '[\w\.]+', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 操作方法后缀 + 'action_suffix' => '', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', +]; diff --git a/config/session.php b/config/session.php new file mode 100644 index 0000000..c1ef6e1 --- /dev/null +++ b/config/session.php @@ -0,0 +1,19 @@ + 'PHPSESSID', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // 驱动方式 支持file cache + 'type' => 'file', + // 存储连接标识 当type使用cache的时候有效 + 'store' => null, + // 过期时间 + 'expire' => 1440, + // 前缀 + 'prefix' => '', +]; diff --git a/config/trace.php b/config/trace.php new file mode 100644 index 0000000..fad2392 --- /dev/null +++ b/config/trace.php @@ -0,0 +1,10 @@ + 'Html', + // 读取的日志通道名 + 'channel' => '', +]; diff --git a/config/view.php b/config/view.php new file mode 100644 index 0000000..01259a0 --- /dev/null +++ b/config/view.php @@ -0,0 +1,25 @@ + 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, + // 模板目录名 + 'view_dir_name' => 'view', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; diff --git a/install.lock b/install.lock new file mode 100644 index 0000000..a86104f --- /dev/null +++ b/install.lock @@ -0,0 +1 @@ +vaeThink安装鉴定文件,勿删!!!!!此次安装时间:2020-04-01 08:54:34 \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..cbc7868 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,8 @@ + + Options +FollowSymlinks -Multiviews + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..bb3f28ddb031e9792956ab9a4d6905953714eb5d GIT binary patch literal 4286 zcmcInYfKbZ6#gbFF4gM#h{eP-V4_LmGybT*YSCz7qSg>itnr5-O`|c^Xt8Rdrr@Jh zv=uE|A1ESkNu@rprdB017?t{{RVtPBv8-q*g08O?b=}+V%(}_2E;2LV-JG47JLi1o zyXT&J?j1nmFChW)kG;KscL2OcVHd_yq+f4*SJ^Wpp$_~13nl|gr$Jjk8;;^H?Bm$A z^zH;GaW{5gdSMD2MT_ksS+|=%2~cG~{cg-`E~Zx=xPZuE7?=v(d| zkk5@QOnyv$Z>n*gajy`=IrfG~|MJYZ6zyAv*yF1^p8?0LH;!{vG~d!kou=At_>eq0 zy**^kbKJw|$J>^F>6aLktwe0aSDi=U_lyu0$G+}$zU3Wtnwf`V!tv@17L9rOdLPX3 zd)o7_#~=^x*!15iSbIUHOu8*0gj*Fgx=Me*8Tsn1)yyoVw^DRFH(;+<0gd zxtHVWR*c}9^F_ln^gU;cpBSF?^FZYD-8`)8{Wi2S8`__P%CCW}`EdM`i_AzI<1@K6 zHs)dt^^zFl3ch<`d~dvG415v;o>|&$!~^Trs0T%;H)0s>1I)>zTo+@He2FfiFXv$P zt>K#U8}wSmf@j5aan7@Ho9*yQV92}Bc(&UR4TocHroVLZ>-Ve_`1X?!l*||Vx{$+k zayU=hV5B{5YwLDmkm$D68ukFx8A{#jMti9xKC5P@{mA# zH}m4Y5kojJpHtK!KKH`228v&=DLd$DEZItORaQSSi}BR;z0i*19+dwtCu-4LC*2v?_wKh! z2FLh{2SEi>l?o +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +require __DIR__ . '/../vendor/autoload.php'; + +// 执行HTTP应用并响应 +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..eb05362 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/public/router.php b/public/router.php new file mode 100644 index 0000000..ac7b3c8 --- /dev/null +++ b/public/router.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { + return false; +} else { + require __DIR__ . "/index.php"; +} diff --git a/public/static/.gitignore b/public/static/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/public/static/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/route/app.php b/route/app.php new file mode 100644 index 0000000..d8e09e3 --- /dev/null +++ b/route/app.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; + +Route::get('think', function () { + return 'hello,ThinkPHP6!'; +}); + +Route::get('hello/:name', 'index/hello'); diff --git a/think b/think new file mode 100644 index 0000000..2429d22 --- /dev/null +++ b/think @@ -0,0 +1,10 @@ +#!/usr/bin/env php +console->run(); \ No newline at end of file