mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-02 14:11:38 +08:00
引入easyadmin'
This commit is contained in:
49
.example.env
49
.example.env
@@ -1,21 +1,42 @@
|
||||
APP_DEBUG = true
|
||||
APP_DEBUG=true
|
||||
|
||||
[APP]
|
||||
DEFAULT_TIMEZONE = Asia/Shanghai
|
||||
DEFAULT_TIMEZONE=Asia/Shanghai
|
||||
|
||||
[DATABASE]
|
||||
driver = mysql
|
||||
TYPE = mysql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = test
|
||||
USERNAME = username
|
||||
PASSWORD = password
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8
|
||||
DEBUG = true
|
||||
TYPE=mysql
|
||||
HOSTNAME=host.docker.internal
|
||||
DATABASE=easyadmin
|
||||
USERNAME=root
|
||||
PASSWORD=root
|
||||
HOSTPORT=3306
|
||||
CHARSET=utf8
|
||||
DEBUG=true
|
||||
PREFIX=ea_
|
||||
|
||||
[LANG]
|
||||
default_lang = zh-cn
|
||||
default_lang=zh-cn
|
||||
|
||||
[LOG]
|
||||
channel = debug_mysql
|
||||
# 后台配置项组
|
||||
[EASYADMIN]
|
||||
# 后台地址后缀名称
|
||||
ADMIN=admin
|
||||
|
||||
# 后台登录验证码开关
|
||||
CAPTCHA=false
|
||||
|
||||
# 是否为演示环境
|
||||
IS_DEMO=false
|
||||
|
||||
# CDN配置项组
|
||||
CDN=
|
||||
EXAMPLE=true
|
||||
|
||||
# 是否开启CSRF过滤
|
||||
IS_CSRF=true
|
||||
|
||||
# 静态文件路径前缀
|
||||
STATIC_PATH=/static
|
||||
|
||||
# OSS静态文件路径前缀
|
||||
OSS_STATIC_PREFIX=static_easyadmin
|
||||
|
||||
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.js linguist-language=PHP
|
||||
*.css linguist-language=PHP
|
||||
*.html linguist-language=PHP
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,8 +1,14 @@
|
||||
/.idea
|
||||
/.vscode
|
||||
/vendor
|
||||
*.log
|
||||
.env
|
||||
ul.db
|
||||
composer.lock
|
||||
public/upload/*
|
||||
config/install/lock/install.lock
|
||||
/public/upload
|
||||
/public/docs
|
||||
public/conf
|
||||
public/WowOss.exe
|
||||
app/index/controller/Test.php
|
||||
composer.phar
|
||||
app/test/
|
||||
vendor
|
||||
/runtime
|
||||
140
LICENSE
140
LICENSE
@@ -1,127 +1,21 @@
|
||||
木兰宽松许可证, 第2版
|
||||
MIT License
|
||||
|
||||
木兰宽松许可证, 第2版
|
||||
2020年1月 http://license.coscl.org.cn/MulanPSL2
|
||||
Copyright (c) 2020 EasyAdmin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
0. 定义
|
||||
|
||||
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
|
||||
|
||||
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
|
||||
|
||||
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
|
||||
|
||||
“法人实体”是指提交贡献的机构及其“关联实体”。
|
||||
|
||||
“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
|
||||
|
||||
1. 授予版权许可
|
||||
|
||||
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
|
||||
|
||||
2. 授予专利许可
|
||||
|
||||
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
|
||||
|
||||
3. 无商标许可
|
||||
|
||||
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
|
||||
|
||||
4. 分发限制
|
||||
|
||||
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
|
||||
|
||||
5. 免责声明与责任限制
|
||||
|
||||
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
|
||||
|
||||
6. 语言
|
||||
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
|
||||
|
||||
条款结束
|
||||
|
||||
如何将木兰宽松许可证,第2版,应用到您的软件
|
||||
|
||||
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
|
||||
|
||||
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
|
||||
|
||||
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
|
||||
|
||||
3, 请将如下声明文本放入每个源文件的头部注释中。
|
||||
|
||||
Copyright (c) [Year] [name of copyright holder]
|
||||
[Software Name] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
|
||||
|
||||
Mulan Permissive Software License,Version 2
|
||||
|
||||
Mulan Permissive Software License,Version 2 (Mulan PSL v2)
|
||||
January 2020 http://license.coscl.org.cn/MulanPSL2
|
||||
|
||||
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
|
||||
|
||||
0. Definition
|
||||
|
||||
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
|
||||
|
||||
Contribution means the copyrightable work licensed by a particular Contributor under this License.
|
||||
|
||||
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
|
||||
|
||||
Legal Entity means the entity making a Contribution and all its Affiliates.
|
||||
|
||||
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
|
||||
|
||||
1. Grant of Copyright License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
|
||||
|
||||
2. Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
|
||||
|
||||
3. No Trademark License
|
||||
|
||||
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
|
||||
|
||||
4. Distribution Restriction
|
||||
|
||||
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
|
||||
|
||||
5. Disclaimer of Warranty and Limitation of Liability
|
||||
|
||||
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
6. Language
|
||||
|
||||
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
|
||||
|
||||
END OF THE TERMS AND CONDITIONS
|
||||
|
||||
How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
|
||||
|
||||
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
|
||||
|
||||
i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
|
||||
|
||||
ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
|
||||
|
||||
iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
|
||||
|
||||
|
||||
Copyright (c) [Year] [name of copyright holder]
|
||||
[Software Name] is licensed under Mulan PSL v2.
|
||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
You may obtain a copy of Mulan PSL v2 at:
|
||||
http://license.coscl.org.cn/MulanPSL2
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
See the Mulan PSL v2 for more details.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
32
LICENSE.txt
32
LICENSE.txt
@@ -1,32 +0,0 @@
|
||||
|
||||
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.
|
||||
36
README.en.md
Normal file
36
README.en.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# EasyAdmin
|
||||
|
||||
#### Description
|
||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
251
README.md
251
README.md
@@ -1,193 +1,128 @@
|
||||
|
||||
# ulthon_admin
|
||||
|
||||
## 奥宏TP6后台管理模板
|
||||

|
||||
|
||||
|
||||
### 使用ThinkPHP6快速开始一个有管理后台的项目
|
||||
[](https://github.com/php/php-src)
|
||||
[](https://www.mysql.com/)
|
||||
[](https://github.com/top-think/framework)
|
||||
[](https://github.com/sentsin/layui)
|
||||
[](https://github.com/zhongshaofa/layuimini)
|
||||
[](http://easyadmin.99php.cn/docs)
|
||||
[](https://github.com/zhongshaofa/easyadmin/blob/v2/LICENSE)
|
||||
|
||||
#### 介绍
|
||||
## 项目介绍
|
||||
|
||||
基于thinkphp6的系统后台管理模板.
|
||||
基于ThinkPHP6.0和layui的快速开发的后台管理系统。
|
||||
|
||||
基于ThinkPHP6,Layui,Jquery,支持各类数据库.
|
||||
技术交流QQ群:[763822524](https://jq.qq.com/?_wv=1027&k=5IHJawE) `加群请备注来源:如gitee、github、官网等`。
|
||||
|
||||
已实现很好用的`上传文件管理`,`内容管理`,`导航轮播管理(支持小程序)`的后台功能.
|
||||
## 安装教程
|
||||
>EasyAdmin 使用 Composer 来管理项目依赖。因此,在使用 EasyAdmin 之前,请确保你的机器已经安装了 Composer。
|
||||
|
||||
已实现`后台清新风格layui`皮肤.
|
||||
#### 通过 Composer 创建项目`建议`
|
||||
`composer create-project --prefer-dist zhongshaofa/easyadmin blog`
|
||||
|
||||
> 以去除现有的多皮肤设计,项目单独成立
|
||||
#### 通过git下载安装包,composer安装依赖包
|
||||
|
||||
- 前台简约蓝皮肤
|
||||
- [开源地址](https://gitee.com/ulthon/ulthon_site)
|
||||
- 
|
||||
- 实现首页轮播,功能块
|
||||
- 文章咨询列表详情
|
||||
- 案例图文列表
|
||||
- 关于特别板式模板
|
||||
```bash
|
||||
第一步,下载安装包
|
||||
|
||||
- 前台资讯主题
|
||||
- [开源地址](https://gitee.com/ulthon/ulthon_information)
|
||||
- 
|
||||
- 首页列表
|
||||
- 搜索
|
||||
- 详情
|
||||
|
||||
- 后台清新风格layui
|
||||
- 
|
||||
- 实现主色调清新蓝
|
||||
- 修改layui-form样式为上下名称/值显示
|
||||
- 实现列表表格转卡片,便于移动端访问
|
||||
|
||||
#### 最新演示
|
||||
|
||||
[在线演示](http://ulthon-admin.ulthon.com/admin)
|
||||
|
||||
账号: admin 密码: 123456
|
||||
git clone https://github.com/zhongshaofa/easyadmin
|
||||
或者
|
||||
git clone https://gitee.com/zhongshaofa/easyadmin
|
||||
|
||||
|
||||
#### 快速试用
|
||||
|
||||
|
||||
1.安装
|
||||
git clone https://gitee.com/ulthon/ulthon_admin.git
|
||||
或者
|
||||
composer create-project ulthon/ulthon_admin:dev-master
|
||||
2.进入目录
|
||||
cd ulthon_admin/
|
||||
3.安装依赖
|
||||
composer install
|
||||
4.初始化数据库
|
||||
php think migrate:run
|
||||
php think seed:run
|
||||
5.使用内置服务器
|
||||
php think run -p 8010
|
||||
6.访问前台
|
||||
127.0.0.1:8010/index.php/index
|
||||
7.访问后台
|
||||
127.0.0.1:8010/index.php/admin
|
||||
|
||||
后台帐号密码:admin/123456
|
||||
|
||||
[本地测试后台链接](/index.php/admin)
|
||||
|
||||
如果希望去掉index.php,可以参考tp文档,在nginx或apache环境配置,内置服务器必须带index.php
|
||||
|
||||
|
||||
#### 重置密码
|
||||
|
||||
重置密码为123456.
|
||||
第二步,安装依赖包
|
||||
composer install
|
||||
|
||||
```
|
||||
php think reset_password
|
||||
```
|
||||
|
||||
#### 功能
|
||||
|
||||
- 服务器信息
|
||||
- 系统配置
|
||||
- 管理员管理
|
||||
- 账户管理
|
||||
- 用户管理
|
||||
- 权限管理
|
||||
- 文件管理
|
||||
- 后台日志
|
||||
- 支持轮播图,导航,小程序导航(打开方式)等设置
|
||||
- 实现CMS后台
|
||||
- 支持前台多主题
|
||||
- 适配手机端,实现table转卡片样式
|
||||
- 数据库日志驱动
|
||||
|
||||
#### 默认开启数据库日志驱动
|
||||
|
||||
为了方便开发查看日志,系统中增加了数据库日志功能,此功能默认开启.
|
||||
|
||||
显然使用mysql记录日志会有性能问题,项目上线后建议关闭,使用官方`File`或者其他.
|
||||
|
||||
关闭数据库日志驱动:复制`.example.env`为`.env`,
|
||||
将:
|
||||
```
|
||||
[LOG]
|
||||
channel = debug_mysql
|
||||
```
|
||||
修改为:
|
||||
```
|
||||
[LOG]
|
||||
channel = file
|
||||
```
|
||||
|
||||
或者修改`config/log.php`,
|
||||
```
|
||||
// 默认日志记录通道
|
||||
'default' => Env::get('log.channel', 'debug_mysql'),
|
||||
```
|
||||
修改为:
|
||||
```
|
||||
// 默认日志记录通道
|
||||
'default' => Env::get('log.channel', 'file'),
|
||||
```
|
||||
|
||||
> 虽然配置名称为`debug_mysql`,但实际上使用的是官方`think-orm`,仍然支持其它数据库,比如`sqlite`
|
||||
|
||||
### 完整安装
|
||||
|
||||
先执行快速使用的步骤,此时项目已经安装到本地,数据库也安装到本地的sqlite.
|
||||
|
||||
部署到服务器,要做的只是把代码上传,连接正式数据库,并安装即可.
|
||||
|
||||
- 上传代码
|
||||
- 把代码上传到服务器上,很简单的事情,使用ftp,sftp都可以
|
||||
- 也可以在服务器上执行`快速试用`的几部,然后安装到正式数据库
|
||||
- 安装数据库
|
||||
- 修改配置文件`config/database.php`,连接到正确的数据库
|
||||
- 一般是第七行的`sqlite`改成`mysql`
|
||||
- 给23行的mysql数组的配置改成正确的配置
|
||||
- 重新执行`初始化数据库`的两行命令
|
||||
- 执行之前可能需要清理下缓存`php think clear --cache`
|
||||
|
||||
> 理论上,数据库可以安装到sqlite,mysql,sqlserver,pgsql,如果出现问题,可能是`空和非空`,`默认值`等问题.欢迎大家测试反馈.
|
||||
|
||||
|
||||
### 开发注意
|
||||
|
||||
#### 更多用法
|
||||
## 站点地址
|
||||
|
||||
更多用法欢迎访问 https://bbs.ulthon.com/index/Post/index.html?topic=ulthon_admin开发和使用指南
|
||||
* 官方网站:[http://easyadmin.99php.cn](http://easyadmin.99php.cn)
|
||||
|
||||
#### 后台页面仅仅使用了`TP`的模板包含特性
|
||||
* 文档地址:[http://easyadmin.99php.cn/docs](http://easyadmin.99php.cn/docs)
|
||||
|
||||
* 演示地址:[http://easyadmin.99php.cn/admindemo](http://easyadmin.99php.cn/admindemo)(账号:admin,密码:123456。备注:只有查看信息的权限)
|
||||
|
||||
## 代码仓库
|
||||
|
||||
* GitHub地址:[https://github.com/zhongshaofa/easyadmin](https://github.com/zhongshaofa/easyadmin)
|
||||
|
||||
* Gitee地址:[https://gitee.com/zhongshaofa/easyadmin](https://gitee.com/zhongshaofa/easyadmin)
|
||||
|
||||
|
||||
#### 支持所有(`TP6`支持的)类型数据库
|
||||
## 项目特性
|
||||
* 快速CURD命令行
|
||||
* 一键生成控制器、模型、视图、JS文件
|
||||
* 支持关联查询、字段设置等等
|
||||
* 基于`auth`的权限管理系统
|
||||
* 通过`注解方式`来实现`auth`权限节点管理
|
||||
* 具备一键更新`auth`权限节点,无需手动输入管理
|
||||
* 完善的后端权限验证以及前面页面按钮显示、隐藏控制
|
||||
* 完善的菜单管理
|
||||
* 分模块管理
|
||||
* 无限极菜单
|
||||
* 菜单编辑会提示`权限节点`
|
||||
* 完善的上传组件功能
|
||||
* 本地存储
|
||||
* 阿里云OSS`建议使用`
|
||||
* 腾讯云COS
|
||||
* 七牛云OSS
|
||||
* 完善的前端组件功能
|
||||
* 对layui的form表单重新封装,无需手动拼接数据请求
|
||||
* 简单好用的`图片、文件`上传组件
|
||||
* 简单好用的富文本编辑器`ckeditor`
|
||||
* 对弹出层进行再次封装,以极简的方式使用
|
||||
* 对table表格再次封装,在使用上更加舒服
|
||||
* 根据table的`cols`参数再次进行封装,提供接口实现`image`、`switch`、`list`等功能,再次基础上可以自己再次扩展
|
||||
* 根据table参数一键生成`搜索表单`,无需自己编写
|
||||
* 完善的后台操作日志
|
||||
* 记录用户的详细操作信息
|
||||
* 按月份进行`分表记录`
|
||||
* 一键部署静态资源到OSS上
|
||||
* 所有在`public\static`目录下的文件都可以一键部署
|
||||
* 一个配置项切换静态资源(oss/本地)
|
||||
* 上传文件记录管理
|
||||
* 后台路径自定义,防止别人找到对应的后台地址
|
||||
|
||||
填写正确的数据库连接配置,
|
||||
## 特别感谢
|
||||
|
||||
执行`php think migrate:run`安装数据库
|
||||
以下项目排名不分先后
|
||||
|
||||
执行`php think seed:run`初始化数据
|
||||
* ThinkPHP:[https://github.com/top-think/framework](https://github.com/top-think/framework)
|
||||
|
||||
#### 使用了配置全局中间件
|
||||
* Layuimini:[https://github.com/zhongshaofa/layuimini](https://github.com/zhongshaofa/layuimini)
|
||||
|
||||
* Annotations:[https://github.com/doctrine/annotations](https://github.com/doctrine/annotations)
|
||||
|
||||
在这个中间件里把数据库的配置信息设置到项目中.
|
||||
* Layui:[https://github.com/sentsin/layui](https://github.com/sentsin/layui)
|
||||
|
||||
中间件: `\app\\middleware\ConfigInit`
|
||||
* Jquery:[https://github.com/jquery/jquery](https://github.com/jquery/jquery)
|
||||
|
||||
#### 文件上传
|
||||
* RequireJs:[https://github.com/requirejs/requirejs](https://github.com/requirejs/requirejs)
|
||||
|
||||
经过这个类上传的文件会保存到`public`下,
|
||||
* CKEditor:[https://github.com/ckeditor/ckeditor4](https://github.com/ckeditor/ckeditor4)
|
||||
|
||||
`TP`原本配置会保存到`public/storage`下,本项目修改了配置,直接保存到`public`下.
|
||||
* Echarts:[https://github.com/apache/incubator-echarts](https://github.com/apache/incubator-echarts)
|
||||
|
||||
## 免责声明
|
||||
|
||||
类:`\app\api\controller\Files::save()`
|
||||
>任何用户在使用`EasyAdmin`后台框架前,请您仔细阅读并透彻理解本声明。您可以选择不使用`EasyAdmin`后台框架,若您一旦使用`EasyAdmin`后台框架,您的使用行为即被视为对本声明全部内容的认可和接受。
|
||||
|
||||
## 版权协议
|
||||
* `EasyAdmin`后台框架是一款开源免费的后台快速开发框架 ,主要用于更便捷地开发后台管理;其尊重并保护所有用户的个人隐私权,不窃取任何用户计算机中的信息。更不具备用户数据存储等网络传输功能。
|
||||
* 您承诺秉着合法、合理的原则使用`EasyAdmin`后台框架,不利用`EasyAdmin`后台框架进行任何违法、侵害他人合法利益等恶意的行为,亦不将`EasyAdmin`后台框架运用于任何违反我国法律法规的 Web 平台。
|
||||
* 任何单位或个人因下载使用`EasyAdmin`后台框架而产生的任何意外、疏忽、合约毁坏、诽谤、版权或知识产权侵犯及其造成的损失 (包括但不限于直接、间接、附带或衍生的损失等),本开源项目不承担任何法律责任。
|
||||
* 用户明确并同意本声明条款列举的全部内容,对使用`EasyAdmin`后台框架可能存在的风险和相关后果将完全由用户自行承担,本开源项目不承担任何法律责任。
|
||||
* 任何单位或个人在阅读本免责声明后,应在《MIT 开源许可证》所允许的范围内进行合法的发布、传播和使用`EasyAdmin`后台框架等行为,若违反本免责声明条款或违反法律法规所造成的法律责任(包括但不限于民事赔偿和刑事责任),由违约者自行承担。
|
||||
* 如果本声明的任何部分被认为无效或不可执行,其余部分仍具有完全效力。不可执行的部分声明,并不构成我们放弃执行该声明的权利。
|
||||
* 本开源项目有权随时对本声明条款及附件内容进行单方面的变更,并以消息推送、网页公告等方式予以公布,公布后立即自动生效,无需另行单独通知;若您在本声明内容公告变更后继续使用的,表示您已充分阅读、理解并接受修改后的声明内容。
|
||||
|
||||
|
||||
## 捐赠支持
|
||||
|
||||
开源项目不易,若此项目能得到你的青睐,可以捐赠支持作者持续开发与维护,感谢所有支持开源的朋友。
|
||||
|
||||
`木兰协议`
|
||||
|
||||
## 源码托管
|
||||
|
||||
[码云开源存储](https://gitee.com/ulthon/ulthon_admin)
|
||||
|
||||
## 开发维护
|
||||
|
||||
[临沂奥宏网络科技有限公司](http://ulthon.com)
|
||||

|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\Service;
|
||||
|
||||
/**
|
||||
* 应用服务类
|
||||
*/
|
||||
class AppService extends Service
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
// 服务注册
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
// 服务启动
|
||||
}
|
||||
}
|
||||
@@ -1,174 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types=1);
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\App;
|
||||
use think\app\Url;
|
||||
use think\exception\ValidateException;
|
||||
use think\Validate;
|
||||
use think\facade\View;
|
||||
use think\exception\HttpResponseException;
|
||||
|
||||
/**
|
||||
* 控制器基础类
|
||||
*/
|
||||
abstract class BaseController
|
||||
{
|
||||
/**
|
||||
* Request实例
|
||||
* @var \think\Request
|
||||
*/
|
||||
protected $request;
|
||||
/**
|
||||
* Request实例
|
||||
* @var \think\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* 应用实例
|
||||
* @var \think\App
|
||||
*/
|
||||
protected $app;
|
||||
/**
|
||||
* 应用实例
|
||||
* @var \think\App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* 是否批量验证
|
||||
* @var bool
|
||||
*/
|
||||
protected $batchValidate = false;
|
||||
/**
|
||||
* 是否批量验证
|
||||
* @var bool
|
||||
*/
|
||||
protected $batchValidate = false;
|
||||
|
||||
/**
|
||||
* 控制器中间件
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [];
|
||||
/**
|
||||
* 控制器中间件
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [];
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param App $app 应用对象
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->request = $this->app->request;
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param App $app 应用对象
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
// 控制器初始化
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
$v->message($message);
|
||||
// 初始化
|
||||
protected function initialize()
|
||||
{}
|
||||
|
||||
// 是否批量验证
|
||||
if ($batch || $this->batchValidate) {
|
||||
$v->batch(true);
|
||||
}
|
||||
|
||||
return $v->failException(true)->check($data);
|
||||
}
|
||||
|
||||
public function success($msg = '操作成功', $jump_to_url = null, $code = 200, $params = [])
|
||||
{
|
||||
$jump_to_url = $this->parseJumpUrl($jump_to_url);
|
||||
$data = [
|
||||
'msg' => $msg,
|
||||
'jump_to_url' => $jump_to_url,
|
||||
'params' => $params
|
||||
];
|
||||
|
||||
if (\request()->isAjax()) {
|
||||
$data['jump_to_url'] = $jump_to_url;
|
||||
if ($code == 200) {
|
||||
$code = 0;
|
||||
}
|
||||
throw new HttpResponseException(json_message($data, $code, $msg));
|
||||
}
|
||||
|
||||
View::assign($data);
|
||||
throw new HttpResponseException(response(View::fetch(config('view.jump_tpl_success_path')), $code));
|
||||
}
|
||||
public function error($msg = '操作失败', $jump_to_url = null, $code = 200, $params = [])
|
||||
{
|
||||
|
||||
$jump_to_url = $this->parseJumpUrl($jump_to_url);
|
||||
|
||||
$data = [
|
||||
'msg' => $msg,
|
||||
'jump_to_url' => $jump_to_url,
|
||||
'params' => $params
|
||||
];
|
||||
|
||||
if (\request()->isAjax()) {
|
||||
$data['jump_to_url'] = $jump_to_url;
|
||||
if ($code == 200) {
|
||||
$code = 500;
|
||||
}
|
||||
throw new HttpResponseException(json_message($data, $code, $msg));
|
||||
}
|
||||
|
||||
View::assign($data);
|
||||
throw new HttpResponseException(response(View::fetch(config('view.jump_tpl_error_path')), $code));
|
||||
}
|
||||
|
||||
public function redirect($jump_to_url, $code = 302)
|
||||
{
|
||||
$jump_to_url = $this->parseJumpUrl($jump_to_url);
|
||||
|
||||
throw new HttpResponseException(redirect($jump_to_url), $code);
|
||||
}
|
||||
|
||||
public function parseJumpUrl($jump_to_url)
|
||||
{
|
||||
if (is_null($jump_to_url)) {
|
||||
$jump_to_url = \request()->server('HTTP_REFERER');
|
||||
} else {
|
||||
if ($jump_to_url instanceof Url) {
|
||||
|
||||
$jump_to_url = (string)$jump_to_url;
|
||||
} else {
|
||||
if (strpos($jump_to_url, 'http') !== 0) {
|
||||
$jump_to_url = url($jump_to_url);
|
||||
/**
|
||||
* 验证数据
|
||||
* @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);
|
||||
}
|
||||
|
||||
return (string)$jump_to_url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\db\exception\DataNotFoundException;
|
||||
@@ -61,6 +51,7 @@ class ExceptionHandle extends Handle
|
||||
public function render($request, Throwable $e): Response
|
||||
{
|
||||
// 添加自定义异常处理机制
|
||||
|
||||
// 其他错误交给系统处理
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app;
|
||||
|
||||
// 应用请求对象类
|
||||
class Request extends \think\Request
|
||||
{
|
||||
|
||||
protected $filter = ['htmlspecialchars'];
|
||||
|
||||
}
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app;
|
||||
|
||||
use app\model\UploadFiles as AppUploadFiles;
|
||||
use League\Flysystem\Util\MimeType;
|
||||
use think\facade\Filesystem;
|
||||
use think\facade\Config;
|
||||
use think\File;
|
||||
use think\file\UploadedFile;
|
||||
|
||||
class UploadFiles
|
||||
{
|
||||
|
||||
public static function add()
|
||||
{
|
||||
return new AppUploadFiles();
|
||||
}
|
||||
|
||||
public static function create($data, $allowFiled = [], $replace = false)
|
||||
{
|
||||
return AppUploadFiles::create($data, $allowFiled, $replace);
|
||||
}
|
||||
|
||||
public static function use($save_name)
|
||||
{
|
||||
return AppUploadFiles::where('save_name', $save_name)->update([
|
||||
'used_time' => time(),
|
||||
'status' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
public static function delete($save_name)
|
||||
{
|
||||
return AppUploadFiles::where('save_name', $save_name)->update([
|
||||
'delete_time' => time(),
|
||||
'status' => 2
|
||||
]);
|
||||
}
|
||||
|
||||
public static function clear($id)
|
||||
{
|
||||
$model_file = AppUploadFiles::withTrashed()->find($id);
|
||||
|
||||
$model_file->clear_time = time();
|
||||
$model_file->status = 3;
|
||||
|
||||
$model_file->save();
|
||||
|
||||
return Filesystem::delete($model_file->getData('save_name'));
|
||||
}
|
||||
|
||||
public static function save(Request $request)
|
||||
{
|
||||
|
||||
$type = $request->param('type');
|
||||
if (empty($type)) {
|
||||
return json_message('缺少类型参数');
|
||||
}
|
||||
$dir_name = $request->param('dir', $type);
|
||||
|
||||
$file = request()->file('file');
|
||||
|
||||
|
||||
try {
|
||||
|
||||
self::fileScan($file);
|
||||
|
||||
$model_file = self::saveFile($file, $type, $dir_name);
|
||||
return json_message($model_file->toArray());
|
||||
} catch (\Throwable $th) {
|
||||
return json_message($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static function fileScan($file)
|
||||
{
|
||||
$file_extension = $file->extension();
|
||||
|
||||
if ($file_extension == 'php') {
|
||||
throw new \Exception('上传文件异常');
|
||||
}
|
||||
|
||||
$file_path = $file->getRealPath();
|
||||
|
||||
$file_content = file_get_contents($file_path);
|
||||
|
||||
if (strpos($file_content, '<?php') !== false) {
|
||||
throw new \Exception('上传文件异常');
|
||||
}
|
||||
|
||||
if (empty($file)) {
|
||||
throw new \Exception('上传失败');
|
||||
}
|
||||
}
|
||||
|
||||
public static function wangEditorSave(Request $request)
|
||||
{
|
||||
|
||||
$type = $request->param('type');
|
||||
if (empty($type)) {
|
||||
return json_message('缺少类型参数');
|
||||
}
|
||||
$dir_name = $request->param('dir', $type);
|
||||
|
||||
$files = $request->file();
|
||||
|
||||
$saved_files_src = [];
|
||||
|
||||
foreach ($files as $file) {
|
||||
try {
|
||||
|
||||
self::fileScan($file);
|
||||
|
||||
$saved_files_src[] = self::saveFile($file, $type, $dir_name)->src;
|
||||
} catch (\Throwable $th) {
|
||||
return json_message($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return json([
|
||||
"errno" => 0,
|
||||
"data" => $saved_files_src
|
||||
]);
|
||||
}
|
||||
|
||||
public static function saveFile($file, $type, $dir_name = null)
|
||||
{
|
||||
if (is_null($dir_name)) {
|
||||
$dir_name = $type;
|
||||
}
|
||||
$model_file = UploadFiles::add();
|
||||
|
||||
if ($file instanceof UploadedFile) {
|
||||
|
||||
$model_file->file_name = $file->getOriginalName();
|
||||
} else {
|
||||
$model_file->file_name = $file->getFilename();
|
||||
}
|
||||
|
||||
$model_file->mime_type = $file->getMime();
|
||||
$model_file->ext_name = $file->extension();
|
||||
$model_file->file_size = $file->getSize();
|
||||
$model_file->file_md5 = $file->md5();
|
||||
$model_file->file_sha1 = $file->sha1();
|
||||
$model_file->create_time = time();
|
||||
$model_file->type = $type;
|
||||
|
||||
$model_file->save_name = Filesystem::putFile('upload/' . $dir_name, $file, 'uniqid');
|
||||
$model_file->save();
|
||||
$model_file->append(['src']);
|
||||
return $model_file;
|
||||
}
|
||||
|
||||
public static function saveUrlFile($url, $type)
|
||||
{
|
||||
$file_data = geturl($url);
|
||||
return json_message(self::saveData($file_data, $type)->toArray());
|
||||
}
|
||||
|
||||
public static function saveBase64File($file_data, $type)
|
||||
{
|
||||
if (strstr($file_data, ",")) {
|
||||
$file_data = explode(',', $file_data);
|
||||
$file_data = $file_data[1];
|
||||
}
|
||||
$file_data = base64_decode($file_data);
|
||||
return json_message(self::saveData($file_data, $type)->toArray());
|
||||
}
|
||||
|
||||
public static function saveData($file_data, $type)
|
||||
{
|
||||
$mime_type = MimeType::detectByContent($file_data);
|
||||
$ext_name = array_search($mime_type, MimeType::getExtensionToMimeTypeMap());
|
||||
$temp_file = tempnam(app()->getRuntimePath(), 'url_save_') . '.' . $ext_name;
|
||||
file_put_contents($temp_file, $file_data);
|
||||
$file = new File($temp_file);
|
||||
$model_file = self::saveFile($file, $type);
|
||||
unlink($temp_file);
|
||||
return $model_file;
|
||||
}
|
||||
}
|
||||
38
app/admin/config/admin.php
Normal file
38
app/admin/config/admin.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
|
||||
// 不需要验证登录的控制器
|
||||
'no_login_controller' => [
|
||||
'login',
|
||||
],
|
||||
|
||||
// 不需要验证登录的节点
|
||||
'no_login_node' => [
|
||||
'login/index',
|
||||
'login/out',
|
||||
],
|
||||
|
||||
// 不需要验证权限的控制器
|
||||
'no_auth_controller' => [
|
||||
'ajax',
|
||||
'login',
|
||||
'index',
|
||||
],
|
||||
|
||||
// 不需要验证权限的节点
|
||||
'no_auth_node' => [
|
||||
'login/index',
|
||||
'login/out',
|
||||
],
|
||||
];
|
||||
10
app/admin/config/app.php
Normal file
10
app/admin/config/app.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
use think\facade\Env;
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
10
app/admin/config/console.php
Normal file
10
app/admin/config/console.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 控制台配置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 指令定义
|
||||
'commands' => [
|
||||
'alioss' => 'addons\alioss\command\Alioss',
|
||||
],
|
||||
];
|
||||
19
app/admin/config/route.php
Normal file
19
app/admin/config/route.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 路由设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
|
||||
// 路由中间件
|
||||
'middleware' => [
|
||||
|
||||
// // 后台视图初始化
|
||||
// \app\admin\middleware\ViewInit::class,
|
||||
|
||||
// 检测用户是否登录
|
||||
// \app\admin\middleware\CheckAdmin::class,
|
||||
|
||||
|
||||
],
|
||||
];
|
||||
@@ -1,230 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Admin as AppAdmin;
|
||||
use app\model\AdminGroup;
|
||||
use app\model\AdminLog;
|
||||
use app\UploadFiles as AppUploadFiles;
|
||||
use think\facade\View;
|
||||
use think\helper\Str;
|
||||
|
||||
/**
|
||||
* 管理员账号管理
|
||||
*/
|
||||
class Admin extends Common
|
||||
{
|
||||
/**
|
||||
* 当前登录的管理员编辑账户
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
|
||||
$model_admin = AppAdmin::find($this->adminInfo['id']);
|
||||
|
||||
View::assign('admin',$model_admin);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录的管理员修改密码
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function password()
|
||||
{
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登陆的管理员保存修改密码
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function passwordUpdate()
|
||||
{
|
||||
|
||||
$post_data = $this->request->post();
|
||||
|
||||
if(empty($post_data['new_password'])){
|
||||
return $this->error('新密码不能为空');
|
||||
}
|
||||
$model_admin = AppAdmin::find($this->adminInfo['id']);
|
||||
|
||||
if(md5($post_data['original_password'].$model_admin->getData('salt')) != $model_admin->getData('password')){
|
||||
return $this->error('原密码错误');
|
||||
}
|
||||
|
||||
if($post_data['new_password'] != $post_data['check_password']){
|
||||
return $this->error('新密码与确认密码不一致');
|
||||
}
|
||||
|
||||
|
||||
$model_admin->password = md5($post_data['new_password'].$model_admin->getData('salt'));
|
||||
|
||||
$model_admin->save();
|
||||
|
||||
return $this->success('修改成功');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登陆的管理员更新账户
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$post_data = $this->request->post();
|
||||
$model_admin = AppAdmin::find($this->adminInfo['id']);
|
||||
|
||||
if($model_admin->getData('avatar') != $post_data['avatar']){
|
||||
AppUploadFiles::delete($model_admin->getData('avatar'));
|
||||
AppUploadFiles::use($post_data['avatar']);
|
||||
}
|
||||
|
||||
$model_admin->data($post_data);
|
||||
|
||||
$model_admin->save();
|
||||
|
||||
return $this->success('保存成功','Admin/edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员列表
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$admin_list = AppAdmin::where('id','<>',1)->order('id desc')->paginate();
|
||||
View::assign('list',$admin_list);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加管理员账号
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
||||
$admin_group_list = AdminGroup::select();
|
||||
|
||||
View::assign('group_list',$admin_group_list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存添加的管理员账号
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$post_data = $this->request->post();
|
||||
|
||||
$admin_model = AppAdmin::where('account',$post_data['account'])->find();
|
||||
|
||||
if(!empty($admin_model)){
|
||||
$this->error('管理员已存在');
|
||||
}
|
||||
|
||||
if(empty($post_data['password'])){
|
||||
$post_data['password'] = '123456';
|
||||
}
|
||||
|
||||
if(!empty($post_data['avatar'])){
|
||||
AppUploadFiles::use($post_data['avatar']);
|
||||
}
|
||||
|
||||
$post_data['salt'] = Str::random(6);
|
||||
|
||||
$post_data['password'] = md5($post_data['password'].$post_data['salt']);
|
||||
|
||||
AppAdmin::create($post_data);
|
||||
|
||||
$this->success('添加成功','index');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑管理员账号
|
||||
*
|
||||
* @param [type] $id
|
||||
* @return void
|
||||
*/
|
||||
public function editAccount($id)
|
||||
{
|
||||
$model_admin = AppAdmin::find($id);
|
||||
$admin_group_list = AdminGroup::select();
|
||||
View::assign('group_list',$admin_group_list);
|
||||
View::assign('admin',$model_admin);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新管理员账号
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateAccount()
|
||||
{
|
||||
$post_data = $this->request->post();
|
||||
|
||||
$admin_model = AppAdmin::find($post_data['id']);
|
||||
|
||||
if(!empty($post_data['password'])){
|
||||
$post_data['salt'] = Str::random(6);
|
||||
|
||||
$post_data['password'] = md5($post_data['password'].$post_data['salt']);
|
||||
}else{
|
||||
unset($post_data['password']);
|
||||
}
|
||||
|
||||
if($admin_model->getData('avatar') != $post_data['avatar']){
|
||||
AppUploadFiles::delete($admin_model->getData('avatar'));
|
||||
AppUploadFiles::use($post_data['avatar']);
|
||||
}
|
||||
AppAdmin::update($post_data);
|
||||
|
||||
$this->success('修改成功','index');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员操作日志
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function adminLog()
|
||||
{
|
||||
|
||||
$list = AdminLog::order('id desc')->paginate(10);
|
||||
|
||||
View::assign('list',$list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除管理员
|
||||
*
|
||||
* @param [type] $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
AppAdmin::destroy($id);
|
||||
|
||||
|
||||
return json_message();
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\AdminGroup as AppAdminGroup;
|
||||
use app\model\AdminPermission;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class AdminGroup extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$list = AppAdminGroup::order('id desc')->select();
|
||||
View::assign('list',$list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
$premission_list = AdminPermission::order('key')->select();
|
||||
|
||||
View::assign('permission_list',$premission_list);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
$model_admin_group = AppAdminGroup::where('name',$post_data['name'])->find();
|
||||
|
||||
if(!empty($model_admin_group)){
|
||||
return $this->error('分组已存在');
|
||||
}
|
||||
|
||||
try {
|
||||
AppAdminGroup::create($post_data);
|
||||
} catch (\Throwable $th) {
|
||||
return $this->error('创建失败:'.$th->getMessage());
|
||||
}
|
||||
|
||||
return $this->success('创建成功','index');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_admin_group = AppAdminGroup::find($id);
|
||||
|
||||
$premission_list = AdminPermission::order('key')->select();
|
||||
|
||||
View::assign('permission_list',$premission_list);
|
||||
View::assign('admin_group',$model_admin_group);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$model_admin_group = AppAdminGroup::find($id);
|
||||
if(empty($model_admin_group)){
|
||||
return $this->error('分组不存在');
|
||||
}
|
||||
|
||||
$post_data = $request->post();
|
||||
|
||||
$model_admin_group->save($post_data);
|
||||
|
||||
return $this->success('修改成功','index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
AppAdminGroup::destroy($id);
|
||||
$this->success('删除成功');
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\AdminPermission as AppAdminPermission;
|
||||
use think\facade\Cache;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class AdminPermission extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$list = AppAdminPermission::order('key')->paginate();
|
||||
|
||||
View::assign('list',$list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
$model_permission = AppAdminPermission::find($id);
|
||||
|
||||
$model_permission->data($post_data);
|
||||
|
||||
$model_permission->save();
|
||||
|
||||
Cache::delete('logged_admin_permission');
|
||||
|
||||
return json_message();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
AppAdminPermission::destroy($id);
|
||||
Cache::delete('logged_admin_permission');
|
||||
return json_message();
|
||||
}
|
||||
}
|
||||
171
app/admin/controller/Ajax.php
Normal file
171
app/admin/controller/Ajax.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\SystemUploadfile;
|
||||
use app\common\controller\AdminController;
|
||||
use app\common\service\MenuService;
|
||||
use EasyAdmin\upload\Uploadfile;
|
||||
use think\db\Query;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Ajax extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* 初始化后台接口地址
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function initAdmin()
|
||||
{
|
||||
$cacheData = Cache::get('initAdmin_' . session('admin.id'));
|
||||
if (!empty($cacheData)) {
|
||||
return json($cacheData);
|
||||
}
|
||||
$menuService = new MenuService(session('admin.id'));
|
||||
$data = [
|
||||
'logoInfo' => [
|
||||
'title' => sysconfig('site', 'logo_title'),
|
||||
'image' => sysconfig('site', 'logo_image'),
|
||||
'href' => __url('index/index'),
|
||||
],
|
||||
'homeInfo' => $menuService->getHomeInfo(),
|
||||
'menuInfo' => $menuService->getMenuTree(),
|
||||
];
|
||||
Cache::tag('initAdmin')->set('initAdmin_' . session('admin.id'), $data);
|
||||
return json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理缓存接口
|
||||
*/
|
||||
public function clearCache()
|
||||
{
|
||||
Cache::clear();
|
||||
$this->success('清理缓存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$data = [
|
||||
'upload_type' => $this->request->post('upload_type'),
|
||||
'file' => $this->request->file('file'),
|
||||
];
|
||||
$uploadConfig = sysconfig('upload');
|
||||
empty($data['upload_type']) && $data['upload_type'] = $uploadConfig['upload_type'];
|
||||
$rule = [
|
||||
'upload_type|指定上传类型有误' => "in:{$uploadConfig['upload_allow_type']}",
|
||||
'file|文件' => "require|file|fileExt:{$uploadConfig['upload_allow_ext']}|fileSize:{$uploadConfig['upload_allow_size']}",
|
||||
];
|
||||
$this->validate($data, $rule);
|
||||
try {
|
||||
$upload = Uploadfile::instance()
|
||||
->setUploadType($data['upload_type'])
|
||||
->setUploadConfig($uploadConfig)
|
||||
->setFile($data['file'])
|
||||
->save();
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($upload['save'] == true) {
|
||||
$this->success($upload['msg'], ['url' => $upload['url']]);
|
||||
} else {
|
||||
$this->error($upload['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片至编辑器
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function uploadEditor()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$data = [
|
||||
'upload_type' => $this->request->post('upload_type'),
|
||||
'file' => $this->request->file('upload'),
|
||||
];
|
||||
$uploadConfig = sysconfig('upload');
|
||||
empty($data['upload_type']) && $data['upload_type'] = $uploadConfig['upload_type'];
|
||||
$rule = [
|
||||
'upload_type|指定上传类型有误' => "in:{$uploadConfig['upload_allow_type']}",
|
||||
'file|文件' => "require|file|fileExt:{$uploadConfig['upload_allow_ext']}|fileSize:{$uploadConfig['upload_allow_size']}",
|
||||
];
|
||||
$this->validate($data, $rule);
|
||||
try {
|
||||
$upload = Uploadfile::instance()
|
||||
->setUploadType($data['upload_type'])
|
||||
->setUploadConfig($uploadConfig)
|
||||
->setFile($data['file'])
|
||||
->save();
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($upload['save'] == true) {
|
||||
return json([
|
||||
'error' => [
|
||||
'message' => '上传成功',
|
||||
'number' => 201,
|
||||
],
|
||||
'fileName' => '',
|
||||
'uploaded' => 1,
|
||||
'url' => $upload['url'],
|
||||
]);
|
||||
} else {
|
||||
$this->error($upload['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传文件列表
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getUploadFiles()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$page = isset($get['page']) && !empty($get['page']) ? $get['page'] : 1;
|
||||
$limit = isset($get['limit']) && !empty($get['limit']) ? $get['limit'] : 10;
|
||||
$title = isset($get['title']) && !empty($get['title']) ? $get['title'] : null;
|
||||
$this->model = new SystemUploadfile();
|
||||
$count = $this->model
|
||||
->where(function (Query $query) use ($title) {
|
||||
!empty($title) && $query->where('original_name', 'like', "%{$title}%");
|
||||
})
|
||||
->count();
|
||||
$list = $this->model
|
||||
->where(function (Query $query) use ($title) {
|
||||
!empty($title) && $query->where('original_name', 'like', "%{$title}%");
|
||||
})
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Category as ModelCategory;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Category extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$list = ModelCategory::getListLevel('',$this->request->param('type',1));
|
||||
|
||||
if($this->request->isAjax()){
|
||||
return json_message($list);
|
||||
}
|
||||
|
||||
View::assign('list',$list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
|
||||
$list = ModelCategory::getListLevel('',$this->request->param('type',1));
|
||||
|
||||
View::assign('list_category',$list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
$post_data = $request->post();
|
||||
|
||||
if(empty($post_data['title'])){
|
||||
return $this->error('标题不能为空',null,500);
|
||||
}
|
||||
|
||||
$model_category = ModelCategory::where('title',$post_data['title'])
|
||||
->where('type',$post_data['type'])
|
||||
->where('pid',$post_data['pid'])
|
||||
->find();
|
||||
|
||||
if(!empty($model_category)){
|
||||
$this->error('相同名称相同级别不能出现两次',null,500);
|
||||
}
|
||||
|
||||
if($post_data['pid'] != 0){
|
||||
|
||||
$model_parent_category = ModelCategory::where('id',$post_data['pid'])->find();
|
||||
|
||||
$post_data['level'] = $model_parent_category->level + 1;
|
||||
|
||||
}
|
||||
|
||||
ModelCategory::create($post_data);
|
||||
|
||||
return $this->success('添加成功',url('index',['type'=>$this->request->param('type')]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_category = ModelCategory::find($id);
|
||||
|
||||
$list = ModelCategory::getListLevel('',$this->request->param('type',1));
|
||||
|
||||
View::assign('list_category',$list);
|
||||
View::assign('category',$model_category);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
$model_category = ModelCategory::where('title',$post_data['title'])
|
||||
->where('pid',$post_data['pid'])
|
||||
->where('id','<>',$id)
|
||||
->find();
|
||||
|
||||
if(!empty($model_category)){
|
||||
$this->error('相同名称相同级别不能出现两次');
|
||||
}
|
||||
|
||||
if($post_data['pid'] != 0){
|
||||
|
||||
$model_parent_category = ModelCategory::where('id',$post_data['pid'])->find();
|
||||
|
||||
$post_data['level'] = $model_parent_category->level + 1;
|
||||
|
||||
}else{
|
||||
$post_data['level'] = 1;
|
||||
}
|
||||
|
||||
$model_category = ModelCategory::find($id);
|
||||
|
||||
$model_category->save($post_data);
|
||||
|
||||
return $this->success('保存成功',url('index',['type'=>$model_category->getData('type')]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
|
||||
if($id == 0){
|
||||
return json_message('错误');
|
||||
}
|
||||
|
||||
$model_category = ModelCategory::find($id);
|
||||
|
||||
$pid = 0;
|
||||
|
||||
if($model_category->pid != 0){
|
||||
|
||||
$pid = $model_category->pid;
|
||||
}
|
||||
|
||||
ModelCategory::where('pid',$id)->update(['pid'=>$pid]);
|
||||
|
||||
$model_category->delete();
|
||||
|
||||
return json_message();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use think\facade\Session;
|
||||
use app\model\Admin;
|
||||
use app\model\AdminPermission;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\facade\View;
|
||||
|
||||
class Common extends BaseController{
|
||||
|
||||
public $adminInfo = null;
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
|
||||
|
||||
$admin_id = Session::get('admin_id');
|
||||
|
||||
if($this->request->controller() !== 'Login'){
|
||||
|
||||
if(empty($admin_id)){
|
||||
return $this->error('请登录','admin/Login/index');
|
||||
}
|
||||
|
||||
$this->adminInfo = Admin::find(Session::get('admin_id'));
|
||||
|
||||
if(empty($this->adminInfo)){
|
||||
if($this->request->controller() !== 'Login'){
|
||||
throw new HttpResponseException(redirect('admin/Login/index'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
View::assign('admin',$this->adminInfo);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\UploadFiles;
|
||||
use app\UploadFiles as AppUploadFiles;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class File extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$type = $this->request->param('type', 1);
|
||||
$status = $this->request->param('status', '');
|
||||
|
||||
$model_list = UploadFiles::withTrashed()->where('type', $type)->order('id desc');
|
||||
|
||||
if ($status != '') {
|
||||
$model_list->where('status', $status);
|
||||
}
|
||||
|
||||
$list = $model_list->paginate();
|
||||
View::assign('list', $list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
return AppUploadFiles::save($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function clear($id)
|
||||
{
|
||||
AppUploadFiles::clear($id);
|
||||
|
||||
return json_message();
|
||||
}
|
||||
}
|
||||
@@ -2,93 +2,119 @@
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Request;
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
|
||||
class Index extends Common
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\admin\model\SystemQuick;
|
||||
use app\common\controller\AdminController;
|
||||
use think\App;
|
||||
use think\facade\Env;
|
||||
|
||||
class Index extends AdminController
|
||||
{
|
||||
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
* 后台主页
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return View::fetch();
|
||||
return $this->fetch('', [
|
||||
'admin' => session('admin'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
* 后台欢迎页
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function create()
|
||||
public function welcome()
|
||||
{
|
||||
//
|
||||
$quicks = SystemQuick::field('id,title,icon,href')
|
||||
->where(['status' => 1])
|
||||
->order('sort', 'desc')
|
||||
->limit(8)
|
||||
->select();
|
||||
$this->assign('quicks', $quicks);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
* 修改管理员信息
|
||||
* @return string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function save(Request $request)
|
||||
public function editAdmin()
|
||||
{
|
||||
//
|
||||
$id = session('admin.id');
|
||||
$row = (new SystemAdmin())
|
||||
->withoutField('password')
|
||||
->find($id);
|
||||
empty($row) && $this->error('用户信息不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$this->isDemo && $this->error('演示环境下不允许修改');
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $row
|
||||
->allowField(['head_img', 'phone', 'remark', 'update_time'])
|
||||
->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
* 修改密码
|
||||
* @return string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function read($id)
|
||||
public function editPassword()
|
||||
{
|
||||
//
|
||||
$id = session('admin.id');
|
||||
$row = (new SystemAdmin())
|
||||
->withoutField('password')
|
||||
->find($id);
|
||||
if (!$row) {
|
||||
$this->error('用户信息不存在');
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$this->isDemo && $this->error('演示环境下不允许修改');
|
||||
$rule = [
|
||||
'password|登录密码' => 'require',
|
||||
'password_again|确认密码' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
if ($post['password'] != $post['password_again']) {
|
||||
$this->error('两次密码输入不一致');
|
||||
}
|
||||
|
||||
try {
|
||||
$save = $row->save([
|
||||
'password' => password($post['password']),
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
if ($save) {
|
||||
$this->success('保存成功');
|
||||
} else {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
}
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,99 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Request;
|
||||
use think\facade\View;
|
||||
use think\facade\Validate;
|
||||
use think\validate\ValidateRule as Rule;
|
||||
use app\model\Admin;
|
||||
use think\facade\Session;
|
||||
|
||||
class Login extends Common
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\common\controller\AdminController;
|
||||
use think\captcha\facade\Captcha;
|
||||
use think\facade\Env;
|
||||
|
||||
/**
|
||||
* Class Login
|
||||
* @package app\admin\controller
|
||||
*/
|
||||
class Login extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
* 初始化方法
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$action = $this->request->action();
|
||||
if (!empty(session('admin')) && !in_array($action, ['out'])) {
|
||||
$adminModuleName = config('app.admin_alias_name');
|
||||
$this->success('已登录,无需再次登录', [], __url("@{$adminModuleName}"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return View::fetch();
|
||||
$captcha = Env::get('easyadmin.captcha', 1);
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'username|用户名' => 'require',
|
||||
'password|密码' => 'require',
|
||||
'keep_login|是否保持登录' => 'require',
|
||||
];
|
||||
$captcha == 1 && $rule['captcha|验证码'] = 'require|captcha';
|
||||
$this->validate($post, $rule);
|
||||
$admin = SystemAdmin::where(['username' => $post['username']])->find();
|
||||
if (empty($admin)) {
|
||||
$this->error('用户不存在');
|
||||
}
|
||||
if (password($post['password']) != $admin->password) {
|
||||
$this->error('密码输入有误');
|
||||
}
|
||||
if ($admin->status == 0) {
|
||||
$this->error('账号已被禁用');
|
||||
}
|
||||
$admin->login_num += 1;
|
||||
$admin->save();
|
||||
$admin = $admin->toArray();
|
||||
unset($admin['password']);
|
||||
$admin['expire_time'] = $post['keep_login'] == 1 ? true : time() + 7200;
|
||||
session('admin', $admin);
|
||||
$this->success('登录成功');
|
||||
}
|
||||
$this->assign('captcha', $captcha);
|
||||
$this->assign('demo', $this->isDemo);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function auth()
|
||||
/**
|
||||
* 用户退出
|
||||
* @return mixed
|
||||
*/
|
||||
public function out()
|
||||
{
|
||||
$post_data = $this->request->post();
|
||||
|
||||
|
||||
|
||||
$validate = Validate::rule('account',Rule::isRequire())
|
||||
->rule('password',Rule::isRequire())
|
||||
->rule('captcha',function($value){
|
||||
return \captcha_check($value)?true:'验证码错误';
|
||||
});
|
||||
|
||||
if(!$validate->check($post_data)){
|
||||
Session::set('admin_id',1);
|
||||
return json_message();
|
||||
return json_message($validate->getError());
|
||||
}
|
||||
|
||||
$model_admin = Admin::where('account',$post_data['account'])->find();
|
||||
|
||||
if(empty($model_admin)){
|
||||
Session::set('admin_id',1);
|
||||
return json_message();
|
||||
return json_message('帐号不存在');
|
||||
}
|
||||
|
||||
if($model_admin->getData('password') !== md5($post_data['password'].$model_admin->getData('salt'))){
|
||||
Session::set('admin_id',1);
|
||||
return json_message();
|
||||
return json_message('密码错误');
|
||||
}
|
||||
|
||||
Session::set('admin_id',$model_admin->id);
|
||||
|
||||
return json_message();
|
||||
session('admin', null);
|
||||
$this->success('退出登录成功');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
/**
|
||||
* 验证码
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function captcha()
|
||||
{
|
||||
Session::clear();
|
||||
|
||||
$this->success('已经安全退出','Login/Index');
|
||||
return Captcha::create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Nav as ModelNav;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Nav extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
//
|
||||
$type = $request->param('type',1);
|
||||
|
||||
$list = ModelNav::order('sort asc')->order('id asc')->where('type',$type)->select();
|
||||
|
||||
View::assign('type', $type);
|
||||
View::assign('list', $list);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
ModelNav::create($post_data);
|
||||
|
||||
return $this->success('添加成功', url('index',[
|
||||
'type'=>$request->param('type',1),
|
||||
'show_img'=>$request->param('show_img',0),
|
||||
'show_target'=>$request->param('show_target',0),
|
||||
'show_xcx'=>$request->param('show_xcx',0),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_nav = ModelNav::find($id);
|
||||
|
||||
|
||||
View::assign('nav', $model_nav);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
$model_nav = ModelNav::find($id);
|
||||
|
||||
$model_nav->save($post_data);
|
||||
|
||||
return $this->success('保存成功', url('index',[
|
||||
'type'=>$model_nav->getData('type',1),
|
||||
'show_img'=>$request->param('show_img',0),
|
||||
'show_target'=>$request->param('show_target',0),
|
||||
'show_xcx'=>$request->param('show_xcx',0),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
|
||||
ModelNav::destroy($id);
|
||||
|
||||
return $this->success("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Category;
|
||||
use app\model\Post as ModelPost;
|
||||
use app\model\PostCategory;
|
||||
use app\model\PostTag;
|
||||
use app\model\Tag;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Post extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$list = ModelPost::with(['categorys.category','tags.tag'])
|
||||
->where('type',$this->request->param('type',1))
|
||||
->order('id desc')
|
||||
->paginate();
|
||||
|
||||
View::assign('list', $list);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
$categorys = [];
|
||||
$tags = [];
|
||||
if (isset($post_data['categorys'])) {
|
||||
$categorys = $post_data['categorys'];
|
||||
unset($post_data['categorys']);
|
||||
}
|
||||
if (isset($post_data['tags'])) {
|
||||
$tags = $post_data['tags'];
|
||||
unset($post_data['tags']);
|
||||
}
|
||||
|
||||
$model_post = ModelPost::create($post_data);
|
||||
|
||||
foreach ($categorys as $category) {
|
||||
PostCategory::create([
|
||||
'post_id' => $model_post->id,
|
||||
'category_id' => $category
|
||||
]);
|
||||
}
|
||||
foreach ($tags as $tag) {
|
||||
PostTag::create([
|
||||
'post_id' => $model_post->id,
|
||||
'tag_id' => $tag
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->success('添加成功',url('index',['type'=>$this->request->param('type')]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_post = ModelPost::find($id);
|
||||
|
||||
|
||||
View::assign('post', $model_post);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$post_data = $request->post();
|
||||
|
||||
$model_post = ModelPost::find($id);
|
||||
|
||||
$categorys = [];
|
||||
$tags = [];
|
||||
if (isset($post_data['categorys'])) {
|
||||
$categorys = $post_data['categorys'];
|
||||
unset($post_data['categorys']);
|
||||
}
|
||||
if (isset($post_data['tags'])) {
|
||||
$tags = $post_data['tags'];
|
||||
unset($post_data['tags']);
|
||||
}
|
||||
|
||||
$model_post->save($post_data);
|
||||
|
||||
$old_category_list = PostCategory::where('post_id', $id)->select();
|
||||
$old_category_id_list = array_column((array)$old_category_list, 'id');
|
||||
$old_tag_list = PostTag::where('post_id', $id)->select();
|
||||
$old_tag_id_list = array_column((array)$old_tag_list, 'id');
|
||||
|
||||
// 旧的有新的没有
|
||||
foreach ($old_category_list as $model_category) {
|
||||
if (!in_array($model_category->id, $categorys)) {
|
||||
$model_category->delete();
|
||||
}
|
||||
}
|
||||
foreach ($old_tag_list as $model_tag) {
|
||||
if (!in_array($model_tag->id, $tags)) {
|
||||
$model_tag->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 旧的没有新的有
|
||||
foreach ($categorys as $category) {
|
||||
if (!in_array($category, $old_category_id_list)) {
|
||||
|
||||
PostCategory::create([
|
||||
'post_id' => $model_post->id,
|
||||
'category_id' => $category
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if (!in_array($tag, $old_tag_id_list)) {
|
||||
|
||||
PostTag::create([
|
||||
'post_id' => $model_post->id,
|
||||
'tag_id' => $tag
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success('保存成功', url('index',['type'=>$model_post->getData('type')]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_post = ModelPost::find($id);
|
||||
|
||||
$model_post->delete();
|
||||
|
||||
PostCategory::where('post_id',$id)->delete();
|
||||
|
||||
PostTag::where('post_id',$id)->delete();
|
||||
|
||||
return json_message();
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Request;
|
||||
use think\facade\View;
|
||||
use app\model\SystemConfig;
|
||||
use think\facade\Cache;
|
||||
use EasyWeChat\Factory;
|
||||
use think\facade\Config;
|
||||
use app\model\WxPublicAccount;
|
||||
use app\UploadFiles as AppUploadFiles;
|
||||
|
||||
class System extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
public function others()
|
||||
{
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
public function agreement()
|
||||
{
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
||||
public function update()
|
||||
{
|
||||
|
||||
$upload_files_config = [
|
||||
'site_logo'
|
||||
];
|
||||
|
||||
$post_data = $this->request->post();
|
||||
|
||||
$list = SystemConfig::column('value','name');
|
||||
|
||||
foreach ($post_data as $key => $value) {
|
||||
|
||||
if(!is_string($value)){
|
||||
$value = serialize($value);
|
||||
}
|
||||
|
||||
if(\in_array($key,$upload_files_config)){
|
||||
$old_save_name = get_system_config($key);
|
||||
AppUploadFiles::use($value);
|
||||
if($old_save_name != $value){
|
||||
AppUploadFiles::delete($old_save_name);
|
||||
}
|
||||
}
|
||||
if(isset($list[$key])){
|
||||
SystemConfig::where('name',$key)->update(['value'=>$value]);
|
||||
}else{
|
||||
$model_sysconfig = new SystemConfig();
|
||||
$model_sysconfig->name = $key;
|
||||
$model_sysconfig->value = $value;
|
||||
$model_sysconfig->save();
|
||||
}
|
||||
|
||||
$list[$key] = $value;
|
||||
}
|
||||
|
||||
Cache::set('system_config',$list);
|
||||
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
public function clearCache()
|
||||
{
|
||||
Cache::clear();
|
||||
|
||||
return $this->success('清楚成功');
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Tag as ModelTag;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Tag extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$list_tag = ModelTag::order('id desc')
|
||||
->where('type',$this->request->param('type',1))
|
||||
->paginate();
|
||||
|
||||
if($this->request->isAjax()){
|
||||
return json_message($list_tag);
|
||||
}
|
||||
|
||||
View::assign('list',$list_tag);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
$post_data = $request->post();
|
||||
|
||||
$type = $post_data['type'];
|
||||
|
||||
$arr = explode(' ',$post_data['tags']);
|
||||
|
||||
$arr = array_unique(array_filter($arr));
|
||||
|
||||
foreach ($arr as $tag) {
|
||||
$model_tag = ModelTag::where('title',$tag)->where('type',$type)->find();
|
||||
|
||||
if(empty($model_tag)){
|
||||
ModelTag::create(['title'=>$tag,'type'=>$type]);
|
||||
}
|
||||
}
|
||||
|
||||
return json_message();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
|
||||
$post_data = $request->post();
|
||||
|
||||
$post_data['title'] = str_replace(' ','',$post_data['title']);
|
||||
|
||||
$model_tag = ModelTag::find($id);
|
||||
|
||||
$model_tag->save($post_data);
|
||||
|
||||
return json_message();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\User as AppUser;
|
||||
use app\UploadFiles;
|
||||
use think\Request;
|
||||
use think\facade\View;
|
||||
use think\helper\Str;
|
||||
|
||||
class User extends Common
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
|
||||
$list = AppUser::paginate();
|
||||
|
||||
View::assign('list',$list);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
$post_data = $this->request->post();
|
||||
|
||||
$admin_model = AppUser::where('account',$post_data['account'])->find();
|
||||
|
||||
if(!empty($admin_model)){
|
||||
$this->error('用户已存在');
|
||||
}
|
||||
|
||||
if(empty($post_data['password'])){
|
||||
$post_data['password'] = '123456';
|
||||
}
|
||||
|
||||
if(!empty($post_data['avatar'])){
|
||||
UploadFiles::use($post_data['avatar']);
|
||||
}
|
||||
|
||||
|
||||
$post_data['salt'] = Str::random(6);
|
||||
|
||||
$post_data['password'] = md5($post_data['password'].$post_data['salt']);
|
||||
|
||||
AppUser::create($post_data);
|
||||
|
||||
$this->success('添加成功','index');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
|
||||
|
||||
$model_user = AppUser::find($id);
|
||||
|
||||
View::assign('user',$model_user);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$post_data = $this->request->post();
|
||||
|
||||
$model_user = AppUser::find($id);
|
||||
|
||||
if(!empty($post_data['password'])){
|
||||
$post_data['salt'] = Str::random(6);
|
||||
|
||||
$post_data['password'] = md5($post_data['password'].$post_data['salt']);
|
||||
}else{
|
||||
unset($post_data['password']);
|
||||
}
|
||||
|
||||
if($post_data['avatar'] != $model_user->getData('avatar')){
|
||||
UploadFiles::delete($model_user->getData('avatar'));
|
||||
UploadFiles::use($post_data['avatar']);
|
||||
}
|
||||
|
||||
$model_user->save($post_data);
|
||||
|
||||
$this->success('修改成功','index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
|
||||
$model_user = AppUser::find($id);
|
||||
|
||||
UploadFiles::delete($model_user->getData('avatar'));
|
||||
|
||||
$model_user->delete();
|
||||
|
||||
return json_message();
|
||||
|
||||
}
|
||||
}
|
||||
30
app/admin/controller/mall/Cate.php
Normal file
30
app/admin/controller/mall/Cate.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\mall;
|
||||
|
||||
|
||||
use app\admin\model\MallCate;
|
||||
use app\admin\traits\Curd;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Class Admin
|
||||
* @package app\admin\controller\system
|
||||
* @ControllerAnnotation(title="商品分类管理")
|
||||
*/
|
||||
class Cate extends AdminController
|
||||
{
|
||||
|
||||
use Curd;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new MallCate();
|
||||
}
|
||||
|
||||
}
|
||||
87
app/admin/controller/mall/Goods.php
Normal file
87
app/admin/controller/mall/Goods.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\mall;
|
||||
|
||||
|
||||
use app\admin\model\MallGoods;
|
||||
use app\admin\traits\Curd;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Class Goods
|
||||
* @package app\admin\controller\mall
|
||||
* @ControllerAnnotation(title="商城商品管理")
|
||||
*/
|
||||
class Goods extends AdminController
|
||||
{
|
||||
|
||||
use Curd;
|
||||
|
||||
protected $relationSearch = true;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new MallGoods();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
list($page, $limit, $where) = $this->buildTableParames();
|
||||
$count = $this->model
|
||||
->withJoin('cate', 'LEFT')
|
||||
->where($where)
|
||||
->count();
|
||||
$list = $this->model
|
||||
->withJoin('cate', 'LEFT')
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="入库")
|
||||
*/
|
||||
public function stock($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$post['total_stock'] = $row->total_stock + $post['stock'];
|
||||
$post['stock'] = $row->stock + $post['stock'];
|
||||
$save = $row->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
212
app/admin/controller/system/Admin.php
Normal file
212
app/admin/controller/system/Admin.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\constants\AdminConstant;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Class Admin
|
||||
* @package app\admin\controller\system
|
||||
* @ControllerAnnotation(title="管理员管理")
|
||||
*/
|
||||
class Admin extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
protected $sort = [
|
||||
'sort' => 'desc',
|
||||
'id' => 'desc',
|
||||
];
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemAdmin();
|
||||
$this->assign('auth_list', $this->model->getAuthList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
list($page, $limit, $where) = $this->buildTableParames();
|
||||
$count = $this->model
|
||||
->where($where)
|
||||
->count();
|
||||
$list = $this->model
|
||||
->withoutField('password')
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="添加")
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$authIds = $this->request->post('auth_ids', []);
|
||||
$post['auth_ids'] = implode(',', array_keys($authIds));
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $this->model->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="编辑")
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$authIds = $this->request->post('auth_ids', []);
|
||||
$post['auth_ids'] = implode(',', array_keys($authIds));
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
if (isset($row['password'])) {
|
||||
unset($row['password']);
|
||||
}
|
||||
try {
|
||||
$save = $row->save($post);
|
||||
TriggerService::updateMenu($id);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
$row->auth_ids = explode(',', $row->auth_ids);
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="编辑")
|
||||
*/
|
||||
public function password($id)
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'password|登录密码' => 'require',
|
||||
'password_again|确认密码' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
if ($post['password'] != $post['password_again']) {
|
||||
$this->error('两次密码输入不一致');
|
||||
}
|
||||
try {
|
||||
$save = $row->save([
|
||||
'password' => password($post['password']),
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
$row->auth_ids = explode(',', $row->auth_ids);
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="删除")
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$row = $this->model->whereIn('id', $id)->select();
|
||||
$row->isEmpty() && $this->error('数据不存在');
|
||||
$id == AdminConstant::SUPER_ADMIN_ID && $this->error('超级管理员不允许修改');
|
||||
if (is_array($id)){
|
||||
if (in_array(AdminConstant::SUPER_ADMIN_ID, $id)){
|
||||
$this->error('超级管理员不允许修改');
|
||||
}
|
||||
}
|
||||
try {
|
||||
$save = $row->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('删除失败');
|
||||
}
|
||||
$save ? $this->success('删除成功') : $this->error('删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="属性修改")
|
||||
*/
|
||||
public function modify()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'id|ID' => 'require',
|
||||
'field|字段' => 'require',
|
||||
'value|值' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
if (!in_array($post['field'], $this->allowModifyFields)) {
|
||||
$this->error('该字段不允许修改:' . $post['field']);
|
||||
}
|
||||
if ($post['id'] == AdminConstant::SUPER_ADMIN_ID && $post['field'] == 'status') {
|
||||
$this->error('超级管理员状态不允许修改');
|
||||
}
|
||||
$row = $this->model->find($post['id']);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
try {
|
||||
$row->save([
|
||||
$post['field'] => $post['value'],
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
91
app/admin/controller/system/Auth.php
Normal file
91
app/admin/controller/system/Auth.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemAuth;
|
||||
use app\admin\model\SystemAuthNode;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="角色权限管理")
|
||||
* Class Auth
|
||||
* @package app\admin\controller\system
|
||||
*/
|
||||
class Auth extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
protected $sort = [
|
||||
'sort' => 'desc',
|
||||
'id' => 'desc',
|
||||
];
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemAuth();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="授权")
|
||||
*/
|
||||
public function authorize($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isAjax()) {
|
||||
$list = $this->model->getAuthorizeNodeListByAdminId($id);
|
||||
$this->success('获取成功', $list);
|
||||
}
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="授权保存")
|
||||
*/
|
||||
public function saveAuthorize()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$id = $this->request->post('id');
|
||||
$node = $this->request->post('node', "[]");
|
||||
$node = json_decode($node, true);
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
try {
|
||||
$authNode = new SystemAuthNode();
|
||||
$authNode->where('auth_id', $id)->delete();
|
||||
if (!empty($node)) {
|
||||
$saveAll = [];
|
||||
foreach ($node as $vo) {
|
||||
$saveAll[] = [
|
||||
'auth_id' => $id,
|
||||
'node_id' => $vo,
|
||||
];
|
||||
}
|
||||
$authNode->saveAll($saveAll);
|
||||
}
|
||||
TriggerService::updateMenu();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
}
|
||||
68
app/admin/controller/system/Config.php
Normal file
68
app/admin/controller/system/Config.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemConfig;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Class Config
|
||||
* @package app\admin\controller\system
|
||||
* @ControllerAnnotation(title="系统配置管理")
|
||||
*/
|
||||
class Config extends AdminController
|
||||
{
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="保存")
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$post = $this->request->post();
|
||||
try {
|
||||
foreach ($post as $key => $val) {
|
||||
$this->model
|
||||
->where('name', $key)
|
||||
->update([
|
||||
'value' => $val,
|
||||
]);
|
||||
}
|
||||
TriggerService::updateMenu();
|
||||
TriggerService::updateSysconfig();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
}
|
||||
67
app/admin/controller/system/Log.php
Normal file
67
app/admin/controller/system/Log.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemLog;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="操作日志管理")
|
||||
* Class Auth
|
||||
* @package app\admin\controller\system
|
||||
*/
|
||||
class Log extends AdminController
|
||||
{
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
[$page, $limit, $where, $excludeFields] = $this->buildTableParames(['month']);
|
||||
|
||||
$month = (isset($excludeFields['month']) && !empty($excludeFields['month']))
|
||||
? date('Ym',strtotime($excludeFields['month']))
|
||||
: date('Ym');
|
||||
|
||||
// todo TP6框架有一个BUG,非模型名与表名不对应时(name属性自定义),withJoin生成的sql有问题
|
||||
|
||||
$count = $this->model
|
||||
->setMonth($month)
|
||||
->with('admin')
|
||||
->where($where)
|
||||
->select();
|
||||
$list = $this->model
|
||||
->setMonth($month)
|
||||
->with('admin')
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->select();
|
||||
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
219
app/admin/controller/system/Menu.php
Normal file
219
app/admin/controller/system/Menu.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
use app\admin\model\SystemMenu;
|
||||
use app\admin\model\SystemNode;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\constants\MenuConstant;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use app\common\controller\AdminController;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* Class Menu
|
||||
* @package app\admin\controller\system
|
||||
* @ControllerAnnotation(title="菜单管理",auth=true)
|
||||
*/
|
||||
class Menu extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
protected $sort = [
|
||||
'sort' => 'desc',
|
||||
'id' => 'asc',
|
||||
];
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
$count = $this->model->count();
|
||||
$list = $this->model->order($this->sort)->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="添加")
|
||||
*/
|
||||
public function add($id = null)
|
||||
{
|
||||
$homeId = $this->model
|
||||
->where([
|
||||
'pid' => MenuConstant::HOME_PID,
|
||||
])
|
||||
->value('id');
|
||||
if ($id == $homeId) {
|
||||
$this->error('首页不能添加子菜单');
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'pid|上级菜单' => 'require',
|
||||
'title|菜单名称' => 'require',
|
||||
'icon|菜单图标' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $this->model->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
if ($save) {
|
||||
TriggerService::updateMenu();
|
||||
$this->success('保存成功');
|
||||
} else {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
}
|
||||
$pidMenuList = $this->model->getPidMenuList();
|
||||
$this->assign('id', $id);
|
||||
$this->assign('pidMenuList', $pidMenuList);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="编辑")
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'pid|上级菜单' => 'require',
|
||||
'title|菜单名称' => 'require',
|
||||
'icon|菜单图标' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $row->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
if ($save) {
|
||||
TriggerService::updateMenu();
|
||||
$this->success('保存成功');
|
||||
} else {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
}
|
||||
$pidMenuList = $this->model->getPidMenuList();
|
||||
$this->assign([
|
||||
'id' => $id,
|
||||
'pidMenuList' => $pidMenuList,
|
||||
'row' => $row,
|
||||
]);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="删除")
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$row = $this->model->whereIn('id', $id)->select();
|
||||
empty($row) && $this->error('数据不存在');
|
||||
try {
|
||||
$save = $row->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('删除失败');
|
||||
}
|
||||
if ($save) {
|
||||
TriggerService::updateMenu();
|
||||
$this->success('删除成功');
|
||||
} else {
|
||||
$this->error('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="属性修改")
|
||||
*/
|
||||
public function modify()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'id|ID' => 'require',
|
||||
'field|字段' => 'require',
|
||||
'value|值' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
$row = $this->model->find($post['id']);
|
||||
if (!$row) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
if (!in_array($post['field'], $this->allowModifyFields)) {
|
||||
$this->error('该字段不允许修改:' . $post['field']);
|
||||
}
|
||||
$homeId = $this->model
|
||||
->where([
|
||||
'pid' => MenuConstant::HOME_PID,
|
||||
])
|
||||
->value('id');
|
||||
if ($post['id'] == $homeId && $post['field'] == 'status') {
|
||||
$this->error('首页状态不允许关闭');
|
||||
}
|
||||
try {
|
||||
$row->save([
|
||||
$post['field'] => $post['value'],
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
TriggerService::updateMenu();
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="添加菜单提示")
|
||||
*/
|
||||
public function getMenuTips()
|
||||
{
|
||||
$node = input('get.keywords');
|
||||
$list = SystemNode::whereLike('node', "%{$node}%")
|
||||
->field('node,title')
|
||||
->limit(10)
|
||||
->select();
|
||||
return json([
|
||||
'code' => 0,
|
||||
'content' => $list,
|
||||
'type' => 'success',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
121
app/admin/controller/system/Node.php
Normal file
121
app/admin/controller/system/Node.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemNode;
|
||||
use app\admin\service\TriggerService;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use app\admin\service\NodeService;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="系统节点管理")
|
||||
* Class Node
|
||||
* @package app\admin\controller\system
|
||||
*/
|
||||
class Node extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
$count = $this->model
|
||||
->count();
|
||||
$list = $this->model
|
||||
->getNodeTreeList();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="系统节点更新")
|
||||
*/
|
||||
public function refreshNode($force = 0)
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$nodeList = (new NodeService())->getNodelist();
|
||||
empty($nodeList) && $this->error('暂无需要更新的系统节点');
|
||||
$model = new SystemNode();
|
||||
try {
|
||||
if ($force == 1) {
|
||||
$updateNodeList = $model->whereIn('node', array_column($nodeList, 'node'))->select();
|
||||
$formatNodeList = array_format_key($nodeList, 'node');
|
||||
foreach ($updateNodeList as $vo) {
|
||||
isset($formatNodeList[$vo['node']]) && $model->where('id', $vo['id'])->update([
|
||||
'title' => $formatNodeList[$vo['node']]['title'],
|
||||
'is_auth' => $formatNodeList[$vo['node']]['is_auth'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
$existNodeList = $model->field('node,title,type,is_auth')->select();
|
||||
foreach ($nodeList as $key => $vo) {
|
||||
foreach ($existNodeList as $v) {
|
||||
if ($vo['node'] == $v->node) {
|
||||
unset($nodeList[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$model->saveAll($nodeList);
|
||||
TriggerService::updateNode();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('节点更新失败');
|
||||
}
|
||||
$this->success('节点更新成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="清除失效节点")
|
||||
*/
|
||||
public function clearNode()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$nodeList = (new NodeService())->getNodelist();
|
||||
$model = new SystemNode();
|
||||
try {
|
||||
$existNodeList = $model->field('id,node,title,type,is_auth')->select()->toArray();
|
||||
$formatNodeList = array_format_key($nodeList, 'node');
|
||||
foreach ($existNodeList as $vo) {
|
||||
!isset($formatNodeList[$vo['node']]) && $model->where('id', $vo['id'])->delete();
|
||||
}
|
||||
TriggerService::updateNode();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('节点更新失败');
|
||||
}
|
||||
$this->success('节点更新成功');
|
||||
}
|
||||
}
|
||||
43
app/admin/controller/system/Quick.php
Normal file
43
app/admin/controller/system/Quick.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemQuick;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="快捷入口管理")
|
||||
* Class Quick
|
||||
* @package app\admin\controller\system
|
||||
*/
|
||||
class Quick extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
protected $sort = [
|
||||
'sort' => 'desc',
|
||||
'id' => 'desc',
|
||||
];
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemQuick();
|
||||
}
|
||||
|
||||
}
|
||||
38
app/admin/controller/system/Uploadfile.php
Normal file
38
app/admin/controller/system/Uploadfile.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\system;
|
||||
|
||||
|
||||
use app\admin\model\SystemUploadfile;
|
||||
use app\common\controller\AdminController;
|
||||
use EasyAdmin\annotation\ControllerAnnotation;
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* @ControllerAnnotation(title="上传文件管理")
|
||||
* Class Uploadfile
|
||||
* @package app\admin\controller\system
|
||||
*/
|
||||
class Uploadfile extends AdminController
|
||||
{
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new SystemUploadfile();
|
||||
}
|
||||
|
||||
}
|
||||
21
app/admin/event.php
Normal file
21
app/admin/event.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// 事件定义文件
|
||||
return [
|
||||
'bind' => [
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
'AppInit' => [
|
||||
\app\admin\listener\ViewInitListener::class,
|
||||
],
|
||||
'HttpRun' => [
|
||||
\app\admin\listener\ViewInitListener::class,
|
||||
],
|
||||
'HttpEnd' => [],
|
||||
'LogLevel' => [],
|
||||
'LogWrite' => [],
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
@@ -1,6 +1,21 @@
|
||||
<?php
|
||||
|
||||
// 全局中间件定义文件
|
||||
return [
|
||||
'\app\middleware\PermissionRecord',
|
||||
'\app\middleware\AdminLog',
|
||||
];
|
||||
|
||||
// Session初始化
|
||||
\think\middleware\SessionInit::class,
|
||||
|
||||
// 系统操作日志
|
||||
\app\admin\middleware\SystemLog::class,
|
||||
|
||||
// Csrf安全校验
|
||||
\app\admin\middleware\CsrfMiddleware::class,
|
||||
|
||||
// 后台视图初始化
|
||||
// \app\admin\middleware\ViewInit::class,
|
||||
|
||||
// 检测用户是否登录
|
||||
// \app\admin\middleware\CheckAdmin::class,
|
||||
|
||||
|
||||
];
|
||||
|
||||
67
app/admin/middleware/CheckAdmin.php
Normal file
67
app/admin/middleware/CheckAdmin.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\middleware;
|
||||
|
||||
use app\common\service\AuthService;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* @deprecated 废弃,新版TP不支持在中间件获取控制器相关信息
|
||||
* 检测用户登录和节点权限
|
||||
* Class CheckAdmin
|
||||
* @package app\admin\middleware
|
||||
*/
|
||||
class CheckAdmin
|
||||
{
|
||||
|
||||
use \app\common\traits\JumpTrait;
|
||||
|
||||
public function handle(Request $request, \Closure $next)
|
||||
{
|
||||
$adminConfig = config('admin');
|
||||
$adminId = session('admin.id');
|
||||
$expireTime = session('admin.expire_time');
|
||||
/** @var AuthService $authService */
|
||||
$authService = app(AuthService::class, ['adminId' => $adminId]);
|
||||
$currentNode = $authService->getCurrentNode();
|
||||
$currentController = parse_name($request->controller());
|
||||
|
||||
// 验证登录
|
||||
if (!in_array($currentController, $adminConfig['no_login_controller']) &&
|
||||
!in_array($currentNode, $adminConfig['no_login_node'])) {
|
||||
empty($adminId) && $this->error('请先登录后台', [], __url('admin/login/index'));
|
||||
|
||||
// 判断是否登录过期
|
||||
if ($expireTime !== true && time() > $expireTime) {
|
||||
session('admin', null);
|
||||
$this->error('登录已过期,请重新登录', [], __url('admin/login/index'));
|
||||
}
|
||||
}
|
||||
|
||||
// 验证权限
|
||||
if (!in_array($currentController, $adminConfig['no_auth_controller']) &&
|
||||
!in_array($currentNode, $adminConfig['no_auth_node'])) {
|
||||
$check = $authService->checkNode($currentNode);
|
||||
!$check && $this->error('无权限访问');
|
||||
|
||||
// 判断是否为演示环境
|
||||
if(env('easyadmin.is_demo', false) && $request->isPost()){
|
||||
$this->error('演示环境下不允许修改');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
53
app/admin/middleware/CsrfMiddleware.php
Normal file
53
app/admin/middleware/CsrfMiddleware.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\middleware;
|
||||
|
||||
|
||||
use app\Request;
|
||||
use CsrfVerify\drive\ThinkphpCache;
|
||||
use CsrfVerify\entity\CsrfVerifyEntity;
|
||||
use CsrfVerify\interfaces\CsrfVerifyInterface;
|
||||
use think\facade\Session;
|
||||
|
||||
class CsrfMiddleware
|
||||
{
|
||||
use \app\common\traits\JumpTrait;
|
||||
|
||||
public function handle(Request $request, \Closure $next)
|
||||
{
|
||||
if (env('EASYADMIN.IS_CSRF', true)) {
|
||||
if (!in_array($request->method(), ['GET', 'HEAD', 'OPTIONS'])) {
|
||||
|
||||
// 跨域校验
|
||||
$refererUrl = $request->header('REFERER', null);
|
||||
$refererInfo = parse_url($refererUrl);
|
||||
$host = $request->host(true);
|
||||
if (!isset($refererInfo['host']) || $refererInfo['host'] != $host) {
|
||||
$this->error('当前请求不合法!');
|
||||
}
|
||||
|
||||
// CSRF校验
|
||||
// @todo 兼容CK编辑器上传功能
|
||||
$ckCsrfToken = $request->post('ckCsrfToken', null);
|
||||
$data = !empty($ckCsrfToken) ? ['__token__' => $ckCsrfToken] : [];
|
||||
|
||||
$check = $request->checkToken('__token__', $data);
|
||||
if (!$check) {
|
||||
$this->error('请求验证失败,请重新刷新页面!');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
77
app/admin/middleware/SystemLog.php
Normal file
77
app/admin/middleware/SystemLog.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\middleware;
|
||||
|
||||
use app\admin\service\SystemLogService;
|
||||
use app\Request;
|
||||
use EasyAdmin\tool\CommonTool;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 系统操作日志中间件
|
||||
* Class SystemLog
|
||||
* @package app\admin\middleware
|
||||
*/
|
||||
class SystemLog
|
||||
{
|
||||
|
||||
/**
|
||||
* 敏感信息字段,日志记录时需要加密
|
||||
* @var array
|
||||
*/
|
||||
protected $sensitiveParams = [
|
||||
'password',
|
||||
'password_again',
|
||||
'phone',
|
||||
'mobile'
|
||||
];
|
||||
|
||||
public function handle(Request $request, \Closure $next)
|
||||
{
|
||||
$params = $request->param();
|
||||
if (isset($params['s'])) {
|
||||
unset($params['s']);
|
||||
}
|
||||
foreach ($params as $key => $val) {
|
||||
in_array($key, $this->sensitiveParams) && $params[$key] = "***********";
|
||||
}
|
||||
$method = strtolower($request->method());
|
||||
$url = $request->url();
|
||||
|
||||
trace([
|
||||
'url' => $url,
|
||||
'method' => $method,
|
||||
'params' => $params,
|
||||
],
|
||||
'requestDebugInfo'
|
||||
);
|
||||
|
||||
if ($request->isAjax()) {
|
||||
if (in_array($method, ['post', 'put', 'delete'])) {
|
||||
$ip = CommonTool::getRealIp();
|
||||
$data = [
|
||||
'admin_id' => session('admin.id'),
|
||||
'url' => $url,
|
||||
'method' => $method,
|
||||
'ip' => $ip,
|
||||
'content' => json_encode($params, JSON_UNESCAPED_UNICODE),
|
||||
'useragent' => $_SERVER['HTTP_USER_AGENT'],
|
||||
'create_time' => time(),
|
||||
];
|
||||
SystemLogService::instance()->save($data);
|
||||
}
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
58
app/admin/middleware/ViewInit.php
Normal file
58
app/admin/middleware/ViewInit.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\middleware;
|
||||
|
||||
|
||||
use app\admin\service\ConfigService;
|
||||
use app\common\constants\AdminConstant;
|
||||
use think\App;
|
||||
use think\facade\Request;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* @deprecated 废弃,新版TP不支持在中间件获取控制器相关信息
|
||||
* Class ViewInit
|
||||
* @package app\admin\middleware
|
||||
*/
|
||||
class ViewInit
|
||||
{
|
||||
|
||||
public function handle(\app\Request $request, \Closure $next)
|
||||
{
|
||||
list($thisModule, $thisController, $thisAction) = [app('http')->getName(), Request::controller(), $request->action()];
|
||||
list($thisControllerArr, $jsPath) = [explode('.', $thisController), null];
|
||||
foreach ($thisControllerArr as $vo) {
|
||||
empty($jsPath) ? $jsPath = parse_name($vo) : $jsPath .= '/' . parse_name($vo);
|
||||
}
|
||||
$autoloadJs = file_exists(root_path('public')."static/{$thisModule}/js/{$jsPath}.js") ? true : false;
|
||||
$thisControllerJsPath = "{$thisModule}/js/{$jsPath}.js";
|
||||
$adminModuleName = config('app.admin_alias_name');
|
||||
$isSuperAdmin = session('admin.id') == AdminConstant::SUPER_ADMIN_ID ? true : false;
|
||||
$data = [
|
||||
'adminModuleName' => $adminModuleName,
|
||||
'thisController' => parse_name($thisController),
|
||||
'thisAction' => $thisAction,
|
||||
'thisRequest' => parse_name("{$thisModule}/{$thisController}/{$thisAction}"),
|
||||
'thisControllerJsPath' => "{$thisControllerJsPath}",
|
||||
'autoloadJs' => $autoloadJs,
|
||||
'isSuperAdmin' => $isSuperAdmin,
|
||||
'version' => env('app_debug') ? time() : ConfigService::getVersion(),
|
||||
];
|
||||
|
||||
View::assign($data);
|
||||
$request->adminModuleName = $adminModuleName;
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
23
app/admin/model/MallCate.php
Normal file
23
app/admin/model/MallCate.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class MallCate extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
||||
30
app/admin/model/MallGoods.php
Normal file
30
app/admin/model/MallGoods.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class MallGoods extends TimeModel
|
||||
{
|
||||
|
||||
protected $table = "";
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function cate()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\MallCate', 'cate_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
31
app/admin/model/SystemAdmin.php
Normal file
31
app/admin/model/SystemAdmin.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemAdmin extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getAuthList()
|
||||
{
|
||||
$list = (new SystemAuth())
|
||||
->where('status', 1)
|
||||
->column('title', 'id');
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
64
app/admin/model/SystemAuth.php
Normal file
64
app/admin/model/SystemAuth.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemAuth extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* 根据角色ID获取授权节点
|
||||
* @param $authId
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getAuthorizeNodeListByAdminId($authId)
|
||||
{
|
||||
$checkNodeList = (new SystemAuthNode())
|
||||
->where('auth_id', $authId)
|
||||
->column('node_id');
|
||||
$systemNode = new SystemNode();
|
||||
$nodelList = $systemNode
|
||||
->where('is_auth', 1)
|
||||
->field('id,node,title,type,is_auth')
|
||||
->select()
|
||||
->toArray();
|
||||
$newNodeList = [];
|
||||
foreach ($nodelList as $vo) {
|
||||
if ($vo['type'] == 1) {
|
||||
$vo = array_merge($vo, ['field' => 'node', 'spread' => true]);
|
||||
$vo['checked'] = false;
|
||||
$vo['title'] = "{$vo['title']}【{$vo['node']}】";
|
||||
$children = [];
|
||||
foreach ($nodelList as $v) {
|
||||
if ($v['type'] == 2 && strpos($v['node'], $vo['node'] . '/') !== false) {
|
||||
$v = array_merge($v, ['field' => 'node', 'spread' => true]);
|
||||
$v['checked'] = in_array($v['id'], $checkNodeList) ? true : false;
|
||||
$v['title'] = "{$v['title']}【{$v['node']}】";
|
||||
$children[] = $v;
|
||||
}
|
||||
}
|
||||
!empty($children) && $vo['children'] = $children;
|
||||
$newNodeList[] = $vo;
|
||||
}
|
||||
}
|
||||
return $newNodeList;
|
||||
}
|
||||
|
||||
}
|
||||
21
app/admin/model/SystemAuthNode.php
Normal file
21
app/admin/model/SystemAuthNode.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemAuthNode extends TimeModel
|
||||
{
|
||||
|
||||
}
|
||||
22
app/admin/model/SystemConfig.php
Normal file
22
app/admin/model/SystemConfig.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemConfig extends TimeModel
|
||||
{
|
||||
|
||||
}
|
||||
29
app/admin/model/SystemLog.php
Normal file
29
app/admin/model/SystemLog.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemLog extends TimeModel
|
||||
{
|
||||
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
parent::__construct($data);
|
||||
$this->name = 'system_log_' . date('Ym');
|
||||
}
|
||||
|
||||
public function setMonth($month)
|
||||
{
|
||||
$this->name = 'system_log_' . $month;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\SystemAdmin', 'admin_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
70
app/admin/model/SystemMenu.php
Normal file
70
app/admin/model/SystemMenu.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
|
||||
use app\common\constants\MenuConstant;
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemMenu extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getPidMenuList()
|
||||
{
|
||||
$list = $this->field('id,pid,title')
|
||||
->where([
|
||||
['pid', '<>', MenuConstant::HOME_PID],
|
||||
['status', '=', 1],
|
||||
])
|
||||
->select()
|
||||
->toArray();
|
||||
$pidMenuList = $this->buildPidMenu(0, $list);
|
||||
$pidMenuList = array_merge([[
|
||||
'id' => 0,
|
||||
'pid' => 0,
|
||||
'title' => '顶级菜单',
|
||||
]], $pidMenuList);
|
||||
return $pidMenuList;
|
||||
}
|
||||
|
||||
protected function buildPidMenu($pid, $list, $level = 0)
|
||||
{
|
||||
$newList = [];
|
||||
foreach ($list as $vo) {
|
||||
if ($vo['pid'] == $pid) {
|
||||
$level++;
|
||||
foreach ($newList as $v) {
|
||||
if ($vo['pid'] == $v['pid'] && isset($v['level'])) {
|
||||
$level = $v['level'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$vo['level'] = $level;
|
||||
if ($level > 1) {
|
||||
$repeatString = " ";
|
||||
$markString = str_repeat("{$repeatString}├{$repeatString}", $level - 1);
|
||||
$vo['title'] = $markString . $vo['title'];
|
||||
}
|
||||
$newList[] = $vo;
|
||||
$childList = $this->buildPidMenu($vo['id'], $list, $level);
|
||||
!empty($childList) && $newList = array_merge($newList, $childList);
|
||||
}
|
||||
|
||||
}
|
||||
return $newList;
|
||||
}
|
||||
|
||||
}
|
||||
47
app/admin/model/SystemNode.php
Normal file
47
app/admin/model/SystemNode.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemNode extends TimeModel
|
||||
{
|
||||
|
||||
public function getNodeTreeList()
|
||||
{
|
||||
$list = $this->select()->toArray();
|
||||
$list = $this->buildNodeTree($list);
|
||||
return $list;
|
||||
}
|
||||
|
||||
protected function buildNodeTree($list)
|
||||
{
|
||||
$newList = [];
|
||||
$repeatString = " ";
|
||||
foreach ($list as $vo) {
|
||||
if ($vo['type'] == 1) {
|
||||
$newList[] = $vo;
|
||||
foreach ($list as $v) {
|
||||
if ($v['type'] == 2 && strpos($v['node'], $vo['node'] . '/') !== false) {
|
||||
$v['node'] = "{$repeatString}├{$repeatString}" . $v['node'];
|
||||
$newList[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
23
app/admin/model/SystemQuick.php
Normal file
23
app/admin/model/SystemQuick.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemQuick extends TimeModel
|
||||
{
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
||||
21
app/admin/model/SystemUploadfile.php
Normal file
21
app/admin/model/SystemUploadfile.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
class SystemUploadfile extends TimeModel
|
||||
{
|
||||
|
||||
}
|
||||
31
app/admin/service/ConfigService.php
Normal file
31
app/admin/service/ConfigService.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use think\facade\Cache;
|
||||
|
||||
class ConfigService
|
||||
{
|
||||
|
||||
public static function getVersion()
|
||||
{
|
||||
$version = Cache('version');
|
||||
if (empty($version)) {
|
||||
$version = sysconfig('site', 'site_version');
|
||||
cache('site_version', $version);
|
||||
Cache::set('version', $version, 3600);
|
||||
}
|
||||
return $version;
|
||||
}
|
||||
|
||||
}
|
||||
37
app/admin/service/NodeService.php
Normal file
37
app/admin/service/NodeService.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
|
||||
use EasyAdmin\auth\Node;
|
||||
|
||||
class NodeService
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取节点服务
|
||||
* @return array
|
||||
* @throws \Doctrine\Common\Annotations\AnnotationException
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function getNodelist()
|
||||
{
|
||||
$basePath = base_path() . 'admin' . DIRECTORY_SEPARATOR . 'controller';
|
||||
$baseNamespace = "app\admin\controller";
|
||||
|
||||
$nodeList = (new Node($basePath, $baseNamespace))
|
||||
->getNodelist();
|
||||
|
||||
return $nodeList;
|
||||
}
|
||||
}
|
||||
136
app/admin/service/SystemLogService.php
Normal file
136
app/admin/service/SystemLogService.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 系统日志表
|
||||
* Class SystemLogService
|
||||
* @package app\admin\service
|
||||
*/
|
||||
class SystemLogService
|
||||
{
|
||||
|
||||
/**
|
||||
* 当前实例
|
||||
* @var object
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* 表前缀
|
||||
* @var string
|
||||
*/
|
||||
protected $tablePrefix;
|
||||
|
||||
/**
|
||||
* 表后缀
|
||||
* @var string
|
||||
*/
|
||||
protected $tableSuffix;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* SystemLogService constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
$this->tablePrefix = Config::get('database.connections.mysql.prefix');
|
||||
$this->tableSuffix = date('Ym', time());
|
||||
$this->tableName = "{$this->tablePrefix}system_log_{$this->tableSuffix}";
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实例对象
|
||||
* @return SystemLogService|object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
if (is_null(self::$instance)) {
|
||||
self::$instance = new static();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$this->detectTable();
|
||||
Db::table($this->tableName)->insert($data);
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return $e->getMessage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测数据表
|
||||
* @return bool
|
||||
*/
|
||||
protected function detectTable()
|
||||
{
|
||||
$check = Db::query("show tables like '{$this->tableName}'");
|
||||
if (empty($check)) {
|
||||
$sql = $this->getCreateSql();
|
||||
Db::execute($sql);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getAllTableList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据后缀获取创建表的sql
|
||||
* @return string
|
||||
*/
|
||||
protected function getCreateSql()
|
||||
{
|
||||
return <<<EOT
|
||||
CREATE TABLE `{$this->tableName}` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`admin_id` int(10) unsigned DEFAULT '0' COMMENT '管理员ID',
|
||||
`url` varchar(1500) NOT NULL DEFAULT '' COMMENT '操作页面',
|
||||
`method` varchar(50) NOT NULL COMMENT '请求方法',
|
||||
`title` varchar(100) DEFAULT '' COMMENT '日志标题',
|
||||
`content` text NOT NULL COMMENT '内容',
|
||||
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'IP',
|
||||
`useragent` varchar(255) DEFAULT '' COMMENT 'User-Agent',
|
||||
`create_time` int(10) DEFAULT NULL COMMENT '操作时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=630 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='后台操作日志表 - {$this->tableSuffix}';
|
||||
EOT;
|
||||
}
|
||||
|
||||
}
|
||||
61
app/admin/service/TriggerService.php
Normal file
61
app/admin/service/TriggerService.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
|
||||
use think\facade\Cache;
|
||||
|
||||
class TriggerService
|
||||
{
|
||||
|
||||
/**
|
||||
* 更新菜单缓存
|
||||
* @param null $adminId
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateMenu($adminId = null)
|
||||
{
|
||||
if(empty($adminId)){
|
||||
Cache::tag('initAdmin')->clear();
|
||||
}else{
|
||||
Cache::delete('initAdmin_' . $adminId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新节点缓存
|
||||
* @param null $adminId
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateNode($adminId = null)
|
||||
{
|
||||
if(empty($adminId)){
|
||||
Cache::tag('authNode')->clear();
|
||||
}else{
|
||||
Cache::delete('allAuthNode_' . $adminId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统设置缓存
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateSysconfig()
|
||||
{
|
||||
Cache::tag('sysconfig')->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
172
app/admin/traits/Curd.php
Normal file
172
app/admin/traits/Curd.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | PHP交流群: 763822524
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 https://mit-license.org
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zhongshaofa/EasyAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\traits;
|
||||
|
||||
use EasyAdmin\annotation\NodeAnotation;
|
||||
use EasyAdmin\tool\CommonTool;
|
||||
use jianyan\excel\Excel;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 后台CURD复用
|
||||
* Trait Curd
|
||||
* @package app\admin\traits
|
||||
*/
|
||||
trait Curd
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="列表")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('selectFields')) {
|
||||
return $this->selectList();
|
||||
}
|
||||
list($page, $limit, $where) = $this->buildTableParames();
|
||||
$count = $this->model
|
||||
->where($where)
|
||||
->count();
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->page($page, $limit)
|
||||
->order($this->sort)
|
||||
->select();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $count,
|
||||
'data' => $list,
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="添加")
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $this->model->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败:'.$e->getMessage());
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="编辑")
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$row = $this->model->find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
try {
|
||||
$save = $row->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
$this->assign('row', $row);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="删除")
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$row = $this->model->whereIn('id', $id)->select();
|
||||
$row->isEmpty() && $this->error('数据不存在');
|
||||
try {
|
||||
$save = $row->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('删除失败');
|
||||
}
|
||||
$save ? $this->success('删除成功') : $this->error('删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="导出")
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
list($page, $limit, $where) = $this->buildTableParames();
|
||||
$tableName = $this->model->getName();
|
||||
$tableName = CommonTool::humpToLine(lcfirst($tableName));
|
||||
$prefix = config('database.connections.mysql.prefix');
|
||||
$dbList = Db::query("show full columns from {$prefix}{$tableName}");
|
||||
$header = [];
|
||||
foreach ($dbList as $vo) {
|
||||
$comment = !empty($vo['Comment']) ? $vo['Comment'] : $vo['Field'];
|
||||
if (!in_array($vo['Field'], $this->noExportFields)) {
|
||||
$header[] = [$comment, $vo['Field']];
|
||||
}
|
||||
}
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->limit(100000)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
$fileName = time();
|
||||
return Excel::exportData($list, $header, $fileName, 'xlsx');
|
||||
}
|
||||
|
||||
/**
|
||||
* @NodeAnotation(title="属性修改")
|
||||
*/
|
||||
public function modify()
|
||||
{
|
||||
$this->checkPostRequest();
|
||||
$post = $this->request->post();
|
||||
$rule = [
|
||||
'id|ID' => 'require',
|
||||
'field|字段' => 'require',
|
||||
'value|值' => 'require',
|
||||
];
|
||||
$this->validate($post, $rule);
|
||||
$row = $this->model->find($post['id']);
|
||||
if (!$row) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
if (!in_array($post['field'], $this->allowModifyFields)) {
|
||||
$this->error('该字段不允许修改:' . $post['field']);
|
||||
}
|
||||
try {
|
||||
$row->save([
|
||||
$post['field'] => $post['value'],
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
}
|
||||
49
app/admin/view/index/edit_admin.html
Normal file
49
app/admin/view/index/edit_admin.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">用户头像</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="head_img" class="layui-input layui-col-xs6" lay-reqtext="请上传用户头像" placeholder="请上传用户头像" value="{$row.head_img|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_head_img" data-upload-select="head_img" data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
|
||||
<tip>填写登录账户。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" class="layui-input" lay-reqtext="请输入用户手机" placeholder="请输入用户手机" value="{$row.username|default=''}">
|
||||
<tip>填写用户手机。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.username|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
38
app/admin/view/index/edit_password.html
Normal file
38
app/admin/view/index/edit_password.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">登录密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password" class="layui-input" lay-verify="required" lay-reqtext="请输入登录密码" placeholder="请输入登录密码" value="">
|
||||
<tip>填写登录密码。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password_again" class="layui-input" lay-verify="required" lay-reqtext="请输入确认密码" placeholder="请输入确认密码" value="">
|
||||
<tip>填写再次登录密码。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
110
app/admin/view/index/index.html
Normal file
110
app/admin/view/index/index.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/layuimini/layuimini.css?v={:time()}" media="all">
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/layuimini/themes/default.css?v={:time()}" media="all">
|
||||
<style id="layuimini-bg-color">
|
||||
</style>
|
||||
<body class="layui-layout-body layuimini-all">
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
|
||||
<div class="layui-header header">
|
||||
<div class="layui-logo layuimini-logo"></div>
|
||||
|
||||
<div class="layuimini-header-content">
|
||||
<a>
|
||||
<div class="layuimini-tool"><i title="展开" class="fa fa-outdent" data-side-fold="1"></i></div>
|
||||
</a>
|
||||
|
||||
<!--电脑端头部菜单-->
|
||||
<ul class="layui-nav layui-layout-left layuimini-header-menu layuimini-menu-header-pc layuimini-pc-show">
|
||||
</ul>
|
||||
|
||||
<!--手机端头部菜单-->
|
||||
<ul class="layui-nav layui-layout-left layuimini-header-menu layuimini-mobile-show">
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;"><i class="fa fa-list-ul"></i> 选择模块</a>
|
||||
<dl class="layui-nav-child layuimini-menu-header-mobile">
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
|
||||
<li class="layui-nav-item" lay-unselect>
|
||||
<a href="javascript:;" data-refresh="刷新"><i class="fa fa-refresh"></i></a>
|
||||
</li>
|
||||
<li class="layui-nav-item" lay-unselect>
|
||||
<a href="javascript:;" data-clear="清理" class="layuimini-clear"><i class="fa fa-trash-o"></i></a>
|
||||
</li>
|
||||
<li class="layui-nav-item mobile layui-hide-xs" lay-unselect>
|
||||
<a href="javascript:;" data-check-screen="full"><i class="fa fa-arrows-alt"></i></a>
|
||||
</li>
|
||||
<li class="layui-nav-item layuimini-setting">
|
||||
<a href="javascript:;">
|
||||
<img src="{:session('admin.head_img')}" class="layui-nav-img" width="50" height="50">
|
||||
<cite class="adminName">{:session('admin.username')}</cite>
|
||||
<span class="layui-nav-more"></span>
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd>
|
||||
<a href="javascript:;" layuimini-content-href="{:__url('index/editAdmin')}" data-title="基本资料" data-icon="fa fa-gears">基本资料<span class="layui-badge-dot"></span></a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:;" layuimini-content-href="{:__url('index/editPassword')}" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<hr>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:;" class="login-out">退出登录</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="layui-nav-item layuimini-select-bgcolor" lay-unselect>
|
||||
<a href="javascript:;" data-bgcolor="配色方案"><i class="fa fa-ellipsis-v"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--无限极左侧菜单-->
|
||||
<div class="layui-side layui-bg-black layuimini-menu-left">
|
||||
</div>
|
||||
|
||||
<!--初始化加载层-->
|
||||
<div class="layuimini-loader">
|
||||
<div class="layuimini-loader-inner"></div>
|
||||
</div>
|
||||
|
||||
<!--手机端遮罩层-->
|
||||
<div class="layuimini-make"></div>
|
||||
|
||||
<!-- 移动导航 -->
|
||||
<div class="layuimini-site-mobile"><i class="layui-icon"></i></div>
|
||||
|
||||
<div class="layui-body">
|
||||
<div class="layuimini-tab layui-tab-rollTool layui-tab" lay-filter="layuiminiTab" lay-allowclose="true">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" id="layuiminiHomeTabId" lay-id=""></li>
|
||||
</ul>
|
||||
<div class="layui-tab-control">
|
||||
<li class="layuimini-tab-roll-left layui-icon layui-icon-left"></li>
|
||||
<li class="layuimini-tab-roll-right layui-icon layui-icon-right"></li>
|
||||
<li class="layui-tab-tool layui-icon layui-icon-down">
|
||||
<ul class="layui-nav close-box">
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;"><span class="layui-nav-more"></span></a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="javascript:;" layuimini-tab-close="current">关 闭 当 前</a></dd>
|
||||
<dd><a href="javascript:;" layuimini-tab-close="other">关 闭 其 他</a></dd>
|
||||
<dd><a href="javascript:;" layuimini-tab-close="all">关 闭 全 部</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
<div class="layui-tab-content">
|
||||
<div id="layuiminiHomeTabIframe" class="layui-tab-item layui-show"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
258
app/admin/view/index/welcome.html
Normal file
258
app/admin/view/index/welcome.html
Normal file
@@ -0,0 +1,258 @@
|
||||
<link rel="stylesheet" href="__STATIC__/admin/css/welcome.css?v={:time()}" media="all">
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md8">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-warning icon"></i>数据统计</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="welcome-module">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-blue">实时</span>
|
||||
<h5>用户统计</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins">1234</h1>
|
||||
<small>当前分类总记录数</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-cyan">实时</span>
|
||||
<h5>商品统计</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins">1234</h1>
|
||||
<small>当前分类总记录数</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-orange">实时</span>
|
||||
<h5>浏览统计</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins">1234</h1>
|
||||
<small>当前分类总记录数</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6">
|
||||
<div class="panel layui-bg-number">
|
||||
<div class="panel-body">
|
||||
<div class="panel-title">
|
||||
<span class="label pull-right layui-bg-green">实时</span>
|
||||
<h5>订单统计</h5>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<h1 class="no-margins">1234</h1>
|
||||
<small>当前分类总记录数</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-credit-card icon icon-blue"></i>快捷入口</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="welcome-module">
|
||||
<div class="layui-row layui-col-space10 layuimini-qiuck">
|
||||
|
||||
{foreach $quicks as $vo}
|
||||
<div class="layui-col-xs3 layuimini-qiuck-module">
|
||||
<a layuimini-content-href="{:url($vo['href'])}" data-title="{$vo['title']}">
|
||||
<i class="{$vo['icon']|raw}"></i>
|
||||
<cite>{$vo['title']}</cite>
|
||||
</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-line-chart icon"></i>报表统计</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="echarts-records" style="width: 100%;min-height:500px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md4">
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-bullhorn icon icon-tip"></i>系统公告</div>
|
||||
<div class="layui-card-body layui-text">
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">修改选项卡样式</div>
|
||||
<div class="layuimini-notice-extra">2019-07-11 23:06</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">新增系统404模板</div>
|
||||
<div class="layuimini-notice-extra">2019-07-11 12:57</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">新增treetable插件和菜单管理样式</div>
|
||||
<div class="layuimini-notice-extra">2019-07-05 14:28</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">修改logo缩放问题</div>
|
||||
<div class="layuimini-notice-extra">2019-07-04 11:02</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">修复左侧菜单缩放tab无法移动</div>
|
||||
<div class="layuimini-notice-extra">2019-06-17 11:55</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-notice">
|
||||
<div class="layuimini-notice-title">修复多模块菜单栏展开有问题</div>
|
||||
<div class="layuimini-notice-extra">2019-06-13 14:53</div>
|
||||
<div class="layuimini-notice-content layui-hide">
|
||||
界面足够简洁清爽。<br>
|
||||
一个接口几行代码而已直接初始化整个框架,无需复杂操作。<br>
|
||||
支持多tab,可以打开多窗口。<br>
|
||||
支持无限级菜单和对font-awesome图标库的完美支持。<br>
|
||||
失效以及报错菜单无法直接打开,并给出弹出层提示完美的线上用户体验。<br>
|
||||
url地址hash定位,可以清楚看到当前tab的地址信息。<br>
|
||||
刷新页面会保留当前的窗口,并且会定位当前窗口对应左侧菜单栏。<br>
|
||||
移动端的友好支持。<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-fire icon"></i>版本信息</div>
|
||||
<div class="layui-card-body layui-text">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>框架名称</td>
|
||||
<td>
|
||||
EasyAdmin
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>当前版本</td>
|
||||
<td>v2.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>主要特色</td>
|
||||
<td>零门槛 / 响应式 / 清爽 / 极简</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gitee</td>
|
||||
<td style="padding-bottom: 0;">
|
||||
<div class="layui-btn-container">
|
||||
<a href="https://gitee.com/zhongshaofa/easyadmin" style="margin-right: 15px"><img src="https://gitee.com/zhongshaofa/easyadmin/badge/star.svg?theme=dark" alt="star"></a>
|
||||
<a href="https://gitee.com/zhongshaofa/easyadmin"><img src="https://gitee.com/zhongshaofa/easyadmin/badge/fork.svg?theme=dark" alt="fork"></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Github</td>
|
||||
<td style="padding-bottom: 0;">
|
||||
<div class="layui-btn-container">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=zhongshaofa&repo=easyadmin&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=zhongshaofa&repo=easyadmin&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"><i class="fa fa-paper-plane-o icon"></i>作者心语</div>
|
||||
<div class="layui-card-body layui-text layadmin-text">
|
||||
<p>本模板基于layui2.5.4以及font-awesome-4.7.0进行实现。layui开发文档地址:<a class="layui-btn layui-btn-xs layui-btn-danger" target="_blank" href="http://www.layui.com/doc">layui文档</a></p>
|
||||
<p>技术交流QQ群:<a target="_blank" href="https://jq.qq.com/?_wv=1027&k=5JRGVfe"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="layuimini" title="layuimini"></a>(加群请备注来源:如gitee、github、官网等)</p>
|
||||
<p>喜欢此后台模板的可以给我的GitHub和Gitee加个Star支持一下</p>
|
||||
<p class="layui-red">备注:此后台框架永久开源,但请勿进行出售或者上传到任何素材网站,否则将追究相应的责任。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
32
app/admin/view/layout/default.html
Normal file
32
app/admin/view/layout/default.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{:sysconfig('site','site_name')}</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="__STATIC__/admin/css/public.css?v={$version}" media="all">
|
||||
<script>
|
||||
window.CONFIG = {
|
||||
ADMIN: "{$adminModuleName|default='admin'}",
|
||||
CONTROLLER_JS_PATH: "{$thisControllerJsPath|default=''}",
|
||||
ACTION: "{$thisAction|default=''}",
|
||||
AUTOLOAD_JS: "{$autoloadJs|default='false'}",
|
||||
IS_SUPER_ADMIN: "{$isSuperAdmin|default='false'}",
|
||||
VERSION: "{$version|default='1.0.0'}",
|
||||
CSRF_TOKEN: "{:token()}",
|
||||
};
|
||||
</script>
|
||||
<script src="__STATIC__/plugs/layui-v2.5.6/layui.all.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/plugs/require-2.3.6/require.js?v={$version}" charset="utf-8"></script>
|
||||
<script src="__STATIC__/config-admin.js?v={$version}" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
{__CONTENT__}
|
||||
</body>
|
||||
</html>
|
||||
45
app/admin/view/login/index.html
Normal file
45
app/admin/view/login/index.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<link rel="stylesheet" href="__STATIC__/admin/css/login.css?v={$version}" media="all">
|
||||
<div class="main-body">
|
||||
<div class="login-main">
|
||||
<div class="login-top">
|
||||
<span>{:sysconfig('site','site_name')}</span>
|
||||
<span class="bg1"></span>
|
||||
<span class="bg2"></span>
|
||||
</div>
|
||||
<form class="layui-form login-bottom">
|
||||
<div class="demo{if !$demo} layui-hide{/if}">用户名:admin 密码:123456</div>
|
||||
<div class="center">
|
||||
|
||||
<div class="item">
|
||||
<span class="icon icon-2"></span>
|
||||
<input type="text" name="username" lay-verify="required" placeholder="请输入登录账号" maxlength="24"/>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="icon icon-3"></span>
|
||||
<input type="password" name="password" lay-verify="required" placeholder="请输入密码" maxlength="20">
|
||||
<span class="bind-password icon icon-4"></span>
|
||||
</div>
|
||||
|
||||
{if $captcha == 1}
|
||||
<div id="validatePanel" class="item" style="width: 137px;">
|
||||
<input type="text" name="captcha" placeholder="请输入验证码" maxlength="4">
|
||||
<img id="refreshCaptcha" class="validateImg" src="{:url('login/captcha')}" onclick="this.src='{:url(\'login/captcha\')}?seed='+Math.random()">
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<div class="tip">
|
||||
<span class="icon-nocheck"></span>
|
||||
<span class="login-tip">保持登录</span>
|
||||
<a href="javascript:" class="forget-password">忘记密码?</a>
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
|
||||
<button class="login-btn" lay-submit>立即登录</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
{:sysconfig('site','site_copyright')}<span class="padding-5">|</span><a target="_blank" href="http://www.miitbeian.gov.cn">{:sysconfig('site','site_beian')}</a>
|
||||
</div>
|
||||
43
app/admin/view/mall/cate/add.html
Normal file
43
app/admin/view/mall/cate/add.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入分类名称" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">分类图片</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="image" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传分类图片" value="">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="image" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_image" data-upload-select="image" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" class="layui-input" placeholder="请输入分类排序" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
43
app/admin/view/mall/cate/edit.html
Normal file
43
app/admin/view/mall/cate/edit.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入分类名称" value="{$row.title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">分类图片</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="image" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传分类图片" placeholder="请上传分类图片" value="{$row.image|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="image" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_head_img" data-upload-select="head_img" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" class="layui-input" placeholder="请输入分类排序" value="{$row.sort|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.remark|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
10
app/admin/view/mall/cate/index.html
Normal file
10
app/admin/view/mall/cate/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('mall.cate/add')}"
|
||||
data-auth-edit="{:auth('mall.cate/edit')}"
|
||||
data-auth-delete="{:auth('mall.cate/delete')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
89
app/admin/view/mall/goods/add.html
Normal file
89
app/admin/view/mall/goods/add.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="cate_id" lay-verify="required" data-select="{:url('mall.cate/index')}" data-fields="id,title">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入商品标题" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">商品LOGO</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="logo" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传分类图片" value="">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="logo" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_logo" data-upload-select="logo" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">商品图片</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="images" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传商品图片" value="">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="images" data-upload-number="more" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_images" data-upload-select="images" data-upload-number="more" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">市场价格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="market_price" class="layui-input" lay-verify="required" placeholder="请输入市场价格" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">折扣价格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="discount_price" class="layui-input" lay-verify="required" placeholder="请输入折扣价格" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">虚拟销量</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="virtual_sales" class="layui-input" lay-verify="required" placeholder="请输入虚拟销量" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品描述</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="describe" rows="20" class="layui-textarea editor" placeholder="请输入商品描述"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" class="layui-input" placeholder="请输入分类排序" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
90
app/admin/view/mall/goods/edit.html
Normal file
90
app/admin/view/mall/goods/edit.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="cate_id" lay-verify="required" data-select="{:url('mall.cate/index')}" data-fields="id,title" data-value="{$row.cate_id|default=''}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入商品标题" value="{$row.title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">商品LOGO</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="logo" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传分类图片" value="{$row.logo|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="logo" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_logo" data-upload-select="logo" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">商品图片</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="images" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传商品图片" value="{$row.images|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="images" data-upload-number="more" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_images" data-upload-select="images" data-upload-number="more" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">市场价格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="market_price" class="layui-input" lay-verify="required" placeholder="请输入市场价格" value="{$row.market_price|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">折扣价格</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="discount_price" class="layui-input" lay-verify="required" placeholder="请输入折扣价格" value="{$row.discount_price|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">虚拟销量</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="virtual_sales" class="layui-input" lay-verify="required" placeholder="请输入虚拟销量" value="{$row.virtual_sales|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品描述</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="describe" rows="20" class="layui-textarea editor" placeholder="请输入商品描述">{$row.describe|raw|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" class="layui-input" placeholder="请输入分类排序" value="{$row.sort|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.remark|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
11
app/admin/view/mall/goods/index.html
Normal file
11
app/admin/view/mall/goods/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('mall.goods/add')}"
|
||||
data-auth-edit="{:auth('mall.goods/edit')}"
|
||||
data-auth-delete="{:auth('mall.goods/delete')}"
|
||||
data-auth-stock="{:auth('mall.goods/stock')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
39
app/admin/view/mall/goods/stock.html
Normal file
39
app/admin/view/mall/goods/stock.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="layui-input" disabled value="{$row.title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">库存统计</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="layui-input" disabled value="{$row.total_stock|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">剩余库存</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="layui-input" disabled value="{$row.stock|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">入库数量</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="stock" class="layui-input" lay-verify="required" placeholder="请输入入库数量" value="0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
54
app/admin/view/system/admin/add.html
Normal file
54
app/admin/view/system/admin/add.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">用户头像</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="head_img" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传用户头像" placeholder="请上传用户头像" value="">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_head_img" data-upload-select="head_img" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" lay-verify="required" lay-reqtext="请输入登录账户" placeholder="请输入登录账户" value="">
|
||||
<tip>填写登录账户。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" class="layui-input" lay-reqtext="请输入用户手机" placeholder="请输入用户手机" value="">
|
||||
<tip>填写用户手机。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色权限</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach auth_list as $key=>$val}
|
||||
<input type="checkbox" name="auth_ids[{$key}]" lay-skin="primary" title="{$val}">
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
54
app/admin/view/system/admin/edit.html
Normal file
54
app/admin/view/system/admin/edit.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">用户头像</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="head_img" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传用户头像" placeholder="请上传用户头像" value="{$row.head_img|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_head_img" data-upload-select="head_img" data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
|
||||
<tip>填写登录账户。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" class="layui-input" lay-reqtext="请输入用户手机" placeholder="请输入用户手机" value="{$row.username|default=''}">
|
||||
<tip>填写用户手机。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色权限</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach auth_list as $key=>$val}
|
||||
<input type="checkbox" name="auth_ids[{$key}]" lay-skin="primary" title="{$val}" {if in_array($key,$row.auth_ids)}checked="" {/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.username|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
11
app/admin/view/system/admin/index.html
Normal file
11
app/admin/view/system/admin/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.admin/add')}"
|
||||
data-auth-edit="{:auth('system.admin/edit')}"
|
||||
data-auth-delete="{:auth('system.admin/delete')}"
|
||||
data-auth-password="{:auth('system.admin/password')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
34
app/admin/view/system/admin/password.html
Normal file
34
app/admin/view/system/admin/password.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">登录密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password" class="layui-input" lay-verify="required" lay-reqtext="请输入登录密码" placeholder="请输入登录密码" value="">
|
||||
<tip>填写登录密码。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password_again" class="layui-input" lay-verify="required" lay-reqtext="请输入确认密码" placeholder="请输入确认密码" value="">
|
||||
<tip>填写再次登录密码。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
26
app/admin/view/system/auth/add.html
Normal file
26
app/admin/view/system/auth/add.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">权限名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" placeholder="请输入权限名称" value="">
|
||||
<tip>填写权限名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
27
app/admin/view/system/auth/authorize.html
Normal file
27
app/admin/view/system/auth/authorize.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">权限名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" readonly class="layui-input" value="{$row.title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">分配节点</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="node_ids" class="demo-tree-more"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" readonly class="layui-input" value="{$row.id}">
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="system.auth/saveAuthorize">确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
26
app/admin/view/system/auth/edit.html
Normal file
26
app/admin/view/system/auth/edit.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">权限名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" lay-reqtext="请输入权限名称" placeholder="请输入权限名称" value="{$row.title|default=''}">
|
||||
<tip>填写权限名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.remark|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
11
app/admin/view/system/auth/index.html
Normal file
11
app/admin/view/system/auth/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.auth/add')}"
|
||||
data-auth-edit="{:auth('system.auth/edit')}"
|
||||
data-auth-delete="{:auth('system.auth/delete')}"
|
||||
data-auth-authorize="{:auth('system.auth/authorize')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
24
app/admin/view/system/config/index.html
Normal file
24
app/admin/view/system/config/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main" id="app">
|
||||
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">网站设置</li>
|
||||
<li>LOGO配置</li>
|
||||
<li>上传配置</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
{include file="system/config/site" /}
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
{include file="system/config/logo" /}
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
{include file="system/config/upload" /}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
28
app/admin/view/system/config/logo.html
Normal file
28
app/admin/view/system/config/logo.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">LOGO标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="logo_title" class="layui-input" lay-verify="required" placeholder="请输入LOGO标题" value="{:sysconfig('site','logo_title')}">
|
||||
<tip>填写站点名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">LOGO图标</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="logo_image" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传LOGO图标" value="{:sysconfig('site','logo_image')}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="logo_image" data-upload-number="one" data-upload-exts="ico|png|jpg|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_logo_image" data-upload-select="logo_image" data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="system.config/save" data-refresh="false">确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
52
app/admin/view/system/config/site.html
Normal file
52
app/admin/view/system/config/site.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">站点名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="site_name" class="layui-input" lay-verify="required" placeholder="请输入站点名称" value="{:sysconfig('site','site_name')}">
|
||||
<tip>填写站点名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">浏览器图标</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="site_ico" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传浏览器图标,ico类型" value="{:sysconfig('site','site_ico')}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="site_ico" data-upload-number="one" data-upload-exts="ico"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_site_ico" data-upload-select="site_ico" data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">版本信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="site_version" class="layui-input" lay-verify="required" placeholder="请输入版本信息" value="{:sysconfig('site','site_version')}">
|
||||
<tip>填写版本信息。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备案信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="site_beian" class="layui-input" lay-verify="required" placeholder="请输入备案信息" value="{:sysconfig('site','site_beian')}">
|
||||
<tip>填写备案信息。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">版权信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="site_copyright" class="layui-input" lay-verify="required" placeholder="请输入版权信息" value="{:sysconfig('site','site_copyright')}">
|
||||
<tip>填写版权信息。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="system.config/save" data-refresh="false">确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
141
app/admin/view/system/config/upload.html
Normal file
141
app/admin/view/system/config/upload.html
Normal file
@@ -0,0 +1,141 @@
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">存储方式</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach ['local'=>'本地存储','alioss'=>'阿里云oss','qnoss'=>'七牛云oss','txcos'=>'腾讯云cos'] as $key=>$val}
|
||||
<input type="radio" v-model="upload_type" name="upload_type" lay-filter="upload_type" value="{$key}" title="{$val}" {if $key==sysconfig('upload','upload_type')}checked=""{/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">允许类型</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="upload_allow_ext" class="layui-input" lay-verify="required" lay-reqtext="请输入允许类型" placeholder="请输入允许类型" value="{:sysconfig('upload','upload_allow_ext')}">
|
||||
<tip>英文逗号做分隔符。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">允许大小</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="upload_allow_size" class="layui-input" lay-verify="required" lay-reqtext="请输入允许上传大小" placeholder="请输入允许上传大小" value="{:sysconfig('upload','upload_allow_size')}">
|
||||
<tip>设置允许上传大小。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
|
||||
<label class="layui-form-label required">公钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="alioss_access_key_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','alioss_access_key_id')}">
|
||||
<tip>例子:FSGGshu64642THSk</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
|
||||
<label class="layui-form-label required">私钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="alioss_access_key_secret" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{:sysconfig('upload','alioss_access_key_secret')}">
|
||||
<tip>例子:5fsfPReYKkFSGGshu64642THSkmTInaIm</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
|
||||
<label class="layui-form-label required">数据中心</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="alioss_endpoint" class="layui-input" lay-verify="required" lay-reqtext="请输入数据中心" placeholder="请输入数据中心" value="{:sysconfig('upload','alioss_endpoint')}">
|
||||
<tip>例子:https://oss-cn-shenzhen.aliyuncs.com</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
|
||||
<label class="layui-form-label required">空间名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="alioss_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入空间名称" placeholder="请输入空间名称" value="{:sysconfig('upload','alioss_bucket')}">
|
||||
<tip>例子:easy-admin</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
|
||||
<label class="layui-form-label required">访问域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="alioss_domain" class="layui-input" lay-verify="required" lay-reqtext="请输入访问域名" placeholder="请输入访问域名" value="{:sysconfig('upload','alioss_domain')}">
|
||||
<tip>例子:easy-admin.oss-cn-shenzhen.aliyuncs.com</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
|
||||
<label class="layui-form-label required">公钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="txcos_secret_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','txcos_secret_id')}">
|
||||
<tip>例子:AKIDta6OQCbALQGrCI6ngKwQffR3dfsfrwrfs</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
|
||||
<label class="layui-form-label required">私钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="txcos_secret_key" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{:sysconfig('upload','txcos_secret_key')}">
|
||||
<tip>例子:VllEWYKtClAbpqfFdTqysXxGQM6dsfs</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
|
||||
<label class="layui-form-label required">存储桶地域</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="txcos_region" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶地域" placeholder="请输入存储桶地域" value="{:sysconfig('upload','txcos_region')}">
|
||||
<tip>例子:ap-guangzhou</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
|
||||
<label class="layui-form-label required">存储桶名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="tecos_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶名称" placeholder="请输入存储桶名称" value="{:sysconfig('upload','tecos_bucket')}">
|
||||
<tip>例子:easyadmin-1251997243</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'qnoss'" v-cloak>
|
||||
<label class="layui-form-label required">公钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qnoss_access_key" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','qnoss_access_key')}">
|
||||
<tip>例子:v-lV3tXev7yyfsfa1jRc6_8rFOhFYGQvvjsAQxdrB</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'qnoss'" v-cloak>
|
||||
<label class="layui-form-label required">私钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qnoss_secret_key" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{:sysconfig('upload','qnoss_secret_key')}">
|
||||
<tip>例子:XOhYRR9JNqxsWVEO-mHWB4193vfsfsQADuORaXzr</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'qnoss'" v-cloak>
|
||||
<label class="layui-form-label required">存储空间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qnoss_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶地域" placeholder="请输入存储桶地域" value="{:sysconfig('upload','qnoss_bucket')}">
|
||||
<tip>例子:easyadmin</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" v-if="upload_type == 'qnoss'" v-cloak>
|
||||
<label class="layui-form-label required">访问域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qnoss_domain" class="layui-input" lay-verify="required" lay-reqtext="请输入访问域名" placeholder="请输入访问域名" value="{:sysconfig('upload','qnoss_domain')}">
|
||||
<tip>例子:http://q0xqzappp.bkt.clouddn.com</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="system.config/save" data-refresh="false">确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script>
|
||||
var upload_type = "{:sysconfig('upload','upload_type')}";
|
||||
</script>
|
||||
7
app/admin/view/system/log/index.html
Normal file
7
app/admin/view/system/log/index.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
75
app/admin/view/system/menu/add.html
Normal file
75
app/admin/view/system/menu/add.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<style>
|
||||
.layui-iconpicker-body.layui-iconpicker-body-page .hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/autocomplete/autocomplete.css?v={$version}" media="all">
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item layui-row layui-col-xs12">
|
||||
<label class="layui-form-label required">上级菜单</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="pid">
|
||||
{foreach $pidMenuList as $vo}
|
||||
<option value="{$vo.id}" {if $id==$vo.id}selected=""{/if}>{$vo.title|raw}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">菜单名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" lay-reqtext="请输入菜单名称" placeholder="请输入菜单名称" value="">
|
||||
<tip>填写菜单名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单链接</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="href" name="href" class="layui-input" lay-reqtext="请输入菜单链接" placeholder="请输入菜单链接" value="">
|
||||
<tip>填写菜单链接。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">选择图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="icon" name="icon" lay-filter="icon" class="hide" value="fa fa-list">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">target属性</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach ['_self','_blank','_parent','_top'] as $vo}
|
||||
<input type="radio" name="target" value="{$vo}" title="{$vo}" {if $vo=='_self'}checked=""{/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" lay-reqtext="菜单排序不能为空" placeholder="请输入菜单排序" value="0" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
75
app/admin/view/system/menu/edit.html
Normal file
75
app/admin/view/system/menu/edit.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<style>
|
||||
.layui-iconpicker-body.layui-iconpicker-body-page .hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/autocomplete/autocomplete.css?v={:time()}" media="all">
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item layui-row layui-col-xs12">
|
||||
<label class="layui-form-label required">上级菜单</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="pid">
|
||||
{foreach $pidMenuList as $vo}
|
||||
<option value="{$vo.id}" {if $row.pid==$vo.id}selected=""{/if}>{$vo.title|raw}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">菜单名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" lay-reqtext="请输入菜单名称" placeholder="请输入菜单名称" value="{$row.title|default=''}">
|
||||
<tip>填写菜单名称。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单链接</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="href" id="href" class="layui-input" lay-reqtext="请输入菜单链接" placeholder="请输入菜单链接" value="{$row.href|default=''}">
|
||||
<tip>填写菜单链接。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">选择图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="icon" name="icon" lay-filter="icon" class="hide" value="{$row.icon|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">target属性</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach ['_self','_blank','_parent','_top'] as $vo}
|
||||
<input type="radio" name="target" value="{$vo}" title="{$vo}" {if $row.target==$vo}checked=""{/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" lay-reqtext="菜单排序不能为空" placeholder="请输入菜单排序" value="{$row.sort|default=''}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.remark|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
23
app/admin/view/system/menu/index.html
Normal file
23
app/admin/view/system/menu/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/treetable-lay/treetable.css?v={:time()}" media="all">
|
||||
<style>
|
||||
.layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
</style>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.menu/add')}"
|
||||
data-auth-edit="{:auth('system.menu/edit')}"
|
||||
data-auth-delete="{:auth('system.menu/delete')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="layui-btn layui-btn-sm layuimini-btn-primary" data-treetable-refresh><i class="fa fa-refresh"></i> </button>
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm {if !auth('system.menu/add')}layui-hide{/if}" data-open="system.menu/add" data-title="添加" data-full="true"><i class="fa fa-plus"></i> 添加</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger {if !auth('system.menu/del')}layui-hide{/if}" data-url="system.menu/del" data-treetable-delete="currentTableRenderId"><i class="fa fa-trash-o"></i> 删除</button>
|
||||
</script>
|
||||
9
app/admin/view/system/node/index.html
Normal file
9
app/admin/view/system/node/index.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-refresh="{:auth('system.node/refreshNode')}"
|
||||
data-auth-clear="{:auth('system.node/clearNode')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
52
app/admin/view/system/quick/add.html
Normal file
52
app/admin/view/system/quick/add.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<style>
|
||||
.layui-iconpicker-body.layui-iconpicker-body-page .hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/autocomplete/autocomplete.css?v={$version}" media="all">
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">快捷名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" lay-reqtext="请输入快捷名称" placeholder="请输入快捷名称" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">快捷链接</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="href" name="href" class="layui-input" lay-verify="required" placeholder="请输入快捷链接" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">选择图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="icon" name="icon" lay-filter="icon" class="hide" value="fa fa-list">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" lay-reqtext="菜单排序不能为空" placeholder="请输入菜单排序" value="0" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
52
app/admin/view/system/quick/edit.html
Normal file
52
app/admin/view/system/quick/edit.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<style>
|
||||
.layui-iconpicker-body.layui-iconpicker-body-page .hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="__STATIC__/plugs/lay-module/autocomplete/autocomplete.css?v={$version}" media="all">
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">快捷名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" class="layui-input" lay-verify="required" lay-reqtext="请输入快捷名称" placeholder="请输入快捷名称" value="{$row.title|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">快捷链接</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="href" name="href" class="layui-input" lay-verify="required" placeholder="请输入快捷链接" value="{$row.href|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">选择图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="icon" name="icon" lay-filter="icon" class="hide" value="{$row.icon|default=''}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" lay-reqtext="菜单排序不能为空" placeholder="请输入菜单排序" value="{$row.sort|default=''}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.remark|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
10
app/admin/view/system/quick/index.html
Normal file
10
app/admin/view/system/quick/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.quick/add')}"
|
||||
data-auth-edit="{:auth('system.quick/edit')}"
|
||||
data-auth-delete="{:auth('system.quick/delete')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
16
app/admin/view/system/uploadfile/add.html
Normal file
16
app/admin/view/system/uploadfile/add.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">文件信息</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="head_img" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传文件" placeholder="请上传文件" value="">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传文件</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal"><i class="fa fa-list"></i> 选择文件</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
54
app/admin/view/system/uploadfile/edit.html
Normal file
54
app/admin/view/system/uploadfile/edit.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<div class="layuimini-container">
|
||||
<form id="app-form" class="layui-form layuimini-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">用户头像</label>
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="head_img" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传用户头像" placeholder="请上传用户头像" value="{$row.head_img|default=''}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传文件</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal"><i class="fa fa-list"></i> 选择文件</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">登录账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
|
||||
<tip>填写登录账户。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" class="layui-input" lay-reqtext="请输入用户手机" placeholder="请输入用户手机" value="{$row.username|default=''}">
|
||||
<tip>填写用户手机。</tip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色权限</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach auth_list as $key=>$val}
|
||||
<input type="checkbox" name="auth_ids[{$key}]" lay-skin="primary" title="{$val}" {if in_array($key,$row.auth_ids)}checked="" {/if}>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.username|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line"></div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
10
app/admin/view/system/uploadfile/index.html
Normal file
10
app/admin/view/system/uploadfile/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<table id="currentTable" class="layui-table layui-hide"
|
||||
data-auth-add="{:auth('system.menu/add')}"
|
||||
data-auth-edit="{:auth('system.menu/edit')}"
|
||||
data-auth-delete="{:auth('system.menu/delete')}"
|
||||
lay-filter="currentTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\captcha\facade\Captcha as ThinkCaptcha;
|
||||
use think\Request;
|
||||
|
||||
class Captcha
|
||||
{
|
||||
public function build()
|
||||
{
|
||||
return ThinkCaptcha::create();
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Request;
|
||||
use think\facade\Filesystem;
|
||||
use think\facade\Config;
|
||||
use app\BaseController;
|
||||
use app\UploadFiles as AppUploadFiles;
|
||||
|
||||
class Files extends BaseController
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
return AppUploadFiles::save($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user