This commit is contained in:
2025-06-20 17:15:33 +08:00
commit c57ae846e3
17 changed files with 821 additions and 0 deletions

23
.env.example Normal file
View File

@ -0,0 +1,23 @@
# 数据配置
DB_TYPE=sqlite
DB_MYSQL_HOST=thinkadmin.top
DB_MYSQL_PORT=3306
DB_MYSQL_PREFIX=
DB_MYSQL_USERNAME=root
DB_MYSQL_DATABASE=admin
DB_MYSQL_CHARSET=utf8mb4
DB_MYSQL_PASSWORD=
# 缓存配置
CACHE_TYPE=file
CACHE_REDIS_HOST=127.0.0.1
CACHE_REDIS_PORT=6379
CACHE_REDIS_SELECT=
CACHE_REDIS_PASSWORD=
# 会话配置
SESSION_TYPE=file
SESSION_NAME=ssid
SESSION_STORE=
SESSION_EXPIRE=7200
SESSION_PREFIX=

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
*.js linguist-language=php
*.css linguist-language=php
*.html linguist-language=php

50
.gitignore vendored Normal file
View File

@ -0,0 +1,50 @@
.env
.git
.svn
.idea
.fleet
.vscode
.DS_Store
/vendor
/runtime
/safefile
/nbproject
/composer.lock
!composer.json
### 屏蔽环境文件
/404.html
/.user.ini
/index.html
/public/upload
/public/404.html
/public/.htaccess
/public/.user.ini
/public/index.html
/public/favicon.ico
/database/sqlite.db
### 屏蔽插件文件
/app/admin
/app/wechat
### 屏蔽配置文件
/config/app.php
/config/cookie.php
/config/lang.php
/config/log.php
/config/route.php
/config/session.php
/config/view.php
/public/static/plugs
/public/static/theme
/public/static/admin.js
/public/static/login.js
### 屏蔽数据库脚本
/database/migrations/*_install_*.php
/database/migrations/*_upgrade_*.php
!database/migrations/*_install_table.php
!database/migrations/*_install_package.php

View File

@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
namespace app\index\controller;
use think\admin\Controller;
class Index extends Controller
{
public function index()
{
$this->redirect(sysuri('admin/login/index'));
}
}

27
composer.json Normal file
View File

@ -0,0 +1,27 @@
{
"type": "project",
"name": "zoujingli/thinkadmin",
"license": "MIT",
"homepage": "https://thinkadmin.top",
"description": "Application Development Framework",
"keywords": [
"ThinkAdmin",
"ThinkLibrary",
"WeChatDeveloper"
],
"authors": [
{
"name": "Anyon",
"email": "zoujingli@qq.com"
}
],
"config": {
"allow-plugins": {
"zoujingli/think-install": true
}
},
"require": {
"php": ">=8.3",
"zoujingli/think-plugs-admin": "^1.0"
}
}

59
config/cache.php Normal file
View File

@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
return [
// 默认缓存驱动
'default' => env('CACHE_TYPE', 'file'),
// 缓存连接配置
'stores' => [
'file' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存名称前缀
'prefix' => '',
// 缓存有效期 0 表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制
'serialize' => [],
],
'safe' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => syspath('safefile/cache/'),
// 缓存名称前缀
'prefix' => '',
// 缓存有效期 0 表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制
'serialize' => [],
],
'redis' => [
// 驱动方式
'type' => 'redis',
'host' => env('CACHE_REDIS_HOST', '127.0.0.1'),
'port' => env('CACHE_REDIS_PORT', 6379),
'select' => env('CACHE_REDIS_SELECT', 0),
'password' => env('CACHE_REDIS_PASSWORD', ''),
]
],
];

83
config/database.php Normal file
View File

@ -0,0 +1,83 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
return [
// 默认使用的数据库连接配置
'default' => env('DB_TYPE', 'sqlite'),
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => env('DB_MYSQL_HOST', '127.0.0.1'),
// 服务器端口
'hostport' => env('DB_MYSQL_PORT', '3306'),
// 数据库名
'database' => env('DB_MYSQL_DATABASE', 'thinkadmin'),
// 用户名
'username' => env('DB_MYSQL_USERNAME', 'root'),
// 密码
'password' => env('DB_MYSQL_PASSWORD', ''),
// 数据库连接参数
'params' => [],
// 数据库表前缀
'prefix' => env('DB_MYSQL_PREFIX', ''),
// 数据库编码默认采用 utf8mb4
'charset' => env('DB_MYSQL_CHARSET', 'utf8mb4'),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL执行日志
'trigger_sql' => true,
// 开启字段类型缓存
'fields_cache' => isOnline(),
],
'sqlite' => [
// 数据库类型
'type' => 'sqlite',
// 数据库文件
'database' => syspath('database/sqlite.db'),
// 数据库编码默认采用 utf8
'charset' => 'utf8',
// 监听执行日志
'trigger_sql' => true,
// 其他参数字段
'deploy' => 0,
'suffix' => '',
'prefix' => '',
'hostname' => '',
'hostport' => '',
'username' => '',
'password' => '',
],
],
];

24
config/phinx.php Normal file
View File

@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
return [
// 忽略数据表,填写表名
'ignore' => [],
// 创建数据表,填写表名
'tables' => [],
// 备份数据表,填写表名
'backup' => [],
];

21
license Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2014-2023 Anyon <zoujingli@qq.com>
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.

135
plugin.md Normal file
View File

@ -0,0 +1,135 @@
# 插件生态
》》》 更多插件正在开发,敬请期待…… 《《《
目前插件更新比较频繁,如果有发现 **bug**,请尝试升级最新版本。
如果问题依旧,请到 [Gitee](https://gitee.com/zoujingli/ThinkAdmin/issues) 提交问题,提交的内容中需要标注插件名称及问题详情,最好附加环境版本信息。
使用现有插件前请务必认真阅读每个插件的介绍,如果需要开发自己的插件请查看 [插件开发](https://thinkadmin.top/system/plugin-register.html) 章节。
通常情况下,使用 **admin****wechat** 两个插件就可以完成系统定制开发,且这两个插件都是遵循 **MIT** 协议开源,不影响商业授权。
## 免费开源插件
> 后台基础 Admin 管理插件( 已稳定可用 )
>
> * 插件标识:`admin`
> * 插件包名:`zoujingli/think-plugs-admin`
> * 安装方式:`composer require zoujingli/think-plugs-admin`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-admin](https://gitee.com/zoujingli/think-plugs-admin)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-admin.html)
> * 开源协议:[MIT](https://mit-license.org) ( 免费开源,支持本地插件化定制 )
> 后台基础 WeChat 微信插件( 已稳定可用 )
> * 插件标识:`wechat`
> * 插件包名:`zoujingli/think-plugs-wechat`
> * 安装方式:`composer require zoujingli/think-plugs-wechat`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-wechat](https://gitee.com/zoujingli/think-plugs-wechat)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-wechat.html)
> * 开源协议:[MIT](https://mit-license.org) ( 免费开源,支持本地插件化定制 )
> 后台静态 Static 初始化插件 ( 通常不需要独立安装 )
> * 插件标识:`static`
> * 插件包名:`zoujingli/think-plugs-static`
> * 安装方式:`composer require zoujingli/think-plugs-static`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-static](https://gitee.com/zoujingli/think-plugs-static)
> * 开源协议:[MIT](https://mit-license.org) ( 免费开源,部分插件包含其他开源协议,具体可以查看源文件,不支持本地插件化定制 )
> 基础插件市场系统 ( 开发中,后期开放 ThinkAdmin 生态市场 )
> * 插件标识:`plugin-center`
> * 插件包名:`zoujingli/think-plugs-center`
> * 安装方式:`composer require zoujingli/think-plugs-center`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-center](https://gitee.com/zoujingli/think-plugs-center)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-center.html)
> * 开源协议:[Apache2](https://www.apache.org/licenses/LICENSE-2.0) ( 免费开源,建议保留版权注释,支持本地插件化定制 )
> 基础插件市场系统 ( 已稳定可用,建议使用 plugin-center )
> * 插件标识:`plugin-center-simple`
> * 插件包名:`zoujingli/think-plugs-center-simple`
> * 安装方式:`composer require zoujingli/think-plugs-center-simple`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-center-simple](https://gitee.com/zoujingli/think-plugs-center-simple)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-center-simple.html)
> * 开源协议:[Apache2](https://www.apache.org/licenses/LICENSE-2.0) ( 免费开源,建议保留版权注释,支持本地插件化定制 )
> 基于 Workerman 的 网络服务插件 ( 已稳定可用 )
> * 插件标识:`plugin-worker`
> * 插件包名:`zoujingli/think-plugs-worker`
> * 安装方式:`composer require zoujingli/think-plugs-worker`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-worker](https://gitee.com/zoujingli/think-plugs-worker)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-worker.html)
> * 开源协议:[Apache2](https://www.apache.org/licenses/LICENSE-2.0) ( 免费开源,建议保留版权注释,支持本地插件化定制 )
## 会员尊享插件
> 多端用户账号系统 ( 已稳定可用 )
> * 插件标识:`plugin-account`
> * 插件包名:`zoujingli/think-plugs-account`
> * 安装方式:`composer require zoujingli/think-plugs-account`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-account](https://gitee.com/zoujingli/think-plugs-account)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-account.html)
> * 授权协议:[VIP授权](https://thinkadmin.top/vip-introduce.html) ( 非VIP用户仅可用于学习,不得商用,支持本地插件化定制 )
> 多端支付管理系统 ( 已稳定可用 )
> * 插件标识:`plugin-payment`
> * 插件包名:`zoujingli/think-plugs-payment`
> * 安装方式:`composer require zoujingli/think-plugs-payment`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-payment](https://gitee.com/zoujingli/think-plugs-payment)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-payment.html)
> * 授权协议:[VIP授权](https://thinkadmin.top/vip-introduce.html) ( 非VIP用户仅可用于学习,不得商用,支持本地插件化定制 )
> 多端微商城系统 ( 已稳定可用 )
> * 插件标识:`plugin-wemall`
> * 插件包名:`zoujingli/think-plugs-wemall`
> * 安装方式:`composer require zoujingli/think-plugs-wemall`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-wemall](https://gitee.com/zoujingli/think-plugs-wemall)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-wemall.html)
> * 授权协议:[VIP授权](https://thinkadmin.top/vip-introduce.html) ( 非VIP用户仅可用于学习,不得商用,支持本地插件化定制 )
> 微信开放平台基础插件( 已稳定可用 )
> * 插件标识:`plugin-wechat-service`
> * 插件包名:`zoujingli/think-plugs-wechat-service`
> * 安装方式:`composer require zoujingli/think-plugs-wechat-service`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-wechat-service](https://gitee.com/zoujingli/think-plugs-wechat-service)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-wechat-service.html)
> * 授权协议:[VIP授权](https://thinkadmin.top/vip-introduce.html) ( 非VIP用户仅可用于学习,不得商用,支持本地插件化定制 )
## 收费授权插件
> 一物一码溯源系统 ( 开发中,还未发布 )
> * 插件标识:`plugin-wuma`
> * 插件包名:`zoujingli/think-plugs-wuma`
> * 安装方式:`composer require zoujingli/think-plugs-wuma`
> * 插件仓库:[https://gitee.com/zoujingli/think-plugs-wuma](https://gitee.com/zoujingli/think-plugs-wuma)
> * 文档地址:[查看文档](https://thinkadmin.top/plugin/think-plugs-wuma.html)
> * 授权协议:[收费授权](https://thinkadmin.top/fee-introduce.html) ( 未获得授权仅可用于学习,不得商用,支持本地插件化定制 )
## 案例安装体验
如果需要本地化定制开发,请参考[插件本地化定制](https://thinkadmin.top/system/plugin-developer.html)文档
```shell
# 创建项目
composer create-project zoujingli/thinkadmin
# 进入项目目录
cd thinkadmin
# 安装微信插件
composer require zoujingli/think-plugs-wechat
# 安装插件管理中心
composer require zoujingli/think-plugs-center
# 安装多端账号管理
composer require zoujingli/think-plugs-account
# 安装多端支付管理
composer require zoujingli/think-plugs-payment
# 安装多端商城管理
composer require zoujingli/think-plugs-wemall
# 启动 WEB 内置服务
php think run --host 127.0.0.1
```

23
public/index.php Normal file
View File

@ -0,0 +1,23 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
use think\admin\service\RuntimeService;
// 加载基础文件
require __DIR__ . '/../vendor/autoload.php';
// WEB应用初始化
RuntimeService::doWebsiteInit();

4
public/robots.txt Normal file
View File

@ -0,0 +1,4 @@
User-agent: *
Disallow: /data
Disallow: /admin
Disallow: /wechat

22
public/router.php Normal file
View File

@ -0,0 +1,22 @@
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
if (is_file($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'])) {
return false;
} else {
$_SERVER['SCRIPT_FILENAME'] = __DIR__ . '/index.php';
require $_SERVER['SCRIPT_FILENAME'];
}

View File

@ -0,0 +1,56 @@
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
// | 自定义后台扩展脚本,需要在加载 admin.js 后载入
// | 使用 composer require zoujingli/think-plugs-static 时不会更新此文件
// +----------------------------------------------------------------------
$(function () {
window.$body = $('body');
/*! 初始化异步加载的内容扩展动作 */
// $body.on('reInit', function (evt, $dom) {
// console.log('Event.reInit', $dom);
// });
/*! 追加 require 配置参数
/*! 加载的文件不能与主配置重复 */
// require.config({
// paths: {
// 'vue': ['plugs/vue/vue.min'],
// },
// shim: {
// 'vue': ['json']
// },
// });
// // 基于 Require 加载测试
// require(['vue', 'md5'], function (vue, md5) {
// console.log(vue)
// console.log(md5.hash('content'))
// });
/*! 其他 javascript 脚本代码 */
// 显示表格图片
window.showTableImage = function (image, circle, size, title) {
return $.layTable.showImage(image, circle, size, title);
};
// 显示商品规格
window.showSpec = function (spec) {
let names = [];
return layui.each(spec.split(';;'), function (i, vv) {
names.push(vv.split('::').pop());
}), names.join(' ');
}
});

View File

@ -0,0 +1,16 @@
/* +----------------------------------------------------------------------
/* | Static Plugin for ThinkAdmin
/* +----------------------------------------------------------------------
/* | 官方网站: https://thinkadmin.top
/* +----------------------------------------------------------------------
/* | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
/* +----------------------------------------------------------------------
/* | 开源协议 ( https://mit-license.org )
/* | 免责声明 ( https://thinkadmin.top/disclaimer )
/* +----------------------------------------------------------------------
/* | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
/* | github 代码仓库:https://github.com/zoujingli/think-plugs-static
/* +----------------------------------------------------------------------
/* | 自定义后台扩展样式,需要在加载 console.css 后载入
/* | 使用 composer require zoujingli/think-plugs-static 时不会更新此文件
/* +---------------------------------------------------------------------- */

224
readme.md Normal file
View File

@ -0,0 +1,224 @@
## 大道至简 · 原生框架
[![Latest Stable Version](https://poser.pugx.org/zoujingli/thinkadmin/v/stable)](https://packagist.org/packages/zoujingli/thinkadmin)
[![Total Downloads](https://poser.pugx.org/zoujingli/thinkadmin/downloads)](https://packagist.org/packages/zoujingli/thinkadmin)
[![Monthly Downloads](https://poser.pugx.org/zoujingli/thinkadmin/d/monthly)](https://packagist.org/packages/zoujingli/thinkadmin)
[![Daily Downloads](https://poser.pugx.org/zoujingli/thinkadmin/d/daily)](https://packagist.org/packages/zoujingli/thinkadmin)
[![License](https://poser.pugx.org/zoujingli/thinkadmin/license)](https://packagist.org/packages/zoujingli/thinkadmin)
### 项目介绍
**ThinkAdmin** 是一款遵循 **MIT** 协议开源的快速开发框架,基于最新版本 **ThinkPHP6** 的极简后台管理系统,在使用 **ThinkAdmin** 前请认真阅读[《免责声明》](https://thinkadmin.top/disclaimer)并同意该声明。
我们致力于快速开发的底层框架,让项目开发变得更容易。框架提供完善的基础组件以及对应的 **API** 支持,基于此框架可以快速开发各种 **WEB** 应用。任何一个系统都不能完全满足所有的业务场景,**ThinkAdmin** 免费提供基础底层的功能,这里包括系统权限管理,系统存储配置,微信授权管理,以及其他常用功能集成等…… 因此 **ThinkAdmin** 也被大家定性为外包二开基线系统。目前已经有许多公司及个人在使用 **ThinkAdmin**,通过数据聚合统计已有 **5** 万多在线运行的项目。
**ThinkAdmin v6** 是基于 **v1**-**v5** 大版本的积累,经历了几次大的调整,结合 **ThinkPHP6** 的思维重新构建,减少大量原非必需的组件,自建存储层、服务层及队列任务机制,另外还增加了许多友好指令!当前 **v6** 版本已经通过了数个系统实践与测试,过程中不停调整与优化,目前系统模块及微信模块已经趋于稳定,现将系统管理 **`app/admin`** 及微信管理 **`app/wechat`** 定为 **v6** 内核两大模块并以 **MIT** 协议发布,后续可能还有其他模块及相关辅助模块更新发布,敬请期待……
当前 **ThinkAdmin** 的最新版本为 **v6.1**,从这个版本开始正式进入插件时代,基础组件及扩展插件统一使用 **Composer**
管理。现在通过对 **Composer** 深度开发已实现了插件自动安装机制,可以大大减少项目初始化安装的成本。**ThinkAdmin** 与传统
**ThinkPHP** 多应用模式无差别,用户可以自行开发自己的模块,此次升级可完美兼容 **ThinkAdmin v6.0**
应用。我们强烈建议不要占用或修改 **`app/admin`** 和 **`app/wechat`** 两个目录里面的代码,这些未来可以通过 **Composer**
进行功能及安全升级。
系统核心组件 **ThinkLibrary** 封装了大量常用操作以及多应用组件,可快速开发各种应用程序,且不影响原 **ThinkPHP** 生态,大大简化编码成本;可自行选择集成 **WechatDeveloper** 组件 ( 支持微信公众号、微信小程序、微信企业号、微信商户支付、支付宝支付等 ) 及 **QRcode** 二维码生成工具等。里面还内置了 **ThinkPHP6** 多应用组件并且完美支持路由;文件存储支持本地服务器存储、七牛云对象存储(支持CDN加速)、又拍云USS存储(支持CDN加速)、阿里云OSS存储(支持CDN加速)、腾讯云COS存储(支持CDN加速)等存储方式;自带异步任务处理机制,可以并列多进程执行任务,任务响应延时小于 **0.5** 秒,兼容 **windows****linux**
**温馨提示:** 如果需要直接查看源代码和数据库 **SQL** 文件,请切换到 `v6` 分支,从 `v6.1` 开始不再直接提供源代码和数据库 **SQL**
文件,其初始化及安装都由插件实现。使用 **Composer** 时建议安装新版本并使用官方源,目前国内大部分镜像经常出现`404`
导致组件下载失败或安装不完整等异常情况!
使用 **ThinkAdmin** 需要掌握 **ThinkPHP**、**jQuery**、**LayUI**、**RequireJs** 等开发技能,后台 **UI** 界面基于最新版本的 **LayUI** 前端框架以及 **RequireJs** 组件加载方式,默认加载了所有 **LayUI** 的组件,框架中可以直接使用组件(独立页面需要注意 **js** 加载顺序哦),使用 **RequireJs** 加载插件,互联网上资源非常多,可自行下载进行二次扩展。目前后台大部分页面为单页程序,页面加载速度非常快速,也因此后台不再支持选项卡模式。
### 注意事项
* **ThinkAdmin** 是基于国内最流行的 **ThinkPHP6** 框架开发,要求在不低于 **PHP 7.2.5** 的版本上运行,如果使用低版本的 **PHP** 可能会影响 **Composer** 依赖组件的安装,或将存在一定的安全隐患;
* 运行环境必需开启 **PATHINFO** 并将对应的 **rewrite** 规则配置到站点才能访问,系统已不再支持 **ThinkPHP****URL** 兼容模式运行 ( 源于如何优雅地展示 ),可以阅读 **ThinkAdmin** 的文档[安装部署](https://thinkadmin.top/guide/install.html)章节;
* 代码仓库下载的文件不包含 **Composer** 组件的 **vendor** 目录,下载后需要执行 **composer install** 安装依赖组件,同时会触发执行 **php think migrate:run** 安装数据库 **Phinx** 脚本,如需切换数据库只需要先配置再执行指令即可完成初始化安装数据;
* 为保持系统可持续在线升级,建议不要在 **app/admin**、**app/wechat** 、**public/static** 这三个目录创建或修改文件,可以自行创建其他模块再编写自己的业务代码,自定义样式及脚本可以放置在 **public/static/extra** 目录里面。
* 系统是基于严格类型 **PHP** 新特性开发,务必使用专业的 **IDE** ( 如:**PhpStorm**、**NetBeans**、**VsCode**、**Eclipse for PHP** 等 ) 进行项目开发以达到更好的体验与更高的效率!
## 插件生态
了解更多插件信息请阅读 [《ThinkAdmin 插件生态》](plugin.md)
## 系统安装
通过 Composer 工具安装系统, 创建并进入 **ThinkAdmin** 根目录,运行指令安装依赖组件。
```shell
### 创建项目( 需要在英文目录下面执行 )
composer create-project zoujingli/thinkadmin
### 进入项目根目录
cd thinkadmin
### 数据库初始化并安装
php think migrate:run
```
> **A. 测试或体验环境**
>
> 系统默认使用`Sqlite`数据库,不需要配置任何参数,特别要注意使用`Sqlite`
> 数据库时是没有密码的,容易造成数据丢失或泄露。执行上面的安装操作初始化并安装系统依赖组件,
> 并自动安装数据库并初始化数据;执行`php think run`启动系统内置的`WEB`服务,用浏览器访问
> `http://127.0.0.1:8000`进入后台登录界面后,使用系统默认的账号`admin`和密码`admin`登录管理后台;也可以使用其他`Web`
> 服务软件方案实现。
> **B. 开发或线上环境**
>
> 执行上面的安装操作初始化并安装系统依赖组件,通过数据库管理工具创建空数据库,并将数据库参数配置到`config/database.php`;
> 然后执行`php think migrate:run`完成数据库初始化安装;线上环境还需要安装`Nginx`或`Apache`等`Web`服务 (
> 推荐使用[宝塔](https://www.bt.cn/?invite_code=MV90a3Z6dmI=)集成环境 ),并按照`ThinkPHP6`系统要求配置网站参数。
## 数据管理
> **A. 注意事项**
>
> 数据库是使用 `Phinx` 工具管理的,在未配置数据库时默认使用 `Sqlite`,数据库文件位于 `database/sqlite.db`,使用 `Sqlite`
> 数据库时仅限用于体验与测试,建议不要用于生产环境,生产环境建议使用开源免费的 `MySQL` 数据库;
> **B. 数据库初始化安装**
>
> 使用 `MySql`, `SqlServer`, `Postgres` 等服务型数据库时,需要先创建空的数据库并将参数配置到 `config/database.php`
> ,然后执行 `composer update` 或 `php think migrate:run`
> 安装并初始化数据库;开发部署系统时,如果要对数据库添加数据表或修改数据表,可以直接修改数据库或创建 `Phinx`
> 脚本后执行 `php think migrate:run` 进行数据库更新升级。另外系统提供 `php think xadmin:package` 指令可以把现有 `MySQl`
> 数据库打包为 `Phinx` 脚本,迁移系统时只需要执行前面的安装步骤即可。
## 注解权限
注解权限是指通过方法注释来实现后台 RBAC 授权管理,用注解来管理功能节点。
开发人员只需要写好注释,RBAC 的节点会自动生成,只需要配置角色及用户就可以使用RBAC权限。
* 此版本的权限使用注解实现
* 注释必须标准的块注释,如下案例
* 其中`@auth true`表示访问需要权限验证
* 其中`@menu true`菜单编辑显示可选节点
* 其中`@login true`需要强制登录才可访问
```php
/**
* 操作的名称
* @auth true # 表示访问需要权限验证
* @menu true # 菜单编辑显示可选节点
* @login true # 需要强制登录才可访问
*/
public function index(){
// @todo
}
```
## 代码仓库
我们的代码仓库已移至 **Github**,而 **Gitee** 则仅作为国内镜像仓库,方便广大开发者获取和使用。若想提交 **PR****ISSUE** 请在 [ThinkAdminDeveloper](https://github.com/zoujingli/ThinkAdminDeveloper) 仓库进行操作,如果在其他仓库操作或提交问题将无法处理!。
部分代码来自互联网,若有异议可以联系作者进行删除。
* 在线体验地址:https://v6.thinkadmin.top (账号和密码都是 admin )
* Gitee仓库地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v6.1
* GitHub仓库地址:https://github.com/zoujingli/ThinkAdmin/tree/v6.1
## 技术支持
开发前请认真阅读 ThinkPHP 官方文档,会对您有帮助哦!
本地开发请使用 `php think run` 运行服务,访问 `http://127.0.0.1:8000` 即可进入项目。
官方地址及开发指南:https://doc.thinkadmin.top ,如果实在无法解决问题,可以加入官方群免费交流。
**1.官方QQ交流群:** 513350915
**2.官方QQ交流群:** 866345568
**3.官方微信交流群**
<img src="https://thinkadmin.top/static/img/wx.png" width="250">
## 框架指令
* 执行 `php think run` 启用本地开发环境,访问 `http://127.0.0.1:8000`
* 执行 `php think xadmin:package` 将现有 `MySQL` 数据库打包为 `Phinx` 数据库脚本
* 执行 `php think xadmin:sysmenu` 重写系统菜单并生成新编号,同时会清理已禁用的菜单数据
* 执行 `php think xadmin:fansall` 同步微信粉丝数据,依赖于 `ThinkPlugsWechat` 应用插件
* 执行 `php think xadmin:replace` 可以批量替换数据库指定字符字段内容,通常用于文件地址替换
* 执行 `php think xadmin:database` 对数据库的所有表 `repair|optimize` 操作,优化并整理数据库碎片
* 执行 `php think xadmin:publish` 可自动安装现在模块或已安装应用插件,参数 `--migrate` 执行数据库脚本
#### 1. 守护进程管理(可自建定时任务去守护监听主进程)
* 执行 `php think xadmin:queue listen` [监听]启动异步任务监听服务
* 执行 `php think xadmin:queue start` [控制]检查创建任务监听服务(建议定时任务执行)
* 执行 `php think xadmin:queue query` [控制]查询当前任务相关的进程
* 执行 `php think xadmin:queue status` [控制]查看异步任务监听状态
* 执行 `php think xadmin:queue stop` [控制]平滑停止所有任务进程
#### 2. 本地调试管理(可自建定时任务去守护监听主进程)
* 执行 `php think xadmin:queue webstop` [调试]停止本地调试服务
* 执行 `php think xadmin:queue webstart` [调试]开启本地调试服务(建议定时任务执行)
* 执行 `php think xadmin:queue webstatus` [调试]查看本地调试状态
## 问题修复
* 增加 `CORS` 跨域规则配置,配置参数置放于 `config/app.php`,需要更新 `ThinkLibrary`
* 修复 `layui.table` 导致基于 `ThinkPHP` 模板输出自动转义 `XSS` 过滤机制失效,需要更新 `ThinkLibrary`
* 修复在模板中使用 `{:input(NAME)}` 取值而产生的 `XSS` 问题,模板取值更换为 `{$get.NAME|default=''}`
* 修复 `CKEDITOR` 配置文件,禁用所有标签的 `on` 事件,阻止 `xss` 脚本注入,需要更新 `ckeditor/config.js`
* 修复文件上传入口的后缀验证,读取真实文件后缀与配置对比,阻止不合法的文件上传并存储到本地服务器。
* 修改 `JsonRpc` 接口异常处理机制,当服务端绑定 `Exception` 时,客户端将能收到 `error` 消息及异常数据。
* 修改 `location.hash` 访问机制,禁止直接访问外部 `URL` 资源链接,防止外部 `XSS` 攻击读取本地缓存数据。
* 增加后台主题样式配置,支持全局默认+用户个性配置,需要更新 `admin`, `static`, `ThinkLibrary` 组件及模块。
* 后台行政区域数据更新,由原来的腾讯地图数据切换为百度地图最新数据,需要更新`static`,数据库版需另行更新。
* 增加`Phinx`数据库迁移脚本支持,可根据自己的需求安装对应模块,其中 `admin` 为改选模块!
* 从分离 `SystemService` 分离出 `RuntimeService` 服务,精减服务启动入口,优化性能!
* 增加插件模式,支持独立封装应用,可以通过 `composer` 管理并自动安装应用模块!
## 版权信息
[**ThinkAdmin**](https://thinkadmin.top) 遵循 [**MIT**](license) 开源协议发布,并免费提供使用。
本项目包含的第三方源码和二进制文件的版权信息另行标注。
版权所有 Copyright © 2014-2023 by ThinkAdmin (https://thinkadmin.top) All rights reserved。
更多细节参阅 [`LISENSE`](license) 文件
## 系统版本
以下系统的体验账号及密码都是 admin
### ThinkAdmin v6 基于 ThinkPHP6 开发(后台权限基于注解实现)
* 在线体验地址:https://v6.thinkadmin.top (运行中)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v6
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v6
### ThinkAdmin v5 基于 ThinkPHP 5.1 开发(后台权限基于注解实现)
* 在线体验地址:https://v5.thinkadmin.top (已停用)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v5
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v5
### ThinkAdmin v4 基于 ThinkPHP 5.1 开发(不建议继续使用)
* 在线体验地址:https://v4.thinkadmin.top (已停用)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v4
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v4
### ThinkAdmin v3 基于 ThinkPHP 5.1 开发(不建议继续使用)
* 在线体验地址:https://v3.thinkadmin.top (已停用)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v3
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v3
### ThinkAdmin v2 基于 ThinkPHP 5.0 开发(不建议继续使用)
* 在线体验地址:https://v2.thinkadmin.top (已停用)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v2
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v2
### ThinkAdmin v1 基于 ThinkPHP 5.0 开发(不建议继续使用)
* 在线体验地址:https://v1.thinkadmin.top (已停用)
* Gitee 代码地址:https://gitee.com/zoujingli/ThinkAdmin/tree/v1
* Github 代码地址:https://github.com/zoujingli/ThinkAdmin/tree/v1

24
think Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------
use think\admin\service\RuntimeService;
// 加载基础文件
require __DIR__ . '/vendor/autoload.php';
// 命令行应用初始化
RuntimeService::doConsoleInit();