Showing preview only (941K chars total). Download the full file or copy to clipboard to get everything.
Repository: saithink/saiadmin
Branch: 6.x
Commit: bce3cc48ba27
Files: 232
Total size: 801.9 KB
Directory structure:
gitextract_4k9f2lks/
├── LICENSE
├── README.md
├── composer.json
└── src/
├── Install.php
├── orm/
│ ├── eloquent/
│ │ └── app/
│ │ ├── logic/
│ │ │ ├── system/
│ │ │ │ ├── DatabaseLogic.php
│ │ │ │ ├── SystemAttachmentLogic.php
│ │ │ │ ├── SystemCategoryLogic.php
│ │ │ │ ├── SystemConfigGroupLogic.php
│ │ │ │ ├── SystemConfigLogic.php
│ │ │ │ ├── SystemDeptLogic.php
│ │ │ │ ├── SystemDictDataLogic.php
│ │ │ │ ├── SystemDictTypeLogic.php
│ │ │ │ ├── SystemLoginLogLogic.php
│ │ │ │ ├── SystemMailLogic.php
│ │ │ │ ├── SystemMenuLogic.php
│ │ │ │ ├── SystemOperLogLogic.php
│ │ │ │ ├── SystemPostLogic.php
│ │ │ │ ├── SystemRoleLogic.php
│ │ │ │ └── SystemUserLogic.php
│ │ │ └── tool/
│ │ │ ├── CrontabLogLogic.php
│ │ │ ├── CrontabLogic.php
│ │ │ ├── GenerateColumnsLogic.php
│ │ │ └── GenerateTablesLogic.php
│ │ └── model/
│ │ ├── system/
│ │ │ ├── SystemAttachment.php
│ │ │ ├── SystemCategory.php
│ │ │ ├── SystemConfig.php
│ │ │ ├── SystemConfigGroup.php
│ │ │ ├── SystemDept.php
│ │ │ ├── SystemDictData.php
│ │ │ ├── SystemDictType.php
│ │ │ ├── SystemLoginLog.php
│ │ │ ├── SystemMail.php
│ │ │ ├── SystemMenu.php
│ │ │ ├── SystemOperLog.php
│ │ │ ├── SystemPost.php
│ │ │ ├── SystemRole.php
│ │ │ ├── SystemRoleDept.php
│ │ │ ├── SystemRoleMenu.php
│ │ │ ├── SystemUser.php
│ │ │ ├── SystemUserPost.php
│ │ │ └── SystemUserRole.php
│ │ └── tool/
│ │ ├── Crontab.php
│ │ ├── CrontabLog.php
│ │ ├── GenerateColumns.php
│ │ └── GenerateTables.php
│ └── think/
│ └── app/
│ ├── logic/
│ │ ├── system/
│ │ │ ├── DatabaseLogic.php
│ │ │ ├── SystemAttachmentLogic.php
│ │ │ ├── SystemCategoryLogic.php
│ │ │ ├── SystemConfigGroupLogic.php
│ │ │ ├── SystemConfigLogic.php
│ │ │ ├── SystemDeptLogic.php
│ │ │ ├── SystemDictDataLogic.php
│ │ │ ├── SystemDictTypeLogic.php
│ │ │ ├── SystemLoginLogLogic.php
│ │ │ ├── SystemMailLogic.php
│ │ │ ├── SystemMenuLogic.php
│ │ │ ├── SystemOperLogLogic.php
│ │ │ ├── SystemPostLogic.php
│ │ │ ├── SystemRoleLogic.php
│ │ │ └── SystemUserLogic.php
│ │ └── tool/
│ │ ├── CrontabLogLogic.php
│ │ ├── CrontabLogic.php
│ │ ├── GenerateColumnsLogic.php
│ │ └── GenerateTablesLogic.php
│ └── model/
│ ├── system/
│ │ ├── SystemAttachment.php
│ │ ├── SystemCategory.php
│ │ ├── SystemConfig.php
│ │ ├── SystemConfigGroup.php
│ │ ├── SystemDept.php
│ │ ├── SystemDictData.php
│ │ ├── SystemDictType.php
│ │ ├── SystemLoginLog.php
│ │ ├── SystemMail.php
│ │ ├── SystemMenu.php
│ │ ├── SystemOperLog.php
│ │ ├── SystemPost.php
│ │ ├── SystemRole.php
│ │ ├── SystemRoleDept.php
│ │ ├── SystemRoleMenu.php
│ │ ├── SystemUser.php
│ │ ├── SystemUserPost.php
│ │ └── SystemUserRole.php
│ └── tool/
│ ├── Crontab.php
│ ├── CrontabLog.php
│ ├── GenerateColumns.php
│ └── GenerateTables.php
└── plugin/
└── saiadmin/
├── app/
│ ├── cache/
│ │ ├── ConfigCache.php
│ │ ├── DictCache.php
│ │ ├── ReflectionCache.php
│ │ ├── UserAuthCache.php
│ │ ├── UserInfoCache.php
│ │ └── UserMenuCache.php
│ ├── controller/
│ │ ├── InstallController.php
│ │ ├── LoginController.php
│ │ ├── SystemController.php
│ │ ├── system/
│ │ │ ├── DataBaseController.php
│ │ │ ├── SystemAttachmentController.php
│ │ │ ├── SystemCategoryController.php
│ │ │ ├── SystemConfigController.php
│ │ │ ├── SystemConfigGroupController.php
│ │ │ ├── SystemDeptController.php
│ │ │ ├── SystemDictDataController.php
│ │ │ ├── SystemDictTypeController.php
│ │ │ ├── SystemLogController.php
│ │ │ ├── SystemMailController.php
│ │ │ ├── SystemMenuController.php
│ │ │ ├── SystemPostController.php
│ │ │ ├── SystemRoleController.php
│ │ │ ├── SystemServerController.php
│ │ │ └── SystemUserController.php
│ │ └── tool/
│ │ ├── CrontabController.php
│ │ └── GenerateTablesController.php
│ ├── event/
│ │ └── SystemUser.php
│ ├── exception/
│ │ └── Handler.php
│ ├── functions.php
│ ├── logic/
│ │ ├── system/
│ │ │ ├── DatabaseLogic.php
│ │ │ ├── SystemAttachmentLogic.php
│ │ │ ├── SystemCategoryLogic.php
│ │ │ ├── SystemConfigGroupLogic.php
│ │ │ ├── SystemConfigLogic.php
│ │ │ ├── SystemDeptLogic.php
│ │ │ ├── SystemDictDataLogic.php
│ │ │ ├── SystemDictTypeLogic.php
│ │ │ ├── SystemLoginLogLogic.php
│ │ │ ├── SystemMailLogic.php
│ │ │ ├── SystemMenuLogic.php
│ │ │ ├── SystemOperLogLogic.php
│ │ │ ├── SystemPostLogic.php
│ │ │ ├── SystemRoleLogic.php
│ │ │ └── SystemUserLogic.php
│ │ └── tool/
│ │ ├── CrontabLogLogic.php
│ │ ├── CrontabLogic.php
│ │ ├── GenerateColumnsLogic.php
│ │ └── GenerateTablesLogic.php
│ ├── middleware/
│ │ ├── CheckAuth.php
│ │ ├── CheckLogin.php
│ │ ├── CrossDomain.php
│ │ └── SystemLog.php
│ ├── model/
│ │ ├── system/
│ │ │ ├── SystemAttachment.php
│ │ │ ├── SystemCategory.php
│ │ │ ├── SystemConfig.php
│ │ │ ├── SystemConfigGroup.php
│ │ │ ├── SystemDept.php
│ │ │ ├── SystemDictData.php
│ │ │ ├── SystemDictType.php
│ │ │ ├── SystemLoginLog.php
│ │ │ ├── SystemMail.php
│ │ │ ├── SystemMenu.php
│ │ │ ├── SystemOperLog.php
│ │ │ ├── SystemPost.php
│ │ │ ├── SystemRole.php
│ │ │ ├── SystemRoleDept.php
│ │ │ ├── SystemRoleMenu.php
│ │ │ ├── SystemUser.php
│ │ │ ├── SystemUserPost.php
│ │ │ └── SystemUserRole.php
│ │ └── tool/
│ │ ├── Crontab.php
│ │ ├── CrontabLog.php
│ │ ├── GenerateColumns.php
│ │ └── GenerateTables.php
│ ├── validate/
│ │ ├── system/
│ │ │ ├── SystemCategoryValidate.php
│ │ │ ├── SystemConfigGroupValidate.php
│ │ │ ├── SystemConfigValidate.php
│ │ │ ├── SystemCrontabValidate.php
│ │ │ ├── SystemDeptValidate.php
│ │ │ ├── SystemDictDataValidate.php
│ │ │ ├── SystemDictTypeValidate.php
│ │ │ ├── SystemMailValidate.php
│ │ │ ├── SystemMenuValidate.php
│ │ │ ├── SystemNoticeValidate.php
│ │ │ ├── SystemPostValidate.php
│ │ │ ├── SystemRoleValidate.php
│ │ │ └── SystemUserValidate.php
│ │ └── tool/
│ │ ├── CrontabValidate.php
│ │ └── GenerateTablesValidate.php
│ └── view/
│ └── install/
│ ├── error.html
│ └── index.html
├── basic/
│ ├── AbstractLogic.php
│ ├── BaseController.php
│ ├── BaseValidate.php
│ ├── OpenController.php
│ ├── contracts/
│ │ ├── LogicInterface.php
│ │ └── ModelInterface.php
│ ├── eloquent/
│ │ ├── BaseLogic.php
│ │ └── BaseModel.php
│ └── think/
│ ├── BaseLogic.php
│ └── BaseModel.php
├── command/
│ ├── SaiOrm.php
│ ├── SaiPlugin.php
│ └── SaiUpgrade.php
├── config/
│ ├── app.php
│ ├── autoload.php
│ ├── container.php
│ ├── database.php
│ ├── event.php
│ ├── exception.php
│ ├── log.php
│ ├── middleware.php
│ ├── process.php
│ ├── route.php
│ ├── saithink.php
│ ├── static.php
│ ├── translation.php
│ └── view.php
├── db/
│ ├── plugin.sql
│ ├── saiadmin-6.0.sql
│ └── saiadmin-pure.sql
├── exception/
│ ├── ApiException.php
│ └── SystemException.php
├── process/
│ ├── Task.php
│ └── Test.php
├── public/
│ └── template/
│ └── template.xlsx
├── service/
│ ├── EmailService.php
│ ├── OpenSpoutWriter.php
│ ├── Permission.php
│ └── storage/
│ ├── ChunkUploadService.php
│ └── UploadService.php
└── utils/
├── Arr.php
├── Captcha.php
├── Helper.php
├── ServerMonitor.php
└── code/
├── CodeEngine.php
├── CodeZip.php
└── stub/
└── saiadmin/
├── php/
│ ├── controller.stub
│ ├── logic.stub
│ ├── model.stub
│ └── validate.stub
├── sql/
│ └── sql.stub
├── ts/
│ └── api.stub
└── vue/
├── edit-dialog.stub
├── index.stub
└── table-search.stub
================================================
FILE CONTENTS
================================================
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2024 saithink
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.
================================================
FILE: README.md
================================================
<p align="center">
<img src="https://saithink.top/images/logo.png" width="120" />
</p>
<p align="center">
<img src="https://svg.hamm.cn/badge.svg?key=License&value=MIT" />
<img src="https://svg.hamm.cn/badge.svg?key=Version&value=6.x" />
</p>
<div style="padding:18px;max-width: 1024px;margin:0 auto;">
<h1>SaiAdmin 6.x</h1>
基于<a href="https://www.workerman.net/doc/webman/" target="_blank">webman</a>(高性能HTTP服务框架)开箱即用的高质量中后台管理系统
<h1>安装</h1>
composer环境的安装命令如下
```bash
composer require saithink/saiadmin
```
启动方式请查看webman官方文档
<h1>功能列表</h1>
• 用户管理,用户添加、修改、删除,支持不同用户登录后台看到不同的首页
• 部门管理,部门组织机构(公司、部门、小组),树结构方式展现适应各种结构
• 岗位管理,可以给用户配置所担任职务
• 角色管理,树结构设计,支持角色菜单和按钮权限分配,支持角色数据权限分配、强大的角色管理体系
• 菜单管理,配置系统菜单和按钮等
• 字典管理,对系统中经常使用并且固定的数据可以重复使用和维护
• 系统配置,系统的一些常用设置管理
• 操作日志,用户对系统的一些正常操作的查询
• 登录日志,用户登录系统的记录查询
• 服务监控,查看当前服务器状态和PHP环境等信息
• 附件管理,管理当前系统上传的文件及图片等信息
• 数据表维护,对系统的数据表可以进行清理碎片和优化
• 定时任务,在线(添加、修改、删除)任务调度包含执行结果日志
• 代码生成,前后端代码的生成(php、vue、js、sql),支持一键下载和一键生成到项目中
• 邮件服务,内置邮件发送服务
• 文件上传,支持本地、七牛云、阿里云、腾讯云上、S3上传
• 应用市场,生态丰富,官网上架官方和开发人员的插件应用
• 兼容性强,基于webman插件形式开发,对webman无侵入,和webman各种应用插件共存
<h1>学习</h1>
<ul>
<li>
<a href="https://saithink.top" target="_blank">主页 / Home page</a>
</li>
</ul>
<h1>演示地址</h1>
<p>演示地址: <a href="http://v6.saithink.top">http://v6.saithink.top</a></p>
<p>演示账号:admin</p>
<p>演示密码:123456</p>
<h1>共同交流</h1>
<table>
<tbody>
<tr>
<td align="center" valign="middle">
<img src="https://saithink.top/images/me.png" class="no-zoom" width="180px">
<p>saiadmin交流群(添加我微信备注"saiadmin")</p>
</td>
</tr>
</tbody>
</table>
<h1>支持项目</h1>
如果您正在使用这个项目并感觉良好,或者是想支持我继续开发,您可以通过如下`任意`方式支持我:
谢谢! ❤️
| 微信 | 支付宝 |
| :------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: |
| <img src="https://saithink.top/images/wechat.png" alt="Wechat QRcode" width=180> | <img src="https://saithink.top/images/alipay.png" alt="Alipay QRcode" width=180> |
<div style="clear: both">
<h1>LICENSE</h1>
This project is open-sourced software licensed under the MIT.
</div>
</div>
================================================
FILE: composer.json
================================================
{
"name": "saithink/saiadmin",
"description": "webman plugin",
"type": "library",
"license": "MIT",
"require": {
"php": ">=8.1",
"webman/think-orm": "^2.1",
"webman/think-cache": "^2.1",
"webman/cache": "^2.1",
"webman/redis": "^2.1",
"webman/captcha": "^1.0",
"webman/event": "^1.0",
"webman/channel": "^2.1",
"webman/console": "^2.1",
"webman/database": "^2.1",
"illuminate/pagination": "^12.43",
"illuminate/events": "^12.43",
"workerman/crontab": "^1.0",
"tinywan/jwt": "^1.11",
"tinywan/storage": "^1.1",
"guzzlehttp/guzzle": "^7.9",
"topthink/think-validate": "^3.0",
"topthink/think-orm": "^2.0.53 || ^3.0.0",
"ramsey/uuid": "^4.0",
"zoujingli/ip2region": "^2.0",
"openspout/openspout": "^4.0",
"phpmailer/phpmailer": "^6.9",
"godruoyi/php-snowflake": "^3.0.0",
"vlucas/phpdotenv": "^5.6",
"twig/twig": "^3.20"
},
"autoload": {
"psr-4": {
"Webman\\saiadmin\\": "src/"
}
},
"authors": [
{
"name": "saithink",
"email": "1430792918@qq.com"
}
]
}
================================================
FILE: src/Install.php
================================================
<?php
namespace Webman\saiadmin;
class Install
{
const WEBMAN_PLUGIN = true;
/**
* @var array
*/
protected static $pathRelation = [
'plugin/saiadmin' => 'plugin/saiadmin'
];
/**
* Install
* @return void
*/
public static function install()
{
static::installByRelation();
static::addMethod();
}
/**
* Uninstall
* @return void
*/
public static function uninstall()
{
self::uninstallByRelation();
}
/**
* installByRelation
* @return void
*/
public static function installByRelation()
{
foreach (static::$pathRelation as $source => $dest) {
if ($pos = strrpos($dest, '/')) {
$parent_dir = base_path().'/'.substr($dest, 0, $pos);
if (!is_dir($parent_dir)) {
mkdir($parent_dir, 0777, true);
}
}
//symlink(__DIR__ . "/$source", base_path()."/$dest");
copy_dir(__DIR__ . "/$source", base_path()."/$dest");
echo "Create $dest";
}
}
/**
* uninstallByRelation
* @return void
*/
public static function uninstallByRelation()
{
foreach (static::$pathRelation as $source => $dest) {
$path = base_path()."/$dest";
if (!is_dir($path) && !is_file($path)) {
continue;
}
echo "Remove $dest";
if (is_file($path) || is_link($path)) {
unlink($path);
continue;
}
remove_dir($path);
}
}
/**
* addMethod
* @return void
*/
public static function addMethod()
{
$path = base_path() . '/support/Request.php';
// 如果Request中没有more方法,则自动添加一个
$content = file_get_contents($path);
if ($content !== false) {
if (stripos($content, "public function more") !== false) {
echo " Request类,已有more方法\n";
return;
}
$pattern = '/class\s+(\w+)\s+extends\s+(\\\\?(?:\w+\\\\)*\w+)\s*\{[\s\S]*?\}/';
if (preg_match($pattern, $content, $matches, PREG_OFFSET_CAPTURE)) {
$classEnd = $matches[0][1] + strlen($matches[0][0]) - 1;
// 构造新方法
$newMethod = <<<EOF
/**
* 获取参数增强方法
* @param array \$params
* @return array
*/
public function more(array \$params): array
{
\$p = [];
foreach (\$params as \$param) {
if (!is_array(\$param)) {
\$p[\$param] = \$this->input(\$param);
} else {
if (!isset(\$param[1])) \$param[1] = '';
if (is_array(\$param[0])) {
\$name = \$param[0][0] . '/' . \$param[0][1];
\$keyName = \$param[0][0];
} else {
\$name = \$param[0];
\$keyName = \$param[0];
}
\$p[\$keyName] = \$this->input(\$name, \$param[1]);
}
}
return \$p;
}
EOF;
// 在类的末尾插入新方法
$newContent = substr_replace($content, $newMethod, $classEnd, 0);
// 将修改后的内容写回文件
if (file_put_contents($path, $newContent) === false) {
echo " 无法写入文件:$path";
}
echo " Request类添加more方法成功\n";
} else {
echo " Request类添加方法失败,请手动添加more方法";
}
}
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/DatabaseLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use support\Db;
/**
* 数据表维护逻辑层
*/
class DatabaseLogic extends BaseLogic
{
/**
* 获取数据源
* @return array
*/
public function getDbSource(): array
{
$data = config('database.connections');
$list = [];
foreach ($data as $k => $v) {
$list[] = $k;
}
return $list;
}
/**
* 数据列表
* @param $query
* @return mixed
*/
public function getList($query): mixed
{
$request = request();
$page = $request ? ($request->input('page') ?: 1) : 1;
$limit = $request ? ($request->input('limit') ?: 10) : 10;
return self::getTableList($query, $page, $limit);
}
/**
* 获取数据库表数据
*/
public function getTableList($query, $current_page = 1, $per_page = 10): array
{
if (!empty($query['source'])) {
if (!empty($query['name'])) {
$sql = 'show table status where name=:name ';
$list = Db::connection($query['source'])->select($sql, ['name' => $query['name']]);
} else {
$list = Db::connection($query['source'])->select('show table status');
}
} else {
if (!empty($query['name'])) {
$sql = 'show table status where name=:name ';
$list = Db::select($sql, ['name' => $query['name']]);
} else {
$list = Db::select('show table status');
}
}
$data = [];
foreach ($list as $item) {
$data[] = [
'name' => $item->Name,
'engine' => $item->Engine,
'rows' => $item->Rows,
'data_free' => $item->Data_free,
'data_length' => $item->Data_length,
'index_length' => $item->Index_length,
'collation' => $item->Collation,
'create_time' => $item->Create_time,
'update_time' => $item->Update_time,
'comment' => $item->Comment,
];
}
$total = count($data);
$last_page = ceil($total / $per_page);
$startIndex = ($current_page - 1) * $per_page;
$pageData = array_slice($data, $startIndex, $per_page);
return [
'data' => $pageData,
'total' => $total,
'current_page' => $current_page,
'per_page' => $per_page,
'last_page' => $last_page,
];
}
/**
* 获取列信息
*/
public function getColumnList($table, $source): array
{
$columnList = [];
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
if (!empty($source)) {
$list = Db::connection($source)->select('SHOW FULL COLUMNS FROM `' . $table . '`');
} else {
$list = Db::select('SHOW FULL COLUMNS FROM `' . $table . '`');
}
foreach ($list as $column) {
preg_match('/^\w+/', $column->Type, $matches);
$columnList[] = [
'column_key' => $column->Key,
'column_name' => $column->Field,
'column_type' => $matches[0],
'column_comment' => trim(preg_replace("/\([^()]*\)/", "", $column->Comment)),
'extra' => $column->Extra,
'default_value' => $column->Default,
'is_nullable' => $column->Null,
];
}
}
return $columnList;
}
/**
* 优化表
*/
public function optimizeTable($tables)
{
foreach ($tables as $table) {
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
Db::statement('OPTIMIZE TABLE `' . $table . '`');
}
}
}
/**
* 清理表碎片
*/
public function fragmentTable($tables)
{
foreach ($tables as $table) {
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
Db::statement('ANALYZE TABLE `' . $table . '`');
}
}
}
/**
* 获取回收站数据
*/
public function recycleData($table)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
// 查询表字段
$sql = 'SHOW COLUMNS FROM `' . $table . '` where Field = "delete_time"';
$columns = Db::select($sql);
$isDeleteTime = false;
if (count($columns) > 0) {
$isDeleteTime = true;
}
if (!$isDeleteTime) {
throw new ApiException('当前表不支持回收站功能');
}
// 查询软删除数据
$request = request();
$page = $request ? ($request->input('page') ?: 1) : 1;
$limit = $request ? ($request->input('limit') ?: 10) : 10;
$list = Db::table($table)->whereNotNull('delete_time')
->orderBy('delete_time', 'desc')
->paginate($limit, ['*'], 'page', $page);
return [
'current_page' => $list->currentPage(),
'per_page' => $list->perPage(),
'last_page' => $list->lastPage(),
'has_more' => $list->hasMorePages(),
'total' => $list->total(),
'data' => $list->items(),
];
} else {
return [];
}
}
/**
* 删除数据
* @param $table
* @param $ids
* @return bool
*/
public function delete($table, $ids)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
$count = Db::table($table)->whereIn('id', $ids)->delete();
return $count > 0;
} else {
return false;
}
}
/**
* 恢复数据
* @param $table
* @param $ids
* @return bool
*/
public function recovery($table, $ids)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
$count = Db::table($table)
->whereIn('id', $ids)
->update(['delete_time' => null]);
return $count > 0;
} else {
return false;
}
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemAttachmentLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use Exception;
use plugin\saiadmin\app\model\system\SystemAttachment;
use plugin\saiadmin\app\model\system\SystemCategory;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\service\storage\ChunkUploadService;
use plugin\saiadmin\service\storage\UploadService;
use plugin\saiadmin\utils\Arr;
use plugin\saiadmin\utils\Helper;
/**
* 附件逻辑层
*/
class SystemAttachmentLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemAttachment();
}
/**
* @param $category_id
* @param $ids
* @return mixed
*/
public function move($category_id, $ids): mixed
{
$category = SystemCategory::where('id', $category_id)->first();
if (!$category) {
throw new ApiException('目标分类不存在');
}
return $this->model->whereIn('id', $ids)->update(['category_id' => $category_id]);
}
/**
* 保存网络图片
* @param $url
* @param $config
* @return array
* @throws ApiException|Exception
*/
public function saveNetworkImage($url, $config): array
{
$image_data = file_get_contents($url);
if ($image_data === false) {
throw new ApiException('获取文件资源失败');
}
$image_resource = imagecreatefromstring($image_data);
if (!$image_resource) {
throw new ApiException('创建图片资源失败');
}
$filename = basename($url);
$file_extension = pathinfo($filename, PATHINFO_EXTENSION);
$full_dir = runtime_path() . '/resource/';
if (!is_dir($full_dir)) {
mkdir($full_dir, 0777, true);
}
$save_path = $full_dir . $filename;
$mime_type = 'image/';
switch ($file_extension) {
case 'jpg':
case 'jpeg':
$mime_type = 'image/jpeg';
$result = imagejpeg($image_resource, $save_path);
break;
case 'png':
$mime_type = 'image/png';
$result = imagepng($image_resource, $save_path);
break;
case 'gif':
$mime_type = 'image/gif';
$result = imagegif($image_resource, $save_path);
break;
default:
imagedestroy($image_resource);
throw new ApiException('文件格式错误');
}
imagedestroy($image_resource);
if (!$result) {
throw new ApiException('文件保存失败');
}
$hash = md5_file($save_path);
$size = filesize($save_path);
$model = $this->model->where('hash', $hash)->find();
if ($model) {
unlink($save_path);
return $model->toArray();
} else {
$logic = new SystemConfigLogic();
$uploadConfig = $logic->getGroup('upload_config');
$root = Arr::getConfigValue($uploadConfig, 'local_root');
$folder = date('Ymd');
$full_dir = base_path() . DIRECTORY_SEPARATOR . $root . $folder . DIRECTORY_SEPARATOR;
if (!is_dir($full_dir)) {
mkdir($full_dir, 0777, true);
}
$object_name = bin2hex(pack('Nn', time(), random_int(1, 65535))) . ".$file_extension";
$newPath = $full_dir . $object_name;
copy($save_path, $newPath);
unlink($save_path);
$domain = Arr::getConfigValue($uploadConfig, 'local_domain');
$uri = Arr::getConfigValue($uploadConfig, 'local_uri');
$baseUrl = $domain . $uri . $folder . '/';
$info['storage_mode'] = 1;
$info['category_id'] = request()->input('category_id', 1);
$info['origin_name'] = $filename;
$info['object_name'] = $object_name;
$info['hash'] = $hash;
$info['mime_type'] = $mime_type;
$info['storage_path'] = $root . $folder . '/' . $object_name;
$info['suffix'] = $file_extension;
$info['size_byte'] = $size;
$info['size_info'] = formatBytes($size);
$info['url'] = $baseUrl . $object_name;
$this->model->create($info);
return $info;
}
}
/**
* 文件上传
* @param string $upload
* @param bool $local
* @return array
*/
public function uploadBase(string $upload = 'image', bool $local = false): array
{
$logic = new SystemConfigLogic();
$uploadConfig = $logic->getGroup('upload_config');
$type = Arr::getConfigValue($uploadConfig, 'upload_mode');
if ($local === true) {
$type = 1;
}
$result = UploadService::disk($type, $upload)->uploadFile();
$data = $result[0];
$hash = $data['unique_id'];
$hash_check = config('plugin.saiadmin.saithink.file_hash', false);
if ($hash_check) {
$model = $this->model->where('hash', $hash)->first();
if ($model) {
return $model->toArray();
}
}
$url = str_replace('\\', '/', $data['url']);
$savePath = str_replace('\\', '/', $data['save_path']);
$info['storage_mode'] = $type;
$info['category_id'] = request()->input('category_id', 1);
$info['origin_name'] = $data['origin_name'];
$info['object_name'] = $data['save_name'];
$info['hash'] = $data['unique_id'];
$info['mime_type'] = $data['mime_type'];
$info['storage_path'] = $savePath;
$info['suffix'] = $data['extension'];
$info['size_byte'] = $data['size'];
$info['size_info'] = formatBytes($data['size']);
$info['url'] = $url;
$this->model->create($info);
return $info;
}
/**
* 切片上传
* @param $data
* @return array
*/
public function chunkUpload($data): array
{
$chunkService = new ChunkUploadService();
if ($data['index'] == 0) {
$model = $this->model->where('hash', $data['hash'])->first();
if ($model) {
return $model->toArray();
} else {
return $chunkService->checkChunk($data);
}
} else {
return $chunkService->uploadChunk($data);
}
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemCategoryLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemCategory;
use plugin\saiadmin\utils\Helper;
use plugin\saiadmin\utils\Arr;
/**
* 附件分类逻辑层
*/
class SystemCategoryLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemCategory();
}
/**
* 添加数据
*/
public function add($data): mixed
{
$data = $this->handleData($data);
return $this->model->create($data);
}
/**
* 修改数据
*/
public function edit($id, $data): bool
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级分类和当前分类不能相同');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级分类设置为当前分类的子分类');
}
$model = $this->model->find($id);
if (!$model) {
throw new ApiException('数据不存在');
}
return $model->update($data);
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->whereIn('parent_id', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子分类,请先删除子分类');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['level'] = '0';
$data['parent_id'] = 0;
} else {
$parentMenu = SystemCategory::find($data['parent_id']);
$data['level'] = $parentMenu['level'] . $parentMenu['id'] . ',';
}
return $data;
}
/**
* 数据树形化
* @param array $where
* @return array
*/
public function tree(array $where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->select('id', 'id as value', 'category_name as label', 'parent_id', 'category_name', 'sort');
}
$query->orderBy('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemConfigGroupLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\ConfigCache;
use plugin\saiadmin\app\model\system\SystemConfigGroup;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemConfig;
use support\think\Db;
/**
* 参数配置分组逻辑层
*/
class SystemConfigGroupLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemConfigGroup();
}
/**
* 删除配置信息
*/
public function destroy($ids): bool
{
$id = $ids[0];
$model = $this->model->find($id);
if (!$model) {
throw new ApiException('配置数据未找到');
}
if (in_array(intval($id), [1, 2, 3])) {
throw new ApiException('系统默认分组,无法删除');
}
Db::startTrans();
try {
// 删除配置组
$model->delete();
// 删除配置组数据
$typeIds = SystemConfig::where('group_id', $id)->pluck('id')->toArray();
SystemConfig::destroy($typeIds);
ConfigCache::clearConfig($model->code);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
}
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemConfigLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\ConfigCache;
use plugin\saiadmin\app\model\system\SystemConfig;
use plugin\saiadmin\app\model\system\SystemConfigGroup;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
/**
* 参数配置逻辑层
*/
class SystemConfigLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemConfig();
}
/**
* 添加数据
* @param mixed $data
* @return mixed
*/
public function add($data): mixed
{
$result = $this->model->create($data);
$group = SystemConfigGroup::find($data['group_id']);
ConfigCache::clearConfig($group->code);
return $result;
}
/**
* 编辑数据
* @param mixed $id
* @param mixed $data
* @return bool
*/
public function edit($id, $data): bool
{
$result = parent::edit($id, $data);
$group = SystemConfigGroup::find($data['group_id']);
ConfigCache::clearConfig($group->code);
return $result;
}
/**
* 批量更新
* @param mixed $group_id
* @param mixed $config
* @return bool
*/
public function batchUpdate($group_id, $config): bool
{
$group = SystemConfigGroup::find($group_id);
if (!$group) {
throw new ApiException('配置组未找到');
}
$saveData = [];
foreach ($config as $key => $value) {
$saveData[] = [
'id' => $value['id'],
'group_id' => $group_id,
'name' => $value['name'],
'key' => $value['key'],
'value' => $value['value']
];
}
// upsert: 根据 id 更新,如果不存在则插入
$this->model->upsert($saveData, ['id'], ['value']);
ConfigCache::clearConfig($group->code);
return true;
}
/**
* 获取配置数据
* @param mixed $code
* @return array
*/
public function getData($code): array
{
$group = SystemConfigGroup::where('code', $code)->first();
if (empty($group)) {
return [];
}
$config = SystemConfig::where('group_id', $group['id'])->get()->toArray();
return $config;
}
/**
* 获取配置组
*/
public function getGroup($config): array
{
return ConfigCache::getConfig($config);
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemDeptLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDept;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\utils\Helper;
use plugin\saiadmin\utils\Arr;
use support\Db;
/**
* 部门逻辑层
*/
class SystemDeptLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDept();
}
/**
* 添加数据
*/
public function add($data): mixed
{
$data = $this->handleData($data);
return $this->model->create($data);
}
/**
* 修改数据
*/
public function edit($id, $data): mixed
{
$oldLevel = $data['level'] . $id . ',';
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级部门和当前部门不能相同');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级部门设置为当前部门的子部门');
}
$newLevel = $data['level'] . $id . ',';
$deptIds = $this->model->where('level', 'like', $oldLevel . '%')->pluck('id')->toArray();
return $this->transaction(function () use ($deptIds, $oldLevel, $newLevel, $data, $id) {
$this->model->whereIn('id', $deptIds)->update([
'level' => Db::raw("REPLACE(level, '$oldLevel', '$newLevel')")
]);
return $this->model->where('id', $id)->update($data);
});
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->whereIn('parent_id', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子部门,请先删除子部门');
} else {
$count = SystemUser::whereIn('dept_id', $ids)->count();
if ($count > 0) {
throw new ApiException('该部门下存在用户,请先删除或者转移用户');
}
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 处理上级部门
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['level'] = '0';
$data['parent_id'] = 0;
} else {
$parentMenu = SystemDept::find($data['parent_id']);
$data['level'] = $parentMenu['level'] . $parentMenu['id'] . ',';
}
return $data;
}
/**
* 数据树形化
* @param array $where
* @return array
*/
public function tree(array $where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->select('id', 'id as value', 'name as label', 'parent_id');
}
$query->orderBy('sort', 'desc');
$query->with(['leader']);
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 可操作部门
* @param array $where
* @return array
*/
public function accessDept(array $where = []): array
{
$query = $this->search($where);
$query->auth($this->adminInfo['deptList']);
$query->select('id', 'id as value', 'name as label', 'parent_id');
$query->orderBy('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemDictDataLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDictData;
use plugin\saiadmin\app\model\system\SystemDictType;
use plugin\saiadmin\app\cache\DictCache;
use plugin\saiadmin\utils\Helper;
/**
* 字典类型逻辑层
*/
class SystemDictDataLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDictData();
}
/**
* 添加数据
* @param $data
* @return mixed
*/
public function add($data): mixed
{
$type = SystemDictType::find($data['type_id']);
if (!$type) {
throw new ApiException('字典类型不存在');
}
$data['code'] = $type->code;
$model = $this->model->create($data);
DictCache::clear();
return $model->getKey();
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemDictTypeLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDictType;
use plugin\saiadmin\app\model\system\SystemDictData;
use support\think\Db;
/**
* 字典类型逻辑层
*/
class SystemDictTypeLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDictType();
}
/**
* 数据更新
*/
public function edit($id, $data): mixed
{
Db::startTrans();
try {
// 修改数据字典类型
$result = $this->model->where('id', $id)->update($data);
// 更新数据字典数据
SystemDictData::where('type_id', $id)->update(['code' => $data['code']]);
Db::commit();
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('修改数据异常,请检查');
}
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
Db::startTrans();
try {
// 删除数据字典类型
$result = $this->model->destroy($ids);
// 删除数据字典数据
$typeIds = SystemDictData::whereIn('type_id', $ids)->pluck('id')->toArray();
SystemDictData::destroy($typeIds);
Db::commit();
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
}
}
/**
* 获取全部字典
* @return array
*/
public function getDictAll(): array
{
$data = $this->model->where('status', 1)->select('id', 'name', 'code', 'remark')
->with([
'dicts' => function ($query) {
$query->where('status', 1)->select('id', 'type_id', 'label', 'value', 'color', 'code', 'sort')->orderBy('sort', 'desc');
}
])->get()->toArray();
return $this->packageDict($data, 'code');
}
/**
* 组合数据
* @param $array
* @param $field
* @return array
*/
private function packageDict($array, $field): array
{
$result = [];
foreach ($array as $item) {
if (isset($item[$field])) {
if (isset($result[$item[$field]])) {
$result[$item[$field]] = [($result[$item[$field]])];
$result[$item[$field]][] = $item['dicts'];
} else {
$result[$item[$field]] = $item['dicts'];
}
}
}
return $result;
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemLoginLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemLoginLog;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\utils\Helper;
use support\Db;
/**
* 登录日志逻辑层
*/
class SystemLoginLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemLoginLog();
}
/**
* 登录统计图表
* @return array
*/
public function loginChart(): array
{
$sql = "
SELECT
d.date AS login_date,
COUNT(l.login_time) AS login_count
FROM
(SELECT CURDATE() - INTERVAL (a.N) DAY AS date
FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
) d
LEFT JOIN sa_system_login_log l
ON DATE(l.login_time) = d.date
GROUP BY d.date
ORDER BY d.date ASC;
";
$data = Db::select($sql);
return [
'login_count' => array_column($data, 'login_count'),
'login_date' => array_column($data, 'login_date'),
];
}
/**
* 登录统计图表
* @return array
*/
public function loginBarChart(): array
{
$sql = "
SELECT
-- 拼接成 YYYY-MM 格式,例如 2023-01
CONCAT(LPAD(m.month_num, 2, '0'), '月') AS login_month,
COUNT(l.login_time) AS login_count
FROM
-- 生成 1 到 12 的月份数字
(SELECT 1 AS month_num UNION ALL SELECT 2 UNION ALL SELECT 3
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12) m
LEFT JOIN sa_system_login_log l
-- 关联条件:年份等于今年 且 月份等于生成的数字
ON YEAR(l.login_time) = YEAR(CURDATE())
AND MONTH(l.login_time) = m.month_num
GROUP BY
m.month_num
ORDER BY
m.month_num ASC;
";
$data = Db::select($sql);
return [
'login_count' => array_column($data, 'login_count'),
'login_month' => array_column($data, 'login_month'),
];
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemMailLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemMail;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 邮件模型逻辑层
*/
class SystemMailLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemMail();
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemMenuLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemMenu;
use plugin\saiadmin\app\model\system\SystemRoleMenu;
use plugin\saiadmin\app\model\system\SystemUserRole;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Arr;
use plugin\saiadmin\utils\Helper;
/**
* 菜单逻辑层
*/
class SystemMenuLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemMenu();
}
/**
* 数据添加
*/
public function add($data): mixed
{
$data = $this->handleData($data);
return $this->model->create($data);
}
/**
* 数据修改
*/
public function edit($id, $data): mixed
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('不能设置父级为自身');
}
return $this->model->where('id', $id)->update($data);
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->whereIn('parent_id', $ids)->count();
if ($num > 0) {
throw new ApiException('该菜单下存在子菜单,请先删除子菜单');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 处理上级菜单
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['parent_id'] = 0;
}
return $data;
}
/**
* 数据树形化
* @param $where
* @return array
*/
public function tree($where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->select('id', 'id as value', 'name as label', 'parent_id', 'type');
}
$query->orderBy('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 权限菜单
* @return array
*/
public function auth(): array
{
$roleLogic = new SystemRoleLogic();
$role_ids = Arr::getArrayColumn($this->adminInfo['roleList'], 'id');
$roles = $roleLogic->getMenuIdsByRoleIds($role_ids);
$ids = $this->filterMenuIds($roles);
$query = $this->model
->select('id', 'id as value', 'name as label', 'parent_id', 'type')
->where('status', 1)
->whereIn('id', $ids)
->orderBy('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 获取全部菜单
*/
public function getAllMenus(): array
{
$query = $this->search(['status' => 1, 'type' => [1, 2, 4]])->orderBy('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeArtdMenus($data);
}
/**
* 获取全部权限
* @return array
*/
public function getAllAuth(): array
{
return SystemMenu::where('type', 3)
->where('status', 1)
->pluck('slug')
->toArray();
}
/**
* 根据角色获取权限
* @param $roleIds
* @return array
*/
public function getAuthByRole($roleIds): array
{
$menuId = SystemRoleMenu::whereIn('role_id', $roleIds)->pluck('menu_id')->toArray();
return SystemMenu::distinct()
->where('type', 3)
->where('status', 1)
->whereIn('id', array_unique($menuId))
->pluck('slug')
->toArray();
}
/**
* 根据角色获取菜单
* @param $roleIds
* @return array
*/
public function getMenuByRole($roleIds): array
{
$menuId = SystemRoleMenu::whereIn('role_id', $roleIds)->pluck('menu_id')->toArray();
$data = SystemMenu::distinct()
->where('status', 1)
->whereIn('type', [1, 2, 4])
->whereIn('id', array_unique($menuId))
->orderBy('sort', 'desc')
->get()
->toArray();
return Helper::makeArtdMenus($data);
}
/**
* 过滤通过角色查询出来的菜单id列表,并去重
* @param array $roleData
* @return array
*/
public function filterMenuIds(array &$roleData): array
{
$ids = [];
foreach ($roleData as $val) {
foreach ($val['menus'] as $menu) {
$ids[] = $menu['id'];
}
}
unset($roleData);
return array_unique($ids);
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemOperLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemOperLog;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 操作日志逻辑层
*/
class SystemOperLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemOperLog();
}
/**
* 获取自己的操作日志
* @param mixed $where
* @return array
*/
public function getOwnOperLogList($where): array
{
$query = $this->search($where);
$query->select('id', 'username', 'method', 'router', 'service_name', 'ip', 'ip_location', 'create_time');
return $this->getList($query);
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemPostLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemPost;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\service\OpenSpoutWriter;
use OpenSpout\Reader\XLSX\Reader;
/**
* 岗位管理逻辑层
*/
class SystemPostLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemPost();
}
/**
* 可操作岗位
* @param array $where
* @return array
*/
public function accessPost(array $where = []): array
{
$query = $this->search($where);
$query->select('id', 'id as value', 'name as label', 'name', 'code');
return $this->getAll($query);
}
/**
* 导入数据
*/
public function import($file)
{
$path = $this->getImport($file);
$reader = new Reader();
try {
$reader->open($path);
$data = [];
foreach ($reader->getSheetIterator() as $sheet) {
$isHeader = true;
foreach ($sheet->getRowIterator() as $row) {
if ($isHeader) {
$isHeader = false;
continue;
}
$cells = $row->getCells();
$data[] = [
'name' => $cells[0]->getValue(),
'code' => $cells[1]->getValue(),
'sort' => $cells[2]->getValue(),
'status' => $cells[3]->getValue(),
];
}
}
$this->saveAll($data);
} catch (\Exception $e) {
throw new ApiException('导入文件错误,请上传正确的文件格式xlsx');
}
}
/**
* 导出数据
*/
public function export($where = [])
{
$query = $this->search($where)->pluck('id', 'name', 'code', 'sort', 'status', 'create_time');
$data = $this->getAll($query);
$file_name = '岗位数据.xlsx';
$header = ['编号', '岗位名称', '岗位标识', '排序', '状态', '创建时间'];
$filter = [
'status' => [
['value' => 1, 'label' => '正常'],
['value' => 2, 'label' => '禁用']
]
];
$writer = new OpenSpoutWriter($file_name);
$writer->setWidth([15, 15, 20, 15, 15, 25]);
$writer->setHeader($header);
$writer->setData($data, null, $filter);
$file_path = $writer->returnFile();
return response()->download($file_path, urlencode($file_name));
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemRoleLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\UserMenuCache;
use plugin\saiadmin\app\model\system\SystemRole;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
use support\think\Cache;
use support\think\Db;
/**
* 角色逻辑层
*/
class SystemRoleLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemRole();
}
/**
* 添加数据
*/
public function add($data): mixed
{
$data = $this->handleData($data);
return $this->model->create($data);
}
/**
* 修改数据
*/
public function edit($id, $data): bool
{
$model = $this->model->find($id);
if (!$model) {
throw new ApiException('数据不存在');
}
$data = $this->handleData($data);
return $model->update($data);
}
/**
* 删除数据
*/
public function destroy($ids): bool
{
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
$num = SystemRole::where('level', '>=', $maxLevel)->whereIn('id', $ids)->count();
if ($num > 0) {
throw new ApiException('不能操作比当前账户职级高的角色');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
if ($data['level'] >= $maxLevel) {
throw new ApiException('不能操作比当前账户职级高的角色');
}
return $data;
}
/**
* 可操作角色
* @param array $where
* @return array
*/
public function accessRole(array $where = []): array
{
$query = $this->search($where);
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
$query->where('level', '<', $maxLevel);
$query->orderBy('sort', 'desc');
return $this->getAll($query);
}
/**
* 根据角色数组获取菜单
* @param $ids
* @return array
*/
public function getMenuIdsByRoleIds($ids): array
{
if (empty($ids))
return [];
return $this->model->whereIn('id', $ids)->with([
'menus' => function ($query) {
$query->where('status', 1)->orderBy('sort', 'desc');
}
])->get()->toArray();
}
/**
* 根据角色获取菜单
* @param $id
* @return array
*/
public function getMenuByRole($id): array
{
$role = $this->model->find($id);
$menus = $role->menus ?: [];
return [
'id' => $id,
'menus' => $menus
];
}
/**
* 保存菜单权限
* @param $id
* @param $menu_ids
* @return mixed
*/
public function saveMenuPermission($id, $menu_ids): mixed
{
return $this->transaction(function () use ($id, $menu_ids) {
$role = $this->model->find($id);
if ($role) {
$role->menus()->sync($menu_ids);
}
$cache = config('plugin.saiadmin.saithink.button_cache');
$tag = $cache['role'] . $id;
Cache::tag($tag)->clear(); // 清理权限缓存-角色TAG
UserMenuCache::clearMenuCache(); // 清理菜单缓存
return true;
});
}
}
================================================
FILE: src/orm/eloquent/app/logic/system/SystemUserLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\UserAuthCache;
use plugin\saiadmin\app\cache\UserInfoCache;
use plugin\saiadmin\app\cache\UserMenuCache;
use plugin\saiadmin\app\model\system\SystemDept;
use plugin\saiadmin\app\model\system\SystemRole;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use Webman\Event\Event;
use Tinywan\Jwt\JwtToken;
use Illuminate\Support\Arr;
/**
* 用户信息逻辑层
*/
class SystemUserLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemUser();
}
/**
* 分页数据列表
* @param mixed $where
* @return array
*/
public function indexList($where): array
{
$query = $this->search($where);
$query->with(['depts']);
$query->auth($this->adminInfo['deptList']);
return $this->getList($query);
}
/**
* 用户列表数据
* @param mixed $where
* @return array
*/
public function openUserList($where): array
{
$query = $this->search($where);
$query->select('id', 'username', 'realname', 'avatar', 'phone', 'email');
return $this->getList($query);
}
/**
* 读取用户信息
* @param mixed $id
* @return array
*/
public function getUser($id): array
{
$admin = $this->model->find($id);
$data = $admin->makeHidden(['password'])->toArray();
$data['roleList'] = $admin->roles->toArray() ?: [];
$data['postList'] = $admin->posts->toArray() ?: [];
$data['deptList'] = $admin->depts ? $admin->depts->toArray() : [];
return $data;
}
/**
* 读取数据
* @param $id
* @return array
*/
public function read($id): array
{
$data = $this->getUser($id);
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
}
return $data;
}
/**
* 添加数据
* @param $data
* @return mixed
*/
public function add($data): mixed
{
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
return $this->transaction(function () use ($data) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
}
}
unset($data['password_confirm']);
unset($data['role_ids']);
unset($data['post_ids']);
$user = SystemUser::create($data);
$user->roles()->sync($role_ids);
$user->posts()->sync($post_ids);
return $user;
});
}
/**
* 修改数据
* @param $id
* @param $data
* @return mixed
*/
public function edit($id, $data): mixed
{
unset($data['password']);
return $this->transaction(function () use ($data, $id) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
// 仅可修改当前部门和子部门的用户
$query = $this->model->where('id', $id);
$query->auth($this->adminInfo['deptList']);
$user = $query->first();
if (!$user) {
throw new ApiException('没有权限操作该数据');
}
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
}
}
unset($data['password_confirm']);
unset($data['role_ids']);
unset($data['post_ids']);
$result = parent::edit($id, $data);
if ($result) {
$user->roles()->sync($role_ids);
$user->posts()->sync($post_ids);
UserInfoCache::clearUserInfo($id);
UserAuthCache::clearUserAuth($id);
UserMenuCache::clearUserMenu($id);
}
return $result;
});
}
/**
* 删除数据
* @param $ids
* @return bool
*/
public function destroy($ids): bool
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
}
$ids = $ids[0];
}
if ($ids == 1) {
throw new ApiException('超级管理员禁止删除');
}
$query = $this->model->where('id', $ids);
$query->auth($this->adminInfo['deptList']);
$user = $query->first();
if (!$user) {
throw new ApiException('没有权限操作该数据');
}
if ($this->adminInfo['id'] > 1) {
$role_ids = $user->roles->toArray() ?: [];
if (!empty($role_ids)) {
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], array_column($role_ids, 'id'))) {
throw new ApiException('没有权限操作该角色数据');
}
}
}
UserInfoCache::clearUserInfo($ids);
UserAuthCache::clearUserAuth($ids);
UserMenuCache::clearUserMenu($ids);
return parent::destroy($ids);
}
/**
* 用户登录
* @param string $username
* @param string $password
* @param string $type
* @return array
*/
public function login(string $username, string $password, string $type): array
{
$adminInfo = $this->model->where('username', $username)->first();
$status = 1;
$message = '登录成功';
if (!$adminInfo) {
$message = '账号或密码错误,请重新输入!';
throw new ApiException($message);
}
if ($adminInfo->status === 2) {
$status = 0;
$message = '您已被禁止登录!';
}
if (!password_verify($password, $adminInfo->password)) {
$status = 0;
$message = '账号或密码错误,请重新输入!';
}
if ($status === 0) {
// 登录事件
Event::emit('user.login', compact('username', 'status', 'message'));
throw new ApiException($message);
}
$adminInfo->login_time = date('Y-m-d H:i:s');
$adminInfo->login_ip = request()->getRealIp();
$adminInfo->save();
$access_exp = config('plugin.saiadmin.saithink.access_exp', 3 * 3600);
$token = JwtToken::generateToken([
'access_exp' => $access_exp,
'id' => $adminInfo->id,
'username' => $adminInfo->username,
'type' => $type,
'plat' => 'saiadmin',
]);
// 登录事件
$admin_id = $adminInfo->id;
Event::emit('user.login', compact('username', 'status', 'message', 'admin_id'));
return $token;
}
/**
* 更新资料
* @param mixed $id
* @param mixed $data
* @return bool
*/
public function updateInfo($id, $data): bool
{
$allowFields = ['realname', 'gender', 'phone', 'email', 'avatar', 'signed'];
$updateData = Arr::only($data, $allowFields);
$this->model->where('id', $id)->update($updateData);
return true;
}
/**
* 密码修改
* @param $adminId
* @param $oldPassword
* @param $newPassword
* @return bool
*/
public function modifyPassword($adminId, $oldPassword, $newPassword): bool
{
$model = $this->model->find($adminId);
if (password_verify($oldPassword, $model->password)) {
$model->password = password_hash($newPassword, PASSWORD_DEFAULT);
return $model->save();
} else {
throw new ApiException('原密码错误');
}
}
/**
* 修改数据
*/
public function authEdit($id, $data)
{
if ($this->adminInfo['id'] > 1) {
// 判断用户是否可以操作
$query = SystemUser::where('id', $id);
$query->auth($this->adminInfo['deptList']);
$user = $query->first();
if (!$user) {
throw new ApiException('没有权限操作该数据');
}
}
parent::edit($id, $data);
}
/**
* 部门保护
* @param $dept
* @param $dept_id
* @return bool
*/
public function deptProtect($dept, $dept_id): bool
{
// 部门保护
$deptIds = [$dept['id']];
$deptLevel = $dept['level'] . $dept['id'] . ',';
$dept_ids = SystemDept::where('level', 'like', $deptLevel . '%')->pluck('id')->toArray();
$deptIds = array_merge($deptIds, $dept_ids);
if (!in_array($dept_id, $deptIds)) {
return false;
}
return true;
}
/**
* 越权保护
* @param $roleList
* @param $role_ids
* @return bool
*/
public function roleProtect($roleList, $role_ids): bool
{
// 越权保护
$levelArr = array_column($roleList, 'level');
$maxLevel = max($levelArr);
$currentLevel = SystemRole::whereIn('id', $role_ids)->max('level');
if ($currentLevel >= $maxLevel) {
return false;
}
return true;
}
}
================================================
FILE: src/orm/eloquent/app/logic/tool/CrontabLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use plugin\saiadmin\app\model\tool\CrontabLog;
use plugin\saiadmin\basic\eloquent\BaseLogic;
/**
* 定时任务日志逻辑层
*/
class CrontabLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new CrontabLog();
}
}
================================================
FILE: src/orm/eloquent/app/logic/tool/CrontabLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Webman\Channel\Client as ChannelClient;
use plugin\saiadmin\app\model\tool\Crontab;
use plugin\saiadmin\app\model\tool\CrontabLog;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
/**
* 定时任务逻辑层
*/
class CrontabLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new Crontab();
}
/**
* 添加任务
*/
public function add($data): bool
{
$second = $data['second'];
$minute = $data['minute'];
$hour = $data['hour'];
$week = $data['week'];
$day = $data['day'];
$month = $data['month'];
// 规则处理
$rule = match ($data['task_style']) {
1 => "0 {$minute} {$hour} * * *",
2 => "0 {$minute} * * * *",
3 => "0 {$minute} */{$hour} * * *",
4 => "0 */{$minute} * * * *",
5 => "*/{$second} * * * * *",
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
};
// 定时任务模型新增
$model = Crontab::create([
'name' => $data['name'],
'type' => $data['type'],
'task_style' => $data['task_style'],
'rule' => $rule,
'target' => $data['target'],
'parameter' => $data['parameter'],
'status' => $data['status'],
'remark' => $data['remark'],
]);
$id = $model->getKey();
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
return true;
}
/**
* 修改任务
*/
public function edit($id, $data): bool
{
$second = $data['second'];
$minute = $data['minute'];
$hour = $data['hour'];
$week = $data['week'];
$day = $data['day'];
$month = $data['month'];
// 规则处理
$rule = match ($data['task_style']) {
1 => "0 {$minute} {$hour} * * *",
2 => "0 {$minute} * * * *",
3 => "0 {$minute} */{$hour} * * *",
4 => "0 */{$minute} * * * *",
5 => "*/{$second} * * * * *",
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
};
// 查询任务数据
$model = $this->model->find($id);
if (!$model) {
throw new ApiException('数据不存在');
}
$result = $model->update([
'name' => $data['name'],
'type' => $data['type'],
'task_style' => $data['task_style'],
'rule' => $rule,
'target' => $data['target'],
'parameter' => $data['parameter'],
'status' => $data['status'],
'remark' => $data['remark'],
]);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
}
// 修改任务数据
return $result;
}
/**
* 删除定时任务
* @param $ids
* @return bool
* @throws Exception
*/
public function destroy($ids): bool
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
}
$ids = $ids[0];
}
$result = parent::destroy($ids);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $ids]);
}
return $result;
}
/**
* 修改状态
* @param $id
* @param $status
* @return bool
*/
public function changeStatus($id, $status): bool
{
$model = $this->model->find($id);
if (!$model) {
throw new ApiException('数据不存在');
}
$result = $model->update(['status' => $status]);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
}
return $result;
}
/**
* 执行定时任务
* @param $id
* @return bool
*/
public function run($id): bool
{
$info = $this->model->where('status', 1)->find($id);
if (!$info) {
return false;
}
$data['crontab_id'] = $info->id;
$data['name'] = $info->name;
$data['target'] = $info->target;
$data['parameter'] = $info->parameter;
switch ($info->type) {
case 1:
// URL任务GET
$httpClient = new Client([
'timeout' => 5,
'verify' => false,
]);
try {
$httpClient->request('GET', $info->target);
$data['status'] = 1;
CrontabLog::create($data);
return true;
} catch (GuzzleException $e) {
$data['status'] = 2;
$data['exception_info'] = $e->getMessage();
CrontabLog::create($data);
return false;
}
case 2:
// URL任务POST
$httpClient = new Client([
'timeout' => 5,
'verify' => false,
]);
try {
$res = $httpClient->request('POST', $info->target, [
'form_params' => json_decode($info->parameter ?? '', true)
]);
$data['status'] = 1;
$data['exception_info'] = $res->getBody();
CrontabLog::create($data);
return true;
} catch (GuzzleException $e) {
$data['status'] = 2;
$data['exception_info'] = $e->getMessage();
CrontabLog::create($data);
return false;
}
case 3:
// 类任务
$class_name = $info->target;
$method_name = 'run';
$class = new $class_name;
if (method_exists($class, $method_name)) {
$return = $class->$method_name($info->parameter);
$data['status'] = 1;
$data['exception_info'] = $return;
CrontabLog::create($data);
return true;
} else {
$data['status'] = 2;
$data['exception_info'] = '类:' . $class_name . ',方法:run,未找到';
CrontabLog::create($data);
return false;
}
default:
return false;
}
}
}
================================================
FILE: src/orm/eloquent/app/logic/tool/GenerateColumnsLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use plugin\saiadmin\app\model\tool\GenerateColumns;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 代码生成业务字段逻辑层
*/
class GenerateColumnsLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new GenerateColumns();
}
public function saveExtra($data)
{
$default_column = ['create_time', 'update_time', 'created_by', 'updated_by', 'delete_time', 'remark'];
// 组装数据
foreach ($data as $k => $item) {
if ($item['column_name'] == 'delete_time') {
continue;
}
$column = [
'table_id' => $item['table_id'],
'column_name' => $item['column_name'],
'column_comment' => $item['column_comment'],
'column_type' => $item['column_type'],
'default_value' => $item['default_value'],
'is_pk' => ($item['column_key'] == 'PRI') ? 2 : 1,
'is_required' => $item['is_nullable'] == 'NO' ? 2 : 1,
'query_type' => 'eq',
'view_type' => 'input',
'sort' => count($data) - $k,
'options' => $item['options'] ?? null
];
// 设置默认选项
if (!in_array($item['column_name'], $default_column) && empty($item['column_key'])) {
$column = array_merge(
$column,
[
'is_insert' => 2,
'is_edit' => 2,
'is_list' => 2,
'is_query' => 1,
'is_sort' => 1,
]
);
}
$keyList = [
'column_comment',
'column_type',
'default_value',
'is_pk',
'is_required',
'is_insert',
'is_edit',
'is_list',
'is_query',
'is_sort',
'query_type',
'view_type',
'dict_type',
'options',
'sort',
'is_cover'
];
foreach ($keyList as $key) {
if (isset($item[$key]))
$column[$key] = $item[$key];
}
GenerateColumns::create($this->fieldDispose($column));
}
}
public function update($data, $where)
{
$data['is_insert'] = $data['is_insert'] ? 2 : 1;
$data['is_edit'] = $data['is_edit'] ? 2 : 1;
$data['is_list'] = $data['is_list'] ? 2 : 1;
$data['is_query'] = $data['is_query'] ? 2 : 1;
$data['is_sort'] = $data['is_sort'] ? 2 : 1;
$data['is_required'] = $data['is_required'] ? 2 : 1;
$this->model->where($where)->update($data);
}
private function fieldDispose(array $column): array
{
$object = new class {
public function viewTypeDispose(&$column): void
{
switch ($column['column_type']) {
case 'varchar':
$column['view_type'] = 'input';
break;
// 富文本
case 'text':
case 'longtext':
$column['is_list'] = 1;
$column['is_query'] = 1;
$column['view_type'] = 'editor';
$options = [
'height' => 400,
];
$column['options'] = $options;
break;
// 日期字段
case 'datetime':
$column['view_type'] = 'date';
$options = [
'mode' => 'datetime'
];
$column['options'] = $options;
$column['query_type'] = 'between';
break;
case 'date':
$column['view_type'] = 'date';
$options = [
'mode' => 'date'
];
$column['options'] = $options;
$column['query_type'] = 'between';
break;
}
}
public function columnName(&$column): void
{
if (stristr($column['column_name'], 'name')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'like';
}
if (stristr($column['column_name'], 'title')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'like';
}
if (stristr($column['column_name'], 'type')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'eq';
}
if (stristr($column['column_name'], 'image')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadImage';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if (stristr($column['column_name'], 'file')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadFile';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if (stristr($column['column_name'], 'attach')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadFile';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if ($column['column_name'] === 'sort') {
$column['view_type'] = 'inputNumber';
}
if ($column['column_name'] === 'status') {
$column['view_type'] = 'radio';
$column['dict_type'] = 'data_status';
}
if (stristr($column['column_name'], 'is_')) {
$column['view_type'] = 'radio';
$column['dict_type'] = 'yes_or_no';
}
}
};
if (!$column['is_cover']) {
$object->viewTypeDispose($column);
$object->columnName($column);
}
$column['options'] = json_encode($column['options'], JSON_UNESCAPED_UNICODE);
return $column;
}
}
================================================
FILE: src/orm/eloquent/app/logic/tool/GenerateTablesLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use plugin\saiadmin\app\cache\UserMenuCache;
use plugin\saiadmin\app\logic\system\DatabaseLogic;
use plugin\saiadmin\app\model\system\SystemMenu;
use plugin\saiadmin\app\model\tool\GenerateTables;
use plugin\saiadmin\app\model\tool\GenerateColumns;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\utils\Helper;
use plugin\saiadmin\utils\code\CodeZip;
use plugin\saiadmin\utils\code\CodeEngine;
/**
* 代码生成业务逻辑层
*/
class GenerateTablesLogic extends BaseLogic
{
protected $columnLogic = null;
protected $dataLogic = null;
/**
* 构造函数
*/
public function __construct()
{
$this->model = new GenerateTables();
$this->columnLogic = new GenerateColumnsLogic();
$this->dataLogic = new DatabaseLogic();
}
public function read($id): GenerateTables
{
$data = parent::read($id);
$data['options'] = $data['options'] ? json_decode($data['options'], true) : [];
return $data;
}
/**
* 删除表和字段信息
* @param $ids
* @return bool
*/
public function destroy($ids): bool
{
return $this->transaction(function () use ($ids) {
parent::destroy($ids);
GenerateColumns::whereIn('table_id', $ids)->delete();
return true;
});
}
/**
* 装载表信息
* @param $names
* @param $source
* @return void
*/
public function loadTable($names, $source): void
{
$data = config('database.connections');
$config = $data[$source];
if (!$config) {
throw new ApiException('数据库配置读取失败');
}
$prefix = $config['prefix'] ?? '';
foreach ($names as $item) {
$class_name = $item['name'];
if (!empty($prefix)) {
$class_name = Helper::str_replace_once($prefix, '', $class_name);
}
$class_name = Helper::camel($class_name);
$tableInfo = [
'table_name' => $item['name'],
'table_comment' => $item['comment'],
'class_name' => $class_name,
'business_name' => Helper::get_business($item['name']),
'belong_menu_id' => 80,
'menu_name' => $item['comment'],
'tpl_category' => 'single',
'template' => 'app',
'stub' => 'think',
'namespace' => '',
'package_name' => '',
'source' => $source,
'generate_menus' => 'index,save,update,read,destroy',
];
$model = GenerateTables::create($tableInfo);
$columns = $this->dataLogic->getColumnList($item['name'], $source);
foreach ($columns as &$column) {
$column['table_id'] = $model->id;
$column['is_cover'] = false;
}
$this->columnLogic->saveExtra($columns);
}
}
/**
* 同步表字段信息
* @param $id
* @return void
*/
public function sync($id)
{
$model = $this->model->find($id);
// 拉取已有数据表信息
$queryModel = $this->columnLogic->model->where('table_id', $id);
$columnLogicData = $this->columnLogic->getAll($queryModel);
$columnLogicList = [];
foreach ($columnLogicData as $item) {
$columnLogicList[$item['column_name']] = $item;
}
$this->columnLogic->where('table_id', $id)->delete();
$columns = $this->dataLogic->getColumnList($model->table_name, $model->source ?? '');
foreach ($columns as &$column) {
$column['table_id'] = $model->id;
$column['is_cover'] = false;
if (isset($columnLogicList[$column['column_name']])) {
// 存在历史信息的情况
$getcolumnLogicItem = $columnLogicList[$column['column_name']];
if ($getcolumnLogicItem['column_type'] == $column['column_type']) {
$column['is_cover'] = true;
foreach ($getcolumnLogicItem as $key => $item) {
$array = [
'column_comment',
'column_type',
'default_value',
'is_pk',
'is_required',
'is_insert',
'is_edit',
'is_list',
'is_query',
'is_sort',
'query_type',
'view_type',
'dict_type',
'options',
'sort',
'is_cover'
];
if (in_array($key, $array)) {
if ($key == 'options') {
$column[$key] = json_decode($item, true);
} else {
$column[$key] = $item;
}
}
}
}
}
}
$this->columnLogic->saveExtra($columns);
}
/**
* 代码预览
* @param $id
* @return array
*/
public function preview($id): array
{
$data = $this->renderData($id);
$codeEngine = new CodeEngine($data);
$controllerContent = $codeEngine->renderContent('php', 'controller.stub');
$logicContent = $codeEngine->renderContent('php', 'logic.stub');
$modelContent = $codeEngine->renderContent('php', 'model.stub');
$validateContent = $codeEngine->renderContent('php', 'validate.stub');
$sqlContent = $codeEngine->renderContent('sql', 'sql.stub');
$indexContent = $codeEngine->renderContent('vue', 'index.stub');
$editContent = $codeEngine->renderContent('vue', 'edit-dialog.stub');
$searchContent = $codeEngine->renderContent('vue', 'table-search.stub');
$apiContent = $codeEngine->renderContent('ts', 'api.stub');
// 返回生成内容
return [
[
'tab_name' => 'controller.php',
'name' => 'controller',
'lang' => 'php',
'code' => $controllerContent
],
[
'tab_name' => 'logic.php',
'name' => 'logic',
'lang' => 'php',
'code' => $logicContent
],
[
'tab_name' => 'model.php',
'name' => 'model',
'lang' => 'php',
'code' => $modelContent
],
[
'tab_name' => 'validate.php',
'name' => 'validate',
'lang' => 'php',
'code' => $validateContent
],
[
'tab_name' => 'sql.sql',
'name' => 'sql',
'lang' => 'sql',
'code' => $sqlContent
],
[
'tab_name' => 'index.vue',
'name' => 'index',
'lang' => 'html',
'code' => $indexContent
],
[
'tab_name' => 'edit-dialog.vue',
'name' => 'edit-dialog',
'lang' => 'html',
'code' => $editContent
],
[
'tab_name' => 'table-search.vue',
'name' => 'table-search',
'lang' => 'html',
'code' => $searchContent
],
[
'tab_name' => 'api.ts',
'name' => 'api',
'lang' => 'javascript',
'code' => $apiContent
]
];
}
/**
* 生成到模块
* @param $id
*/
public function genModule($id)
{
$data = $this->renderData($id);
// 生成文件到模块
$codeEngine = new CodeEngine($data);
$codeEngine->generateBackend('controller', $codeEngine->renderContent('php', 'controller.stub'));
$codeEngine->generateBackend('logic', $codeEngine->renderContent('php', 'logic.stub'));
$codeEngine->generateBackend('model', $codeEngine->renderContent('php', 'model.stub'));
$codeEngine->generateBackend('validate', $codeEngine->renderContent('php', 'validate.stub'));
$codeEngine->generateFrontend('index', $codeEngine->renderContent('vue', 'index.stub'));
$codeEngine->generateFrontend('edit-dialog', $codeEngine->renderContent('vue', 'edit-dialog.stub'));
$codeEngine->generateFrontend('table-search', $codeEngine->renderContent('vue', 'table-search.stub'));
$codeEngine->generateFrontend('api', $codeEngine->renderContent('ts', 'api.stub'));
}
/**
* 处理数据
* @param $id
* @return array
*/
protected function renderData($id): array
{
$table = $this->model->find($id);
if (!in_array($table['template'], ["plugin", "app"])) {
throw new ApiException('应用类型必须为plugin或者app');
}
if (empty($table['namespace'])) {
throw new ApiException('请先设置应用名称');
}
$columns = $this->columnLogic->where('table_id', $id)
->orderBy('sort', 'desc')
->get()
->toArray();
$pk = 'id';
foreach ($columns as &$column) {
if ($column['is_pk'] == 2) {
$pk = $column['column_name'];
}
if ($column['column_name'] == 'delete_time') {
unset($column['column_name']);
}
$column['options'] = json_decode($column['options'], true);
}
// 处理特殊变量
if ($table['template'] == 'plugin') {
$namespace_start = "plugin\\" . $table['namespace'] . "\\app\\admin\\";
$namespace_start_model = "plugin\\" . $table['namespace'] . "\\app\\";
$namespace_end = "\\" . $table['package_name'];
$url_path = 'app/' . $table['namespace'] . '/admin/' . $table['package_name'] . '/' . $table['class_name'];
$route = 'app/';
} else {
$namespace_start = "app\\" . $table['namespace'] . "\\";
$namespace_start_model = "app\\" . $table['namespace'] . "\\";
$namespace_end = "\\" . $table['package_name'];
$url_path = $table['namespace'] . '/' . $table['package_name'] . '/' . $table['class_name'];
$route = '';
}
$config = config('database');
$data = $table->toArray();
$data['pk'] = $pk;
$data['namespace_start'] = $namespace_start;
$data['namespace_start_model'] = $namespace_start_model;
$data['namespace_end'] = $namespace_end;
$data['url_path'] = $url_path;
$data['route'] = $route;
$data['tables'] = [$data];
$data['columns'] = $columns;
$data['db_source'] = $config['default'] ?? 'mysql';
$data['options'] = $data['options'] ? json_decode($data['options'], true) : [];
return $data;
}
/**
* 生成到模块
*/
public function generateFile($id)
{
$table = $this->model->find($id);
if (!$table) {
throw new ApiException('请选择要生成的表');
}
$debug = config('app.debug', true);
if (!$debug) {
throw new ApiException('非调试模式下,不允许生成文件');
}
$this->updateMenu($table);
$this->genModule($id);
UserMenuCache::clearMenuCache();
}
/**
* 代码生成下载
*/
public function generate($idsArr): array
{
$zip = new CodeZip();
$tables = $this->model->whereIn('id', $idsArr)->get()->toArray();
foreach ($idsArr as $table_id) {
$data = $this->renderData($table_id);
$data['tables'] = $tables;
$codeEngine = new CodeEngine($data);
$codeEngine->generateTemp();
}
$filename = 'saiadmin.zip';
$download = $zip->compress();
return compact('filename', 'download');
}
/**
* 处理菜单列表
* @param $tables
*/
public function updateMenu($tables)
{
/*不存在的情况下进行新建操作*/
$url_path = $tables['namespace'] . ":" . $tables['package_name'] . ':' . $tables['business_name'];
$code = $tables['namespace'] . "/" . $tables['package_name'] . '/' . $tables['business_name'];
$path = $tables['package_name'] . '/' . $tables['business_name'];
$component = $tables['namespace'] . "/" . $tables['package_name'] . '/' . $tables['business_name'];
/*先获取一下已有的路由中是否包含当前ID的路由的核心信息*/
$model = new SystemMenu();
$tableMenu = $model->where('generate_id', $tables['id'])->first();
$fistMenu = [
'parent_id' => $tables['belong_menu_id'],
'name' => $tables['menu_name'],
'code' => $code,
'path' => $path,
'icon' => 'ri:home-2-line',
'component' => "/plugin/$component/index",
'type' => 2,
'sort' => 100,
'is_iframe' => 2,
'is_keep_alive' => 2,
'is_hidden' => 2,
'is_fixed_tab' => 2,
'is_full_page' => 2,
'generate_id' => $tables['id']
];
if (!$tableMenu) {
$temp = SystemMenu::create($fistMenu);
$fistMenuId = $temp->id;
} else {
$fistMenu['id'] = $tableMenu['id'];
$tableMenu->update($fistMenu);
$fistMenuId = $tableMenu['id'];
}
/*开始进行子权限的判定操作*/
$childNodes = [
['name' => '列表', 'key' => 'index'],
['name' => '保存', 'key' => 'save'],
['name' => '更新', 'key' => 'update'],
['name' => '读取', 'key' => 'read'],
['name' => '删除', 'key' => 'destroy'],
];
foreach ($childNodes as $node) {
$nodeData = $model->where('parent_id', $fistMenuId)->where('generate_key', $node['key'])->first();
$childNodeData = [
'parent_id' => $fistMenuId,
'name' => $node['name'],
'slug' => "$url_path:{$node['key']}",
'type' => 3,
'sort' => 100,
'is_iframe' => 2,
'is_keep_alive' => 2,
'is_hidden' => 2,
'is_fixed_tab' => 2,
'is_full_page' => 2,
'generate_key' => $node['key']
];
if ($nodeData) {
$childNodeData['id'] = $nodeData['id'];
$nodeData->update($childNodeData);
} else {
SystemMenu::create($childNodeData);
}
}
}
/**
* 获取数据表字段信息
* @param $table_id
* @return mixed
*/
public function getTableColumns($table_id): mixed
{
$query = $this->columnLogic->where('table_id', $table_id);
$data = $this->columnLogic->getAll($query);
foreach ($data as $key => $value) {
$data[$key]['options'] = json_decode($value['options'], true);
}
return $data;
}
/**
* 编辑数据
* @param $id
* @param $data
* @return mixed
*/
public function edit($id, $data): mixed
{
$columns = $data['columns'];
unset($data['columns']);
if (!empty($data['belong_menu_id'])) {
$data['belong_menu_id'] = is_array($data['belong_menu_id']) ? array_pop($data['belong_menu_id']) : $data['belong_menu_id'];
} else {
$data['belong_menu_id'] = 0;
}
$data['generate_menus'] = implode(',', $data['generate_menus']);
if (empty($data['options'])) {
unset($data['options']);
}
$data['options'] = json_encode($data['options']);
// 更新业务表
$this->model->where('id', $id)->update($data);
// 更新业务字段表(批量)
$updateData = [];
foreach ($columns as $column) {
$column['is_required'] = $column['is_required'] ? 2 : 1;
$column['is_insert'] = $column['is_insert'] ? 2 : 1;
$column['is_edit'] = $column['is_edit'] ? 2 : 1;
$column['is_list'] = $column['is_list'] ? 2 : 1;
$column['is_query'] = $column['is_query'] ? 2 : 1;
$column['is_sort'] = $column['is_sort'] ? 2 : 1;
$column['options'] = json_encode($column['options']);
$updateData[] = $column;
}
GenerateColumns::upsert($updateData, ['id']);
return true;
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemAttachment.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 附件模型
*
* sa_system_attachment 附件信息表
*
* @property $id 主键
* @property $category_id 文件分类
* @property $storage_mode 存储模式
* @property $origin_name 原文件名
* @property $object_name 新文件名
* @property $hash 文件hash
* @property $mime_type 资源类型
* @property $storage_path 存储目录
* @property $suffix 文件后缀
* @property $size_byte 字节数
* @property $size_info 文件大小
* @property $url url地址
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemAttachment extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_attachment';
/**
* 文件名搜索
*/
public function searchOriginNameAttr($query, $value)
{
$query->where('origin_name', 'like', '%' . $value . '%');
}
/**
* 文件类型搜索
*/
public function searchMimeTypeAttr($query, $value)
{
$query->where('mime_type', 'like', $value . '/%');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemCategory.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 附件分类模型
*
* sa_system_category 附件分类表
*
* @property $id 分类ID
* @property $parent_id 父id
* @property $level 组集关系
* @property $category_name 分类名称
* @property $sort 排序
* @property $status 状态
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemCategory extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_category';
/**
* 分类名称搜索
*/
public function searchCategoryNameAttr($query, $value)
{
$query->where('category_name', 'like', '%' . $value . '%');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemConfig.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 参数配置模型
*
* sa_system_config 参数配置信息表
*
* @property $id 编号
* @property $group_id 组id
* @property $key 配置键名
* @property $value 配置值
* @property $name 配置名称
* @property $input_type 数据输入类型
* @property $config_select_data 配置选项数据
* @property $sort 排序
* @property $remark 备注
* @property $created_by 创建人
* @property $updated_by 更新人
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemConfig extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_config';
protected function casts(): array
{
return array_merge(parent::casts(), [
'config_select_data' => 'array',
]);
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemConfigGroup.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 参数配置分组模型
*
* sa_system_config_group 参数配置分组表
*
* @property $id 主键
* @property $name 字典名称
* @property $code 字典标示
* @property $remark 备注
* @property $created_by 创建人
* @property $updated_by 更新人
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemConfigGroup extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_config_group';
/**
* 关联配置列表
*/
public function configs()
{
return $this->hasMany(SystemConfig::class, 'group_id', 'id');
}
/**
* 名称搜索
*/
public function searchNameAttr($query, $value)
{
return $query->where('name', 'like', '%' . $value . '%');
}
/**
* 编码搜索
*/
public function searchCodeAttr($query, $value)
{
return $query->where('code', 'like', '%' . $value . '%');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemDept.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 部门模型
*
* sa_system_dept 部门表
*
* @property $id 编号
* @property $parent_id 父级ID,0为根节点
* @property $name 部门名称
* @property $code 部门编码
* @property $leader_id 部门负责人ID
* @property $level 祖级列表,格式: 0,1,5,
* @property $sort 排序,数字越小越靠前
* @property $status 状态: 1启用, 0禁用
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemDept extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_dept';
/**
* 权限范围
*/
public function scopeAuth($query, $value)
{
if (!empty($value)) {
$deptIds = [$value['id']];
$deptLevel = $value['level'] . $value['id'] . ',';
$ids = static::where('level', 'like', $deptLevel . '%')->pluck('id')->toArray();
$deptIds = array_merge($deptIds, $ids);
$query->whereIn('id', $deptIds);
}
}
/**
* 部门领导
*/
public function leader()
{
return $this->hasOne(SystemUser::class, 'id', 'leader_id');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemDictData.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 字典数据模型
*
* sa_system_dict_data 字典数据表
*
* @property $id 主键
* @property $type_id 字典类型ID
* @property $label 字典标签
* @property $value 字典值
* @property $color 字典颜色
* @property $code 字典标示
* @property $sort 排序
* @property $status 状态
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemDictData extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_dict_data';
/**
* 关键字搜索
*/
public function searchKeywordsAttr($query, $value)
{
$query->where('label|code', 'LIKE', "%$value%");
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemDictType.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 字典类型模型
*
* sa_system_dict_type 字典类型表
*
* @property $id 主键
* @property $name 字典名称
* @property $code 字典标示
* @property $status 状态
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemDictType extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_dict_type';
/**
* 关联字典数据
*/
public function dicts()
{
return $this->hasMany(SystemDictData::class, 'type_id', 'id');
}
/**
* 名称搜索
*/
public function searchNameAttr($query, $value)
{
return $query->where('name', 'like', '%' . $value . '%');
}
/**
* 编码搜索
*/
public function searchCodeAttr($query, $value)
{
return $query->where('code', 'like', '%' . $value . '%');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemLoginLog.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 登录日志模型
*
* sa_system_login_log 登录日志表
*
* @property $id 主键
* @property $username 用户名
* @property $ip 登录IP地址
* @property $ip_location IP所属地
* @property $os 操作系统
* @property $browser 浏览器
* @property $status 登录状态
* @property $message 提示消息
* @property $login_time 登录时间
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 更新时间
*/
class SystemLoginLog extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_login_log';
/**
* 时间范围搜索
*/
public function searchLoginTimeAttr($query, $value)
{
$query->whereTime('login_time', 'between', $value);
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemMail.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 邮件记录模型
*
* sa_system_mail 邮件记录
*
* @property $id 编号
* @property $gateway 网关
* @property $from 发送人
* @property $email 接收人
* @property $code 验证码
* @property $content 邮箱内容
* @property $status 发送状态
* @property $response 返回结果
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemMail extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_mail';
/**
* 发送人搜索
*/
public function searchFromAttr($query, $value)
{
$query->where('from', 'like', '%' . $value . '%');
}
/**
* 接收人搜索
*/
public function searchEmailAttr($query, $value)
{
$query->where('email', 'like', '%' . $value . '%');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemMenu.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 菜单模型
*
* sa_system_menu 菜单权限表
*
* @property $id
* @property $parent_id 父级ID
* @property $name 菜单名称
* @property $code 组件名称
* @property $slug 权限标识,如 user:list, user:add
* @property $type 类型: 1目录, 2菜单, 3按钮/API
* @property $path 路由地址或API路径
* @property $component 前端组件路径,如 layout/User
* @property $method 请求方式
* @property $icon 图标
* @property $sort 排序
* @property $link_url 外部链接
* @property $is_iframe 是否iframe
* @property $is_keep_alive 是否缓存
* @property $is_hidden 是否隐藏
* @property $is_fixed_tab 是否固定标签页
* @property $is_full_page 是否全屏
* @property $generate_id 生成id
* @property $generate_key 生成key
* @property $status 状态
* @property $remark
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemMenu extends BaseModel
{
// 完整数据库表名称
protected $table = 'sa_system_menu';
// 主键
protected $primaryKey = 'id';
/**
* Id搜索
*/
public function searchIdAttr($query, $value)
{
$query->whereIn('id', $value);
}
/**
* 名称搜索
*/
public function searchNameAttr($query, $value)
{
$query->where('name', 'like', '%' . $value . '%');
}
/**
* 路径搜索
*/
public function searchPathAttr($query, $value)
{
$query->where('path', 'like', '%' . $value . '%');
}
/**
* 菜单搜索
*/
public function searchMenuAttr($query, $value)
{
if (!empty($value)) {
$query->whereIn('type', [1, 2]);
}
}
/**
* 类型搜索
*/
public function searchTypeAttr($query, $value)
{
if (is_array($value)) {
$query->whereIn('type', $value);
} else {
$query->where('type', $value);
}
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemOperLog.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 操作日志模型
*
* sa_system_oper_log 操作日志表
*
* @property $id 主键
* @property $username 用户名
* @property $app 应用名称
* @property $method 请求方式
* @property $router 请求路由
* @property $service_name 业务名称
* @property $ip 请求IP地址
* @property $ip_location IP所属地
* @property $request_data 请求数据
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 更新时间
*/
class SystemOperLog extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_oper_log';
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemPost.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 岗位模型
*
* sa_system_post 岗位信息表
*
* @property $id 主键
* @property $name 岗位名称
* @property $code 岗位代码
* @property $sort 排序
* @property $status 状态
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemPost extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sa_system_post';
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemRole.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 角色模型
*
* sa_system_role 角色表
*
* @property $id
* @property $name 角色名称
* @property $code 角色标识,如: hr_manager
* @property $level 角色级别:用于行政控制,不可操作级别大于自己的角色
* @property $data_scope 数据范围: 1全部, 2本部门及下属, 3本部门, 4仅本人, 5自定义
* @property $remark 备注
* @property $sort
* @property $status 状态: 1启用, 0禁用
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemRole extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
/**
* 数据表完整名称
* @var string
*/
protected $table = 'sa_system_role';
/**
* 权限范围
*/
public function scopeAuth($query, $value)
{
$id = $value['id'];
$roles = $value['roles'];
if ($id > 1) {
$ids = [];
foreach ($roles as $item) {
$ids[] = $item['id'];
$temp = static::whereRaw('FIND_IN_SET("' . $item['id'] . '", level) > 0')->pluck('id')->toArray();
$ids = array_merge($ids, $temp);
}
$query->where('id', 'in', array_unique($ids));
}
}
/**
* 通过中间表获取菜单
*/
public function menus()
{
return $this->belongsToMany(SystemMenu::class, SystemRoleMenu::class, 'role_id', 'menu_id');
}
/**
* 通过中间表获取部门
*/
public function depts()
{
return $this->belongsToMany(SystemDept::class, SystemRoleDept::class, 'role_id', 'dept_id');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemRoleDept.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 角色部门关联模型
*
* sa_system_role_dept 角色-自定义数据权限关联
*
* @property $id
* @property $role_id
* @property $dept_id
*/
class SystemRoleDept extends Pivot
{
protected $primaryKey = 'id';
protected $table = 'sa_system_role_dept';
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemRoleMenu.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 角色菜单关联模型
*
* sa_system_role_menu 角色权限关联
*
* @property $id
* @property $role_id
* @property $menu_id
*/
class SystemRoleMenu extends Pivot
{
protected $primaryKey = 'id';
protected $table = 'sa_system_role_menu';
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemUser.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 用户信息模型
*
* sa_system_user 用户表
*
* @property $id
* @property $username 登录账号
* @property $password 加密密码
* @property $realname 真实姓名
* @property $gender 性别
* @property $avatar 头像
* @property $email 邮箱
* @property $phone 手机号
* @property $signed 个性签名
* @property $dashboard 工作台
* @property $dept_id 主归属部门
* @property $is_super 是否超级管理员: 1是
* @property $status 状态: 1启用, 2禁用
* @property $remark 备注
* @property $login_time 最后登录时间
* @property $login_ip 最后登录IP
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class SystemUser extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
/**
* 数据表完整名称
* @var string
*/
protected $table = 'sa_system_user';
/**
* 关键字搜索
*/
public function searchKeywordAttr($query, $value)
{
if ($value) {
$query->whereAny(['username', 'realname', 'phone'], 'like', '%' . $value . '%');
}
}
/**
* 权限范围 - 过滤部门用户
*/
public function scopeAuth($query, $value)
{
if (!empty($value)) {
$deptIds = [$value['id']];
$deptLevel = $value['level'] . $value['id'] . ',';
$dept_ids = SystemDept::where('level', 'like', $deptLevel . '%')->pluck('id')->toArray();
$deptIds = array_merge($deptIds, $dept_ids);
$query->whereIn('dept_id', $deptIds);
}
}
/**
* 通过中间表关联角色
*/
public function roles()
{
return $this->belongsToMany(SystemRole::class, SystemUserRole::class, 'user_id', 'role_id');
}
/**
* 通过中间表关联岗位
*/
public function posts()
{
return $this->belongsToMany(SystemPost::class, SystemUserPost::class, 'user_id', 'post_id');
}
/**
* 通过中间表关联部门
*/
public function depts()
{
return $this->belongsTo(SystemDept::class, 'dept_id', 'id');
}
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemUserPost.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 用户岗位关联模型
*
* sa_system_user_post 用户与岗位关联表
*
* @property $id 主键
* @property $user_id 用户主键
* @property $post_id 岗位主键
*/
class SystemUserPost extends Pivot
{
protected $primaryKey = 'id';
protected $table = 'sa_system_user_post';
}
================================================
FILE: src/orm/eloquent/app/model/system/SystemUserRole.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 用户角色关联模型
*
* sa_system_user_role 用户角色关联
*
* @property $id
* @property $user_id
* @property $role_id
*/
class SystemUserRole extends Pivot
{
protected $primaryKey = 'id';
protected $table = 'sa_system_user_role';
/**
* 获取角色id
* @param mixed $user_id
* @return array
*/
public static function getRoleIds($user_id): array
{
return static::where('user_id', $user_id)->pluck('role_id')->toArray();
}
}
================================================
FILE: src/orm/eloquent/app/model/tool/Crontab.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\tool;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 定时任务模型
*
* sa_tool_crontab 定时任务信息表
*
* @property $id 主键
* @property $name 任务名称
* @property $type 任务类型
* @property $target 调用任务字符串
* @property $parameter 调用任务参数
* @property $task_style 执行类型
* @property $rule 任务执行表达式
* @property $status 状态
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class Crontab extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
protected $table = 'sa_tool_crontab';
}
================================================
FILE: src/orm/eloquent/app/model/tool/CrontabLog.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\tool;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 定时任务日志模型
*
* sa_tool_crontab_log 定时任务执行日志表
*
* @property $id 主键
* @property $crontab_id 任务ID
* @property $name 任务名称
* @property $target 任务调用目标字符串
* @property $parameter 任务调用参数
* @property $exception_info 异常信息
* @property $status 执行状态
* @property $create_time 创建时间
* @property $update_time 修改时间
*/
class CrontabLog extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
protected $table = 'sa_tool_crontab_log';
protected $guarded = ['created_by', 'updated_by'];
}
================================================
FILE: src/orm/eloquent/app/model/tool/GenerateColumns.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\tool;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 代码生成业务字段模型
*/
class GenerateColumns extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
protected $table = 'sa_tool_generate_columns';
protected $guarded = ['is_cover'];
}
================================================
FILE: src/orm/eloquent/app/model/tool/GenerateTables.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\model\tool;
use plugin\saiadmin\basic\eloquent\BaseModel;
/**
* 代码生成业务模型
*/
class GenerateTables extends BaseModel
{
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
protected $table = 'sa_tool_generate_tables';
}
================================================
FILE: src/orm/think/app/logic/system/DatabaseLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use support\think\Db;
/**
* 数据表维护逻辑层
*/
class DatabaseLogic extends BaseLogic
{
/**
* 获取数据源
* @return array
*/
public function getDbSource(): array
{
$data = config('think-orm.connections');
$list = [];
foreach ($data as $k => $v) {
$list[] = $k;
}
return $list;
}
/**
* 数据列表
* @param $query
* @return mixed
*/
public function getList($query): mixed
{
$request = request();
$page = $request ? ($request->input('page') ?: 1) : 1;
$limit = $request ? ($request->input('limit') ?: 10) : 10;
return self::getTableList($query, $page, $limit);
}
/**
* 获取数据库表数据
*/
public function getTableList($query, $current_page = 1, $per_page = 10): array
{
if (!empty($query['source'])) {
if (!empty($query['name'])) {
$sql = 'show table status where name=:name ';
$list = Db::connect($query['source'])->query($sql, ['name' => $query['name']]);
} else {
$list = Db::connect($query['source'])->query('show table status');
}
} else {
if (!empty($query['name'])) {
$sql = 'show table status where name=:name ';
$list = Db::query($sql, ['name' => $query['name']]);
} else {
$list = Db::query('show table status');
}
}
$data = [];
foreach ($list as $item) {
$data[] = [
'name' => $item['Name'],
'engine' => $item['Engine'],
'rows' => $item['Rows'],
'data_free' => $item['Data_free'],
'data_length' => $item['Data_length'],
'index_length' => $item['Index_length'],
'collation' => $item['Collation'],
'create_time' => $item['Create_time'],
'update_time' => $item['Update_time'],
'comment' => $item['Comment'],
];
}
$total = count($data);
$last_page = ceil($total / $per_page);
$startIndex = ($current_page - 1) * $per_page;
$pageData = array_slice($data, $startIndex, $per_page);
return [
'data' => $pageData,
'total' => $total,
'current_page' => $current_page,
'per_page' => $per_page,
'last_page' => $last_page,
];
}
/**
* 获取列信息
*/
public function getColumnList($table, $source): array
{
$columnList = [];
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
if (!empty($source)) {
$list = Db::connect($source)->query('SHOW FULL COLUMNS FROM `' . $table . '`');
} else {
$list = Db::query('SHOW FULL COLUMNS FROM `' . $table . '`');
}
foreach ($list as $column) {
preg_match('/^\w+/', $column['Type'], $matches);
$columnList[] = [
'column_key' => $column['Key'],
'column_name' => $column['Field'],
'column_type' => $matches[0],
'column_comment' => trim(preg_replace("/\([^()]*\)/", "", $column['Comment'])),
'extra' => $column['Extra'],
'default_value' => $column['Default'],
'is_nullable' => $column['Null'],
];
}
}
return $columnList;
}
/**
* 优化表
*/
public function optimizeTable($tables)
{
foreach ($tables as $table) {
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
Db::execute('OPTIMIZE TABLE `' . $table . '`');
}
}
}
/**
* 清理表碎片
*/
public function fragmentTable($tables)
{
foreach ($tables as $table) {
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
Db::execute('ANALYZE TABLE `' . $table . '`');
}
}
}
/**
* 获取回收站数据
*/
public function recycleData($table)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
// 查询表字段
$sql = 'SHOW COLUMNS FROM `' . $table . '` where Field = "delete_time"';
$columns = Db::query($sql);
$isDeleteTime = false;
if (count($columns) > 0) {
$isDeleteTime = true;
}
if (!$isDeleteTime) {
throw new ApiException('当前表不支持回收站功能');
}
// 查询软删除数据
$request = request();
$limit = $request ? ($request->input('limit') ?: 10) : 10;
return Db::table($table)->whereNotNull('delete_time')
->order('delete_time', 'desc')
->paginate($limit)
->toArray();
} else {
return [];
}
}
/**
* 删除数据
* @param $table
* @param $ids
* @return bool
*/
public function delete($table, $ids)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
$count = Db::table($table)->whereIn('id', $ids)->delete($ids);
return $count > 0;
} else {
return false;
}
}
/**
* 恢复数据
* @param $table
* @param $ids
* @return bool
*/
public function recovery($table, $ids)
{
if (preg_match("/^[a-zA-Z0-9_]+$/", $table)) {
$count = Db::table($table)
->where('id', 'in', $ids)
->update(['delete_time' => null]);
return $count > 0;
} else {
return false;
}
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemAttachmentLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use Exception;
use plugin\saiadmin\app\model\system\SystemAttachment;
use plugin\saiadmin\app\model\system\SystemCategory;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\service\storage\ChunkUploadService;
use plugin\saiadmin\service\storage\UploadService;
use plugin\saiadmin\utils\Arr;
use plugin\saiadmin\utils\Helper;
/**
* 附件逻辑层
*/
class SystemAttachmentLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemAttachment();
}
/**
* @param $category_id
* @param $ids
* @return mixed
*/
public function move($category_id, $ids): mixed
{
$category = SystemCategory::where('id', $category_id)->findOrEmpty();
if ($category->isEmpty()) {
throw new ApiException('目标分类不存在');
}
return $this->model->whereIn('id', $ids)->update(['category_id' => $category_id]);
}
/**
* 保存网络图片
* @param $url
* @param $config
* @return array
* @throws ApiException|Exception
*/
public function saveNetworkImage($url, $config): array
{
$image_data = file_get_contents($url);
if ($image_data === false) {
throw new ApiException('获取文件资源失败');
}
$image_resource = imagecreatefromstring($image_data);
if (!$image_resource) {
throw new ApiException('创建图片资源失败');
}
$filename = basename($url);
$file_extension = pathinfo($filename, PATHINFO_EXTENSION);
$full_dir = runtime_path() . '/resource/';
if (!is_dir($full_dir)) {
mkdir($full_dir, 0777, true);
}
$save_path = $full_dir . $filename;
$mime_type = 'image/';
switch ($file_extension) {
case 'jpg':
case 'jpeg':
$mime_type = 'image/jpeg';
$result = imagejpeg($image_resource, $save_path);
break;
case 'png':
$mime_type = 'image/png';
$result = imagepng($image_resource, $save_path);
break;
case 'gif':
$mime_type = 'image/gif';
$result = imagegif($image_resource, $save_path);
break;
default:
imagedestroy($image_resource);
throw new ApiException('文件格式错误');
}
imagedestroy($image_resource);
if (!$result) {
throw new ApiException('文件保存失败');
}
$hash = md5_file($save_path);
$size = filesize($save_path);
$model = $this->model->where('hash', $hash)->find();
if ($model) {
unlink($save_path);
return $model->toArray();
} else {
$logic = new SystemConfigLogic();
$uploadConfig = $logic->getGroup('upload_config');
$root = Arr::getConfigValue($uploadConfig, 'local_root');
$folder = date('Ymd');
$full_dir = base_path() . DIRECTORY_SEPARATOR . $root . $folder . DIRECTORY_SEPARATOR;
if (!is_dir($full_dir)) {
mkdir($full_dir, 0777, true);
}
$object_name = bin2hex(pack('Nn', time(), random_int(1, 65535))) . ".$file_extension";
$newPath = $full_dir . $object_name;
copy($save_path, $newPath);
unlink($save_path);
$domain = Arr::getConfigValue($uploadConfig, 'local_domain');
$uri = Arr::getConfigValue($uploadConfig, 'local_uri');
$baseUrl = $domain . $uri . $folder . '/';
$info['storage_mode'] = 1;
$info['category_id'] = request()->input('category_id', 1);
$info['origin_name'] = $filename;
$info['object_name'] = $object_name;
$info['hash'] = $hash;
$info['mime_type'] = $mime_type;
$info['storage_path'] = $root . $folder . '/' . $object_name;
$info['suffix'] = $file_extension;
$info['size_byte'] = $size;
$info['size_info'] = formatBytes($size);
$info['url'] = $baseUrl . $object_name;
$this->model->save($info);
return $info;
}
}
/**
* 文件上传
* @param string $upload
* @param bool $local
* @return array
*/
public function uploadBase(string $upload = 'image', bool $local = false): array
{
$logic = new SystemConfigLogic();
$uploadConfig = $logic->getGroup('upload_config');
$type = Arr::getConfigValue($uploadConfig, 'upload_mode');
if ($local === true) {
$type = 1;
}
$result = UploadService::disk($type, $upload)->uploadFile();
$data = $result[0];
$hash = $data['unique_id'];
$hash_check = config('plugin.saiadmin.saithink.file_hash', false);
if ($hash_check) {
$model = $this->model->where('hash', $hash)->findOrEmpty();
if (!$model->isEmpty()) {
return $model->toArray();
}
}
$url = str_replace('\\', '/', $data['url']);
$savePath = str_replace('\\', '/', $data['save_path']);
$info['storage_mode'] = $type;
$info['category_id'] = request()->input('category_id', 1);
$info['origin_name'] = $data['origin_name'];
$info['object_name'] = $data['save_name'];
$info['hash'] = $data['unique_id'];
$info['mime_type'] = $data['mime_type'];
$info['storage_path'] = $savePath;
$info['suffix'] = $data['extension'];
$info['size_byte'] = $data['size'];
$info['size_info'] = formatBytes($data['size']);
$info['url'] = $url;
$this->model->save($info);
return $info;
}
/**
* 切片上传
* @param $data
* @return array
*/
public function chunkUpload($data): array
{
$chunkService = new ChunkUploadService();
if ($data['index'] == 0) {
$model = $this->model->where('hash', $data['hash'])->findOrEmpty();
if (!$model->isEmpty()) {
return $model->toArray();
} else {
return $chunkService->checkChunk($data);
}
} else {
return $chunkService->uploadChunk($data);
}
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemCategoryLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemCategory;
use plugin\saiadmin\utils\Helper;
use plugin\saiadmin\utils\Arr;
/**
* 附件分类逻辑层
*/
class SystemCategoryLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemCategory();
}
/**
* 添加数据
*/
public function add($data): bool
{
$data = $this->handleData($data);
return $this->model->save($data);
}
/**
* 修改数据
*/
public function edit($id, $data): bool
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级分类和当前分类不能相同');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级分类设置为当前分类的子分类');
}
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
}
return $model->save($data);
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子分类,请先删除子分类');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['level'] = '0';
$data['parent_id'] = 0;
} else {
$parentMenu = SystemCategory::findOrEmpty($data['parent_id']);
$data['level'] = $parentMenu['level'] . $parentMenu['id'] . ',';
}
return $data;
}
/**
* 数据树形化
* @param array $where
* @return array
*/
public function tree(array $where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->field('id, id as value, category_name as label, parent_id, category_name, sort');
}
$query->order('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemConfigGroupLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\ConfigCache;
use plugin\saiadmin\app\model\system\SystemConfigGroup;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemConfig;
use support\think\Db;
/**
* 参数配置分组逻辑层
*/
class SystemConfigGroupLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemConfigGroup();
}
/**
* 删除配置信息
*/
public function destroy($ids): bool
{
$id = $ids[0];
$model = $this->model->where('id', $id)->findOrEmpty();
if ($model->isEmpty()) {
throw new ApiException('配置数据未找到');
}
if (in_array(intval($id), [1, 2, 3])) {
throw new ApiException('系统默认分组,无法删除');
}
Db::startTrans();
try {
// 删除配置组
$model->delete();
// 删除配置组数据
$typeIds = SystemConfig::where('group_id', $id)->column('id');
SystemConfig::destroy($typeIds);
ConfigCache::clearConfig($model->code);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
}
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemConfigLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\ConfigCache;
use plugin\saiadmin\app\model\system\SystemConfig;
use plugin\saiadmin\app\model\system\SystemConfigGroup;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
/**
* 参数配置逻辑层
*/
class SystemConfigLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemConfig();
}
/**
* 添加数据
* @param mixed $data
* @return mixed
*/
public function add($data): mixed
{
$result = $this->model->create($data);
$group = SystemConfigGroup::find($data['group_id']);
ConfigCache::clearConfig($group->code);
return $result;
}
/**
* 编辑数据
* @param mixed $id
* @param mixed $data
* @return bool
*/
public function edit($id, $data): bool
{
$result = parent::edit($id, $data);
$group = SystemConfigGroup::find($data['group_id']);
ConfigCache::clearConfig($group->code);
return $result;
}
/**
* 批量更新
* @param mixed $group_id
* @param mixed $config
* @return bool
*/
public function batchUpdate($group_id, $config): bool
{
$group = SystemConfigGroup::find($group_id);
if (!$group) {
throw new ApiException('配置组未找到');
}
$saveData = [];
foreach ($config as $key => $value) {
$saveData[] = [
'id' => $value['id'],
'group_id' => $group_id,
'name' => $value['name'],
'key' => $value['key'],
'value' => $value['value']
];
}
// upsert: 根据 id 更新,如果不存在则插入
$this->model->saveAll($saveData);
ConfigCache::clearConfig($group->code);
return true;
}
/**
* 获取配置数据
* @param mixed $code
* @return array
*/
public function getData($code): array
{
$group = SystemConfigGroup::where('code', $code)->findOrEmpty();
if (empty($group)) {
return [];
}
$config = SystemConfig::where('group_id', $group['id'])->select()->toArray();
return $config;
}
/**
* 获取配置组
*/
public function getGroup($config): array
{
return ConfigCache::getConfig($config);
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemDeptLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDept;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\utils\Helper;
use plugin\saiadmin\utils\Arr;
/**
* 部门逻辑层
*/
class SystemDeptLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDept();
}
/**
* 添加数据
*/
public function add($data): mixed
{
$data = $this->handleData($data);
$this->model->save($data);
return $this->model->getKey();
}
/**
* 修改数据
*/
public function edit($id, $data): mixed
{
$oldLevel = $data['level'] . $id . ',';
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级部门和当前部门不能相同');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级部门设置为当前部门的子部门');
}
$newLevel = $data['level'] . $id . ',';
$deptIds = $this->model->where('level', 'like', $oldLevel . '%')->column('id');
return $this->transaction(function () use ($deptIds, $oldLevel, $newLevel, $data, $id) {
$this->model->whereIn('id', $deptIds)->exp('level', "REPLACE(level, '$oldLevel', '$newLevel')")->update([]);
return $this->model->update($data, ['id' => $id]);
});
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子部门,请先删除子部门');
} else {
$count = SystemUser::where('dept_id', 'in', $ids)->count();
if ($count > 0) {
throw new ApiException('该部门下存在用户,请先删除或者转移用户');
}
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 处理上级部门
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['level'] = '0';
$data['parent_id'] = 0;
} else {
$parentMenu = SystemDept::findOrEmpty($data['parent_id']);
$data['level'] = $parentMenu['level'] . $parentMenu['id'] . ',';
}
return $data;
}
/**
* 数据树形化
* @param array $where
* @return array
*/
public function tree(array $where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->field('id, id as value, name as label, parent_id');
}
$query->order('sort', 'desc');
$query->with(['leader']);
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 可操作部门
* @param array $where
* @return array
*/
public function accessDept(array $where = []): array
{
$query = $this->search($where);
$query->auth($this->adminInfo['deptList']);
$query->field('id, id as value, name as label, parent_id');
$query->order('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemDictDataLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDictData;
use plugin\saiadmin\app\model\system\SystemDictType;
use plugin\saiadmin\app\cache\DictCache;
use plugin\saiadmin\utils\Helper;
/**
* 字典类型逻辑层
*/
class SystemDictDataLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDictData();
}
/**
* 添加数据
* @param $data
* @return mixed
*/
public function add($data): mixed
{
$type = SystemDictType::where('id', $data['type_id'])->findOrEmpty();
if ($type->isEmpty()) {
throw new ApiException('字典类型不存在');
}
$data['code'] = $type->code;
$model = $this->model->create($data);
DictCache::clear();
return $model->getKey();
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemDictTypeLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\app\model\system\SystemDictType;
use plugin\saiadmin\app\model\system\SystemDictData;
use support\think\Db;
/**
* 字典类型逻辑层
*/
class SystemDictTypeLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemDictType();
}
/**
* 添加数据
*/
public function add($data): mixed
{
$model = $this->model->where('code', $data['code'])->findOrEmpty();
if (!$model->isEmpty()) {
throw new ApiException('该字典标识已存在');
}
return $this->model->save($data);
}
/**
* 数据更新
*/
public function edit($id, $data): mixed
{
Db::startTrans();
try {
// 修改数据字典类型
$result = $this->model->update($data, ['id' => $id]);
// 更新数据字典数据
SystemDictData::update(['code' => $data['code']], ['type_id' => $id]);
Db::commit();
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('修改数据异常,请检查');
}
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
Db::startTrans();
try {
// 删除数据字典类型
$result = $this->model->destroy($ids);
// 删除数据字典数据
$typeIds = SystemDictData::where('type_id', 'in', $ids)->column('id');
SystemDictData::destroy($typeIds);
Db::commit();
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
}
}
/**
* 获取全部字典
* @return array
*/
public function getDictAll(): array
{
$data = $this->model->where('status', 1)->field('id, name, code, remark')
->with([
'dicts' => function ($query) {
$query->where('status', 1)->field('id, type_id, label, value, color, code, sort')->order('sort', 'desc');
}
])->select()->toArray();
return $this->packageDict($data, 'code');
}
/**
* 组合数据
* @param $array
* @param $field
* @return array
*/
private function packageDict($array, $field): array
{
$result = [];
foreach ($array as $item) {
if (isset($item[$field])) {
if (isset($result[$item[$field]])) {
$result[$item[$field]] = [($result[$item[$field]])];
$result[$item[$field]][] = $item['dicts'];
} else {
$result[$item[$field]] = $item['dicts'];
}
}
}
return $result;
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemLoginLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemLoginLog;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\utils\Helper;
use support\think\Db;
/**
* 登录日志逻辑层
*/
class SystemLoginLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemLoginLog();
}
/**
* 登录统计图表
* @return array
*/
public function loginChart(): array
{
$sql = "
SELECT
d.date AS login_date,
COUNT(l.login_time) AS login_count
FROM
(SELECT CURDATE() - INTERVAL (a.N) DAY AS date
FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
) d
LEFT JOIN sa_system_login_log l
ON DATE(l.login_time) = d.date
GROUP BY d.date
ORDER BY d.date ASC;
";
$data = Db::query($sql);
return [
'login_count' => array_column($data, 'login_count'),
'login_date' => array_column($data, 'login_date'),
];
}
/**
* 登录统计图表
* @return array
*/
public function loginBarChart(): array
{
$sql = "
SELECT
-- 拼接成 YYYY-MM 格式,例如 2023-01
CONCAT(LPAD(m.month_num, 2, '0'), '月') AS login_month,
COUNT(l.login_time) AS login_count
FROM
-- 生成 1 到 12 的月份数字
(SELECT 1 AS month_num UNION ALL SELECT 2 UNION ALL SELECT 3
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12) m
LEFT JOIN sa_system_login_log l
-- 关联条件:年份等于今年 且 月份等于生成的数字
ON YEAR(l.login_time) = YEAR(CURDATE())
AND MONTH(l.login_time) = m.month_num
GROUP BY
m.month_num
ORDER BY
m.month_num ASC;
";
$data = Db::query($sql);
return [
'login_count' => array_column($data, 'login_count'),
'login_month' => array_column($data, 'login_month'),
];
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemMailLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemMail;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 邮件模型逻辑层
*/
class SystemMailLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemMail();
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemMenuLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemMenu;
use plugin\saiadmin\app\model\system\SystemRoleMenu;
use plugin\saiadmin\app\model\system\SystemUserRole;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Arr;
use plugin\saiadmin\utils\Helper;
/**
* 菜单逻辑层
*/
class SystemMenuLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemMenu();
}
/**
* 数据添加
*/
public function add($data): mixed
{
$data = $this->handleData($data);
return $this->model->save($data);
}
/**
* 数据修改
*/
public function edit($id, $data): mixed
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('不能设置父级为自身');
}
return $this->model->update($data, ['id' => $id]);
}
/**
* 数据删除
*/
public function destroy($ids): bool
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该菜单下存在子菜单,请先删除子菜单');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 处理上级菜单
if (empty($data['parent_id']) || $data['parent_id'] == 0) {
$data['level'] = '0';
$data['parent_id'] = 0;
} else {
$parentMenu = $this->model->findOrEmpty($data['parent_id']);
$data['level'] = $parentMenu['level'] . $parentMenu['id'] . ',';
}
return $data;
}
/**
* 数据树形化
* @param $where
* @return array
*/
public function tree($where = []): array
{
$query = $this->search($where);
$request = request();
if ($request && $request->input('tree', 'false') === 'true') {
$query->field('id, id as value, name as label, parent_id, type');
}
$query->order('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 权限菜单
* @return array
*/
public function auth(): array
{
$roleLogic = new SystemRoleLogic();
$role_ids = Arr::getArrayColumn($this->adminInfo['roleList'], 'id');
$roles = $roleLogic->getMenuIdsByRoleIds($role_ids);
$ids = $this->filterMenuIds($roles);
$query = $this->model
->field('id, id as value, name as label, parent_id, type')
->where('status', 1)
->where('id', 'in', $ids)
->order('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeTree($data);
}
/**
* 获取全部菜单
*/
public function getAllMenus(): array
{
$query = $this->search(['status' => 1, 'type' => [1, 2, 4]])->order('sort', 'desc');
$data = $this->getAll($query);
return Helper::makeArtdMenus($data);
}
/**
* 获取全部权限
* @return array
*/
public function getAllAuth(): array
{
return SystemMenu::where('type', 3)
->where('status', 1)
->column('slug');
}
/**
* 根据角色获取权限
* @param $roleIds
* @return array
*/
public function getAuthByRole($roleIds): array
{
$menuId = SystemRoleMenu::whereIn('role_id', $roleIds)->column('menu_id');
return SystemMenu::distinct(true)
->where('type', 3)
->where('status', 1)
->where('id', 'in', array_unique($menuId))
->column('slug');
}
/**
* 根据角色获取菜单
* @param $roleIds
* @return array
*/
public function getMenuByRole($roleIds): array
{
$menuId = SystemRoleMenu::whereIn('role_id', $roleIds)->column('menu_id');
$data = SystemMenu::distinct(true)
->where('status', 1)
->where('type', 'in', [1, 2, 4])
->where('id', 'in', array_unique($menuId))
->order('sort', 'desc')
->select()
->toArray();
return Helper::makeArtdMenus($data);
}
/**
* 过滤通过角色查询出来的菜单id列表,并去重
* @param array $roleData
* @return array
*/
public function filterMenuIds(array &$roleData): array
{
$ids = [];
foreach ($roleData as $val) {
foreach ($val['menus'] as $menu) {
$ids[] = $menu['id'];
}
}
unset($roleData);
return array_unique($ids);
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemOperLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemOperLog;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 操作日志逻辑层
*/
class SystemOperLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemOperLog();
}
/**
* 获取自己的操作日志
* @param mixed $where
* @return array
*/
public function getOwnOperLogList($where): array
{
$query = $this->search($where);
$query->field('id, username, method, router, service_name, ip, ip_location, create_time');
return $this->getList($query);
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemPostLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\model\system\SystemPost;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\service\OpenSpoutWriter;
use OpenSpout\Reader\XLSX\Reader;
/**
* 岗位管理逻辑层
*/
class SystemPostLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemPost();
}
/**
* 可操作岗位
* @param array $where
* @return array
*/
public function accessPost(array $where = []): array
{
$query = $this->search($where);
$query->field('id, id as value, name as label, name, code');
return $this->getAll($query);
}
/**
* 导入数据
*/
public function import($file)
{
$path = $this->getImport($file);
$reader = new Reader();
try {
$reader->open($path);
$data = [];
foreach ($reader->getSheetIterator() as $sheet) {
$isHeader = true;
foreach ($sheet->getRowIterator() as $row) {
if ($isHeader) {
$isHeader = false;
continue;
}
$cells = $row->getCells();
$data[] = [
'name' => $cells[0]->getValue(),
'code' => $cells[1]->getValue(),
'sort' => $cells[2]->getValue(),
'status' => $cells[3]->getValue(),
];
}
}
$this->saveAll($data);
} catch (\Exception $e) {
throw new ApiException('导入文件错误,请上传正确的文件格式xlsx');
}
}
/**
* 导出数据
*/
public function export($where = [])
{
$query = $this->search($where)->field('id,name,code,sort,status,create_time');
$data = $this->getAll($query);
$file_name = '岗位数据.xlsx';
$header = ['编号', '岗位名称', '岗位标识', '排序', '状态', '创建时间'];
$filter = [
'status' => [
['value' => 1, 'label' => '正常'],
['value' => 2, 'label' => '禁用']
]
];
$writer = new OpenSpoutWriter($file_name);
$writer->setWidth([15, 15, 20, 15, 15, 25]);
$writer->setHeader($header);
$writer->setData($data, null, $filter);
$file_path = $writer->returnFile();
return response()->download($file_path, urlencode($file_name));
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemRoleLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\UserMenuCache;
use plugin\saiadmin\app\model\system\SystemRole;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
use support\think\Cache;
use support\think\Db;
/**
* 角色逻辑层
*/
class SystemRoleLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemRole();
}
/**
* 添加数据
*/
public function add($data): bool
{
$data = $this->handleData($data);
return $this->model->save($data);
}
/**
* 修改数据
*/
public function edit($id, $data): bool
{
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
}
$data = $this->handleData($data);
return $model->save($data);
}
/**
* 删除数据
*/
public function destroy($ids): bool
{
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
$num = SystemRole::where('level', '>=', $maxLevel)->whereIn('id', $ids)->count();
if ($num > 0) {
throw new ApiException('不能操作比当前账户职级高的角色');
} else {
return $this->model->destroy($ids);
}
}
/**
* 数据处理
*/
protected function handleData($data)
{
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
if ($data['level'] >= $maxLevel) {
throw new ApiException('不能操作比当前账户职级高的角色');
}
return $data;
}
/**
* 可操作角色
* @param array $where
* @return array
*/
public function accessRole(array $where = []): array
{
$query = $this->search($where);
// 越权保护
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
$query->where('level', '<', $maxLevel);
$query->order('sort', 'desc');
return $this->getAll($query);
}
/**
* 根据角色数组获取菜单
* @param $ids
* @return array
*/
public function getMenuIdsByRoleIds($ids): array
{
if (empty($ids))
return [];
return $this->model->where('id', 'in', $ids)->with([
'menus' => function ($query) {
$query->where('status', 1)->order('sort', 'desc');
}
])->select()->toArray();
}
/**
* 根据角色获取菜单
* @param $id
* @return array
*/
public function getMenuByRole($id): array
{
$role = $this->model->findOrEmpty($id);
$menus = $role->menus ?: [];
return [
'id' => $id,
'menus' => $menus
];
}
/**
* 保存菜单权限
* @param $id
* @param $menu_ids
* @return mixed
*/
public function saveMenuPermission($id, $menu_ids): mixed
{
return $this->transaction(function () use ($id, $menu_ids) {
$role = $this->model->findOrEmpty($id);
if ($role) {
$role->menus()->detach();
$data = array_map(function ($menu_id) use ($id) {
return ['menu_id' => $menu_id, 'role_id' => $id];
}, $menu_ids);
Db::name('sa_system_role_menu')->limit(100)->insertAll($data);
}
$cache = config('plugin.saiadmin.saithink.button_cache');
$tag = $cache['role'] . $id;
Cache::tag($tag)->clear(); // 清理权限缓存-角色TAG
UserMenuCache::clearMenuCache(); // 清理菜单缓存
return true;
});
}
}
================================================
FILE: src/orm/think/app/logic/system/SystemUserLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\system;
use plugin\saiadmin\app\cache\UserAuthCache;
use plugin\saiadmin\app\cache\UserInfoCache;
use plugin\saiadmin\app\cache\UserMenuCache;
use plugin\saiadmin\app\model\system\SystemDept;
use plugin\saiadmin\app\model\system\SystemRole;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\basic\think\BaseLogic;
use Webman\Event\Event;
use Tinywan\Jwt\JwtToken;
/**
* 用户信息逻辑层
*/
class SystemUserLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new SystemUser();
}
/**
* 分页数据列表
* @param mixed $where
* @return array
*/
public function indexList($where): array
{
$query = $this->search($where);
$query->with(['depts']);
$query->auth($this->adminInfo['deptList']);
return $this->getList($query);
}
/**
* 用户列表数据
* @param mixed $where
* @return array
*/
public function openUserList($where): array
{
$query = $this->search($where);
$query->field('id, username, realname, avatar, phone, email');
return $this->getList($query);
}
/**
* 读取用户信息
* @param mixed $id
* @return array
*/
public function getUser($id): array
{
$admin = $this->model->findOrEmpty($id);
$data = $admin->hidden(['password'])->toArray();
$data['roleList'] = $admin->roles->toArray() ?: [];
$data['postList'] = $admin->posts->toArray() ?: [];
$data['deptList'] = $admin->depts ? $admin->depts->toArray() : [];
return $data;
}
/**
* 读取数据
* @param $id
* @return array
*/
public function read($id): array
{
$data = $this->getUser($id);
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
}
return $data;
}
/**
* 添加数据
* @param $data
* @return mixed
*/
public function add($data): mixed
{
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
return $this->transaction(function () use ($data) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
}
}
$user = SystemUser::create($data);
$user->roles()->detach();
$user->posts()->detach();
$user->roles()->saveAll($role_ids);
if (!empty($post_ids)) {
$user->posts()->save($post_ids);
}
return $user;
});
}
/**
* 修改数据
* @param $id
* @param $data
* @return mixed
*/
public function edit($id, $data): mixed
{
unset($data['password']);
return $this->transaction(function () use ($data, $id) {
$role_ids = $data['role_ids'] ?? [];
$post_ids = $data['post_ids'] ?? [];
// 仅可修改当前部门和子部门的用户
$query = $this->model->where('id', $id);
$query->auth($this->adminInfo['deptList']);
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
}
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
}
}
$result = parent::edit($id, $data);
if ($result) {
$user->roles()->detach();
$user->posts()->detach();
$user->roles()->saveAll($role_ids);
if (!empty($post_ids)) {
$user->posts()->save($post_ids);
}
UserInfoCache::clearUserInfo($id);
UserAuthCache::clearUserAuth($id);
UserMenuCache::clearUserMenu($id);
}
return $result;
});
}
/**
* 删除数据
* @param $ids
* @return bool
*/
public function destroy($ids): bool
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
}
$ids = $ids[0];
}
if ($ids == 1) {
throw new ApiException('超级管理员禁止删除');
}
$query = $this->model->where('id', $ids);
$query->auth($this->adminInfo['deptList']);
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
}
if ($this->adminInfo['id'] > 1) {
$role_ids = $user->roles->toArray() ?: [];
if (!empty($role_ids)) {
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], array_column($role_ids, 'id'))) {
throw new ApiException('没有权限操作该角色数据');
}
}
}
UserInfoCache::clearUserInfo($ids);
UserAuthCache::clearUserAuth($ids);
UserMenuCache::clearUserMenu($ids);
return parent::destroy($ids);
}
/**
* 用户登录
* @param string $username
* @param string $password
* @param string $type
* @return array
*/
public function login(string $username, string $password, string $type): array
{
$adminInfo = $this->model->where('username', $username)->findOrEmpty();
$status = 1;
$message = '登录成功';
if ($adminInfo->isEmpty()) {
$message = '账号或密码错误,请重新输入!';
throw new ApiException($message);
}
if ($adminInfo->status === 2) {
$status = 0;
$message = '您已被禁止登录!';
}
if (!password_verify($password, $adminInfo->password)) {
$status = 0;
$message = '账号或密码错误,请重新输入!';
}
if ($status === 0) {
// 登录事件
Event::emit('user.login', compact('username', 'status', 'message'));
throw new ApiException($message);
}
$adminInfo->login_time = date('Y-m-d H:i:s');
$adminInfo->login_ip = request()->getRealIp();
$adminInfo->save();
$access_exp = config('plugin.saiadmin.saithink.access_exp', 3 * 3600);
$token = JwtToken::generateToken([
'access_exp' => $access_exp,
'id' => $adminInfo->id,
'username' => $adminInfo->username,
'type' => $type,
'plat' => 'saiadmin',
]);
// 登录事件
$admin_id = $adminInfo->id;
Event::emit('user.login', compact('username', 'status', 'message', 'admin_id'));
return $token;
}
/**
* 更新资料
* @param mixed $id
* @param mixed $data
* @return bool
*/
public function updateInfo($id, $data): bool
{
$this->model->update($data, ['id' => $id], ['realname', 'gender', 'phone', 'email', 'avatar', 'signed']);
return true;
}
/**
* 密码修改
* @param $adminId
* @param $oldPassword
* @param $newPassword
* @return bool
*/
public function modifyPassword($adminId, $oldPassword, $newPassword): bool
{
$model = $this->model->findOrEmpty($adminId);
if (password_verify($oldPassword, $model->password)) {
$model->password = password_hash($newPassword, PASSWORD_DEFAULT);
return $model->save();
} else {
throw new ApiException('原密码错误');
}
}
/**
* 修改数据
*/
public function authEdit($id, $data)
{
if ($this->adminInfo['id'] > 1) {
// 判断用户是否可以操作
$query = SystemUser::where('id', $id);
$query->auth($this->adminInfo['deptList']);
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
}
}
parent::edit($id, $data);
}
/**
* 部门保护
* @param $dept
* @param $dept_id
* @return bool
*/
public function deptProtect($dept, $dept_id): bool
{
// 部门保护
$deptIds = [$dept['id']];
$deptLevel = $dept['level'] . $dept['id'] . ',';
$dept_ids = SystemDept::whereLike('level', $deptLevel . '%')->column('id');
$deptIds = array_merge($deptIds, $dept_ids);
if (!in_array($dept_id, $deptIds)) {
return false;
}
return true;
}
/**
* 越权保护
* @param $roleList
* @param $role_ids
* @return bool
*/
public function roleProtect($roleList, $role_ids): bool
{
// 越权保护
$levelArr = array_column($roleList, 'level');
$maxLevel = max($levelArr);
$currentLevel = SystemRole::whereIn('id', $role_ids)->max('level');
if ($currentLevel >= $maxLevel) {
return false;
}
return true;
}
}
================================================
FILE: src/orm/think/app/logic/tool/CrontabLogLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use plugin\saiadmin\app\model\tool\CrontabLog;
use plugin\saiadmin\basic\think\BaseLogic;
/**
* 定时任务日志逻辑层
*/
class CrontabLogLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new CrontabLog();
}
}
================================================
FILE: src/orm/think/app/logic/tool/CrontabLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Webman\Channel\Client as ChannelClient;
use plugin\saiadmin\app\model\tool\Crontab;
use plugin\saiadmin\app\model\tool\CrontabLog;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
/**
* 定时任务逻辑层
*/
class CrontabLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new Crontab();
}
/**
* 添加任务
*/
public function add($data): bool
{
$second = $data['second'];
$minute = $data['minute'];
$hour = $data['hour'];
$week = $data['week'];
$day = $data['day'];
$month = $data['month'];
// 规则处理
$rule = match ($data['task_style']) {
1 => "0 {$minute} {$hour} * * *",
2 => "0 {$minute} * * * *",
3 => "0 {$minute} */{$hour} * * *",
4 => "0 */{$minute} * * * *",
5 => "*/{$second} * * * * *",
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
};
// 定时任务模型新增
$model = Crontab::create([
'name' => $data['name'],
'type' => $data['type'],
'task_style' => $data['task_style'],
'rule' => $rule,
'target' => $data['target'],
'parameter' => $data['parameter'],
'status' => $data['status'],
'remark' => $data['remark'],
]);
$id = $model->getKey();
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
return true;
}
/**
* 修改任务
*/
public function edit($id, $data): bool
{
$second = $data['second'];
$minute = $data['minute'];
$hour = $data['hour'];
$week = $data['week'];
$day = $data['day'];
$month = $data['month'];
// 规则处理
$rule = match ($data['task_style']) {
1 => "0 {$minute} {$hour} * * *",
2 => "0 {$minute} * * * *",
3 => "0 {$minute} */{$hour} * * *",
4 => "0 */{$minute} * * * *",
5 => "*/{$second} * * * * *",
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
};
// 查询任务数据
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
}
$result = $model->save([
'name' => $data['name'],
'type' => $data['type'],
'task_style' => $data['task_style'],
'rule' => $rule,
'target' => $data['target'],
'parameter' => $data['parameter'],
'status' => $data['status'],
'remark' => $data['remark'],
]);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
}
// 修改任务数据
return $result;
}
/**
* 删除定时任务
* @param $ids
* @return bool
* @throws Exception
*/
public function destroy($ids): bool
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
}
$ids = $ids[0];
}
$result = parent::destroy($ids);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $ids]);
}
return $result;
}
/**
* 修改状态
* @param $id
* @param $status
* @return bool
*/
public function changeStatus($id, $status): bool
{
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
}
$result = $model->save(['status' => $status]);
if ($result) {
// 连接到Channel服务
ChannelClient::connect();
ChannelClient::publish('crontab', ['args' => $id]);
}
return $result;
}
/**
* 执行定时任务
* @param $id
* @return bool
*/
public function run($id): bool
{
$info = $this->model->where('status', 1)->findOrEmpty($id);
if ($info->isEmpty()) {
return false;
}
$data['crontab_id'] = $info->id;
$data['name'] = $info->name;
$data['target'] = $info->target;
$data['parameter'] = $info->parameter;
switch ($info->type) {
case 1:
// URL任务GET
$httpClient = new Client([
'timeout' => 5,
'verify' => false,
]);
try {
$httpClient->request('GET', $info->target);
$data['status'] = 1;
CrontabLog::create($data);
return true;
} catch (GuzzleException $e) {
$data['status'] = 2;
$data['exception_info'] = $e->getMessage();
CrontabLog::create($data);
return false;
}
case 2:
// URL任务POST
$httpClient = new Client([
'timeout' => 5,
'verify' => false,
]);
try {
$res = $httpClient->request('POST', $info->target, [
'form_params' => json_decode($info->parameter ?? '', true)
]);
$data['status'] = 1;
$data['exception_info'] = $res->getBody();
CrontabLog::create($data);
return true;
} catch (GuzzleException $e) {
$data['status'] = 2;
$data['exception_info'] = $e->getMessage();
CrontabLog::create($data);
return false;
}
case 3:
// 类任务
$class_name = $info->target;
$method_name = 'run';
$class = new $class_name;
if (method_exists($class, $method_name)) {
$return = $class->$method_name($info->parameter);
$data['status'] = 1;
$data['exception_info'] = $return;
CrontabLog::create($data);
return true;
} else {
$data['status'] = 2;
$data['exception_info'] = '类:' . $class_name . ',方法:run,未找到';
CrontabLog::create($data);
return false;
}
default:
return false;
}
}
}
================================================
FILE: src/orm/think/app/logic/tool/GenerateColumnsLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: sai <1430792918@qq.com>
// +----------------------------------------------------------------------
namespace plugin\saiadmin\app\logic\tool;
use plugin\saiadmin\app\model\tool\GenerateColumns;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\utils\Helper;
/**
* 代码生成业务字段逻辑层
*/
class GenerateColumnsLogic extends BaseLogic
{
/**
* 构造函数
*/
public function __construct()
{
$this->model = new GenerateColumns();
}
public function saveExtra($data)
{
$default_column = ['create_time', 'update_time', 'created_by', 'updated_by', 'delete_time', 'remark'];
// 组装数据
foreach ($data as $k => $item) {
if ($item['column_name'] == 'delete_time') {
continue;
}
$column = [
'table_id' => $item['table_id'],
'column_name' => $item['column_name'],
'column_comment' => $item['column_comment'],
'column_type' => $item['column_type'],
'default_value' => $item['default_value'],
'is_pk' => ($item['column_key'] == 'PRI') ? 2 : 1,
'is_required' => $item['is_nullable'] == 'NO' ? 2 : 1,
'query_type' => 'eq',
'view_type' => 'input',
'sort' => count($data) - $k,
'options' => $item['options'] ?? null
];
// 设置默认选项
if (!in_array($item['column_name'], $default_column) && empty($item['column_key'])) {
$column = array_merge(
$column,
[
'is_insert' => 2,
'is_edit' => 2,
'is_list' => 2,
'is_query' => 1,
'is_sort' => 1,
]
);
}
$keyList = [
'column_comment',
'column_type',
'default_value',
'is_pk',
'is_required',
'is_insert',
'is_edit',
'is_list',
'is_query',
'is_sort',
'query_type',
'view_type',
'dict_type',
'options',
'sort',
'is_cover'
];
foreach ($keyList as $key) {
if (isset($item[$key]))
$column[$key] = $item[$key];
}
GenerateColumns::create($this->fieldDispose($column));
}
}
public function update($data, $where)
{
$data['is_insert'] = $data['is_insert'] ? 2 : 1;
$data['is_edit'] = $data['is_edit'] ? 2 : 1;
$data['is_list'] = $data['is_list'] ? 2 : 1;
$data['is_query'] = $data['is_query'] ? 2 : 1;
$data['is_sort'] = $data['is_sort'] ? 2 : 1;
$data['is_required'] = $data['is_required'] ? 2 : 1;
$this->model->update($data, $where);
}
private function fieldDispose(array $column): array
{
$object = new class {
public function viewTypeDispose(&$column): void
{
switch ($column['column_type']) {
case 'varchar':
$column['view_type'] = 'input';
break;
// 富文本
case 'text':
case 'longtext':
$column['is_list'] = 1;
$column['is_query'] = 1;
$column['view_type'] = 'editor';
$options = [
'height' => 400,
];
$column['options'] = $options;
break;
// 日期字段
case 'datetime':
$column['view_type'] = 'date';
$options = [
'mode' => 'datetime'
];
$column['options'] = $options;
$column['query_type'] = 'between';
break;
case 'date':
$column['view_type'] = 'date';
$options = [
'mode' => 'date'
];
$column['options'] = $options;
$column['query_type'] = 'between';
break;
}
}
public function columnName(&$column): void
{
if (stristr($column['column_name'], 'name')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'like';
}
if (stristr($column['column_name'], 'title')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'like';
}
if (stristr($column['column_name'], 'type')) {
$column['is_query'] = 2;
$column['is_required'] = 2;
$column['query_type'] = 'eq';
}
if (stristr($column['column_name'], 'image')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadImage';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if (stristr($column['column_name'], 'file')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadFile';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if (stristr($column['column_name'], 'attach')) {
$column['is_query'] = 1;
$column['view_type'] = 'uploadFile';
$options = [
'multiple' => false,
'limit' => 1,
];
$column['options'] = $options;
}
if ($column['column_name'] === 'sort') {
$column['view_type'] = 'inputNumber';
}
if ($column['column_name'] === 'status') {
$column['view_type'] = 'radio';
$column['dict_type'] = 'data_status';
}
if (stristr($column['column_name'], 'is_')) {
$column['view_type'] = 'radio';
$column['dict_type'] = 'yes_or_no';
}
}
};
if (!$column['is_cover']) {
$object->viewTypeDispose($column);
$object->columnName($column);
}
$column['options'] = json_encode($column['options'], JSON_UNESCAPED_UNICODE);
return $column;
}
}
================================================
FILE: src/orm/think/app/logic/tool/GenerateTablesLogic.php
================================================
<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +-------
gitextract_4k9f2lks/
├── LICENSE
├── README.md
├── composer.json
└── src/
├── Install.php
├── orm/
│ ├── eloquent/
│ │ └── app/
│ │ ├── logic/
│ │ │ ├── system/
│ │ │ │ ├── DatabaseLogic.php
│ │ │ │ ├── SystemAttachmentLogic.php
│ │ │ │ ├── SystemCategoryLogic.php
│ │ │ │ ├── SystemConfigGroupLogic.php
│ │ │ │ ├── SystemConfigLogic.php
│ │ │ │ ├── SystemDeptLogic.php
│ │ │ │ ├── SystemDictDataLogic.php
│ │ │ │ ├── SystemDictTypeLogic.php
│ │ │ │ ├── SystemLoginLogLogic.php
│ │ │ │ ├── SystemMailLogic.php
│ │ │ │ ├── SystemMenuLogic.php
│ │ │ │ ├── SystemOperLogLogic.php
│ │ │ │ ├── SystemPostLogic.php
│ │ │ │ ├── SystemRoleLogic.php
│ │ │ │ └── SystemUserLogic.php
│ │ │ └── tool/
│ │ │ ├── CrontabLogLogic.php
│ │ │ ├── CrontabLogic.php
│ │ │ ├── GenerateColumnsLogic.php
│ │ │ └── GenerateTablesLogic.php
│ │ └── model/
│ │ ├── system/
│ │ │ ├── SystemAttachment.php
│ │ │ ├── SystemCategory.php
│ │ │ ├── SystemConfig.php
│ │ │ ├── SystemConfigGroup.php
│ │ │ ├── SystemDept.php
│ │ │ ├── SystemDictData.php
│ │ │ ├── SystemDictType.php
│ │ │ ├── SystemLoginLog.php
│ │ │ ├── SystemMail.php
│ │ │ ├── SystemMenu.php
│ │ │ ├── SystemOperLog.php
│ │ │ ├── SystemPost.php
│ │ │ ├── SystemRole.php
│ │ │ ├── SystemRoleDept.php
│ │ │ ├── SystemRoleMenu.php
│ │ │ ├── SystemUser.php
│ │ │ ├── SystemUserPost.php
│ │ │ └── SystemUserRole.php
│ │ └── tool/
│ │ ├── Crontab.php
│ │ ├── CrontabLog.php
│ │ ├── GenerateColumns.php
│ │ └── GenerateTables.php
│ └── think/
│ └── app/
│ ├── logic/
│ │ ├── system/
│ │ │ ├── DatabaseLogic.php
│ │ │ ├── SystemAttachmentLogic.php
│ │ │ ├── SystemCategoryLogic.php
│ │ │ ├── SystemConfigGroupLogic.php
│ │ │ ├── SystemConfigLogic.php
│ │ │ ├── SystemDeptLogic.php
│ │ │ ├── SystemDictDataLogic.php
│ │ │ ├── SystemDictTypeLogic.php
│ │ │ ├── SystemLoginLogLogic.php
│ │ │ ├── SystemMailLogic.php
│ │ │ ├── SystemMenuLogic.php
│ │ │ ├── SystemOperLogLogic.php
│ │ │ ├── SystemPostLogic.php
│ │ │ ├── SystemRoleLogic.php
│ │ │ └── SystemUserLogic.php
│ │ └── tool/
│ │ ├── CrontabLogLogic.php
│ │ ├── CrontabLogic.php
│ │ ├── GenerateColumnsLogic.php
│ │ └── GenerateTablesLogic.php
│ └── model/
│ ├── system/
│ │ ├── SystemAttachment.php
│ │ ├── SystemCategory.php
│ │ ├── SystemConfig.php
│ │ ├── SystemConfigGroup.php
│ │ ├── SystemDept.php
│ │ ├── SystemDictData.php
│ │ ├── SystemDictType.php
│ │ ├── SystemLoginLog.php
│ │ ├── SystemMail.php
│ │ ├── SystemMenu.php
│ │ ├── SystemOperLog.php
│ │ ├── SystemPost.php
│ │ ├── SystemRole.php
│ │ ├── SystemRoleDept.php
│ │ ├── SystemRoleMenu.php
│ │ ├── SystemUser.php
│ │ ├── SystemUserPost.php
│ │ └── SystemUserRole.php
│ └── tool/
│ ├── Crontab.php
│ ├── CrontabLog.php
│ ├── GenerateColumns.php
│ └── GenerateTables.php
└── plugin/
└── saiadmin/
├── app/
│ ├── cache/
│ │ ├── ConfigCache.php
│ │ ├── DictCache.php
│ │ ├── ReflectionCache.php
│ │ ├── UserAuthCache.php
│ │ ├── UserInfoCache.php
│ │ └── UserMenuCache.php
│ ├── controller/
│ │ ├── InstallController.php
│ │ ├── LoginController.php
│ │ ├── SystemController.php
│ │ ├── system/
│ │ │ ├── DataBaseController.php
│ │ │ ├── SystemAttachmentController.php
│ │ │ ├── SystemCategoryController.php
│ │ │ ├── SystemConfigController.php
│ │ │ ├── SystemConfigGroupController.php
│ │ │ ├── SystemDeptController.php
│ │ │ ├── SystemDictDataController.php
│ │ │ ├── SystemDictTypeController.php
│ │ │ ├── SystemLogController.php
│ │ │ ├── SystemMailController.php
│ │ │ ├── SystemMenuController.php
│ │ │ ├── SystemPostController.php
│ │ │ ├── SystemRoleController.php
│ │ │ ├── SystemServerController.php
│ │ │ └── SystemUserController.php
│ │ └── tool/
│ │ ├── CrontabController.php
│ │ └── GenerateTablesController.php
│ ├── event/
│ │ └── SystemUser.php
│ ├── exception/
│ │ └── Handler.php
│ ├── functions.php
│ ├── logic/
│ │ ├── system/
│ │ │ ├── DatabaseLogic.php
│ │ │ ├── SystemAttachmentLogic.php
│ │ │ ├── SystemCategoryLogic.php
│ │ │ ├── SystemConfigGroupLogic.php
│ │ │ ├── SystemConfigLogic.php
│ │ │ ├── SystemDeptLogic.php
│ │ │ ├── SystemDictDataLogic.php
│ │ │ ├── SystemDictTypeLogic.php
│ │ │ ├── SystemLoginLogLogic.php
│ │ │ ├── SystemMailLogic.php
│ │ │ ├── SystemMenuLogic.php
│ │ │ ├── SystemOperLogLogic.php
│ │ │ ├── SystemPostLogic.php
│ │ │ ├── SystemRoleLogic.php
│ │ │ └── SystemUserLogic.php
│ │ └── tool/
│ │ ├── CrontabLogLogic.php
│ │ ├── CrontabLogic.php
│ │ ├── GenerateColumnsLogic.php
│ │ └── GenerateTablesLogic.php
│ ├── middleware/
│ │ ├── CheckAuth.php
│ │ ├── CheckLogin.php
│ │ ├── CrossDomain.php
│ │ └── SystemLog.php
│ ├── model/
│ │ ├── system/
│ │ │ ├── SystemAttachment.php
│ │ │ ├── SystemCategory.php
│ │ │ ├── SystemConfig.php
│ │ │ ├── SystemConfigGroup.php
│ │ │ ├── SystemDept.php
│ │ │ ├── SystemDictData.php
│ │ │ ├── SystemDictType.php
│ │ │ ├── SystemLoginLog.php
│ │ │ ├── SystemMail.php
│ │ │ ├── SystemMenu.php
│ │ │ ├── SystemOperLog.php
│ │ │ ├── SystemPost.php
│ │ │ ├── SystemRole.php
│ │ │ ├── SystemRoleDept.php
│ │ │ ├── SystemRoleMenu.php
│ │ │ ├── SystemUser.php
│ │ │ ├── SystemUserPost.php
│ │ │ └── SystemUserRole.php
│ │ └── tool/
│ │ ├── Crontab.php
│ │ ├── CrontabLog.php
│ │ ├── GenerateColumns.php
│ │ └── GenerateTables.php
│ ├── validate/
│ │ ├── system/
│ │ │ ├── SystemCategoryValidate.php
│ │ │ ├── SystemConfigGroupValidate.php
│ │ │ ├── SystemConfigValidate.php
│ │ │ ├── SystemCrontabValidate.php
│ │ │ ├── SystemDeptValidate.php
│ │ │ ├── SystemDictDataValidate.php
│ │ │ ├── SystemDictTypeValidate.php
│ │ │ ├── SystemMailValidate.php
│ │ │ ├── SystemMenuValidate.php
│ │ │ ├── SystemNoticeValidate.php
│ │ │ ├── SystemPostValidate.php
│ │ │ ├── SystemRoleValidate.php
│ │ │ └── SystemUserValidate.php
│ │ └── tool/
│ │ ├── CrontabValidate.php
│ │ └── GenerateTablesValidate.php
│ └── view/
│ └── install/
│ ├── error.html
│ └── index.html
├── basic/
│ ├── AbstractLogic.php
│ ├── BaseController.php
│ ├── BaseValidate.php
│ ├── OpenController.php
│ ├── contracts/
│ │ ├── LogicInterface.php
│ │ └── ModelInterface.php
│ ├── eloquent/
│ │ ├── BaseLogic.php
│ │ └── BaseModel.php
│ └── think/
│ ├── BaseLogic.php
│ └── BaseModel.php
├── command/
│ ├── SaiOrm.php
│ ├── SaiPlugin.php
│ └── SaiUpgrade.php
├── config/
│ ├── app.php
│ ├── autoload.php
│ ├── container.php
│ ├── database.php
│ ├── event.php
│ ├── exception.php
│ ├── log.php
│ ├── middleware.php
│ ├── process.php
│ ├── route.php
│ ├── saithink.php
│ ├── static.php
│ ├── translation.php
│ └── view.php
├── db/
│ ├── plugin.sql
│ ├── saiadmin-6.0.sql
│ └── saiadmin-pure.sql
├── exception/
│ ├── ApiException.php
│ └── SystemException.php
├── process/
│ ├── Task.php
│ └── Test.php
├── public/
│ └── template/
│ └── template.xlsx
├── service/
│ ├── EmailService.php
│ ├── OpenSpoutWriter.php
│ ├── Permission.php
│ └── storage/
│ ├── ChunkUploadService.php
│ └── UploadService.php
└── utils/
├── Arr.php
├── Captcha.php
├── Helper.php
├── ServerMonitor.php
└── code/
├── CodeEngine.php
├── CodeZip.php
└── stub/
└── saiadmin/
├── php/
│ ├── controller.stub
│ ├── logic.stub
│ ├── model.stub
│ └── validate.stub
├── sql/
│ └── sql.stub
├── ts/
│ └── api.stub
└── vue/
├── edit-dialog.stub
├── index.stub
└── table-search.stub
SYMBOL INDEX (1005 symbols across 202 files)
FILE: src/Install.php
class Install (line 4) | class Install
method install (line 19) | public static function install()
method uninstall (line 29) | public static function uninstall()
method installByRelation (line 38) | public static function installByRelation()
method uninstallByRelation (line 57) | public static function uninstallByRelation()
method addMethod (line 77) | public static function addMethod()
FILE: src/orm/eloquent/app/logic/system/DatabaseLogic.php
class DatabaseLogic (line 16) | class DatabaseLogic extends BaseLogic
method getDbSource (line 22) | public function getDbSource(): array
method getList (line 37) | public function getList($query): mixed
method getTableList (line 49) | public function getTableList($query, $current_page = 1, $per_page = 10...
method getColumnList (line 98) | public function getColumnList($table, $source): array
method optimizeTable (line 126) | public function optimizeTable($tables)
method fragmentTable (line 138) | public function fragmentTable($tables)
method recycleData (line 150) | public function recycleData($table)
method delete (line 189) | public function delete($table, $ids)
method recovery (line 205) | public function recovery($table, $ids)
FILE: src/orm/eloquent/app/logic/system/SystemAttachmentLogic.php
class SystemAttachmentLogic (line 22) | class SystemAttachmentLogic extends BaseLogic
method __construct (line 27) | public function __construct()
method move (line 37) | public function move($category_id, $ids): mixed
method saveNetworkImage (line 53) | public function saveNetworkImage($url, $config): array
method uploadBase (line 144) | public function uploadBase(string $upload = 'image', bool $local = fal...
method chunkUpload (line 184) | public function chunkUpload($data): array
FILE: src/orm/eloquent/app/logic/system/SystemCategoryLogic.php
class SystemCategoryLogic (line 18) | class SystemCategoryLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method add (line 31) | public function add($data): mixed
method edit (line 40) | public function edit($id, $data): bool
method destroy (line 59) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method tree (line 89) | public function tree(array $where = []): array
FILE: src/orm/eloquent/app/logic/system/SystemConfigGroupLogic.php
class SystemConfigGroupLogic (line 19) | class SystemConfigGroupLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method destroy (line 32) | public function destroy($ids): bool
FILE: src/orm/eloquent/app/logic/system/SystemConfigLogic.php
class SystemConfigLogic (line 19) | class SystemConfigLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
method edit (line 48) | public function edit($id, $data): bool
method batchUpdate (line 62) | public function batchUpdate($group_id, $config): bool
method getData (line 89) | public function getData($code): array
method getGroup (line 102) | public function getGroup($config): array
FILE: src/orm/eloquent/app/logic/system/SystemDeptLogic.php
class SystemDeptLogic (line 20) | class SystemDeptLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 66) | public function destroy($ids): bool
method handleData (line 83) | protected function handleData($data)
method tree (line 101) | public function tree(array $where = []): array
method accessDept (line 119) | public function accessDept(array $where = []): array
FILE: src/orm/eloquent/app/logic/system/SystemDictDataLogic.php
class SystemDictDataLogic (line 19) | class SystemDictDataLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
FILE: src/orm/eloquent/app/logic/system/SystemDictTypeLogic.php
class SystemDictTypeLogic (line 18) | class SystemDictTypeLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method edit (line 31) | public function edit($id, $data): mixed
method destroy (line 50) | public function destroy($ids): bool
method getDictAll (line 71) | public function getDictAll(): array
method packageDict (line 88) | private function packageDict($array, $field): array
FILE: src/orm/eloquent/app/logic/system/SystemLoginLogLogic.php
class SystemLoginLogLogic (line 17) | class SystemLoginLogLogic extends BaseLogic
method __construct (line 22) | public function __construct()
method loginChart (line 31) | public function loginChart(): array
method loginBarChart (line 59) | public function loginBarChart(): array
FILE: src/orm/eloquent/app/logic/system/SystemMailLogic.php
class SystemMailLogic (line 16) | class SystemMailLogic extends BaseLogic
method __construct (line 21) | public function __construct()
FILE: src/orm/eloquent/app/logic/system/SystemMenuLogic.php
class SystemMenuLogic (line 20) | class SystemMenuLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 54) | public function destroy($ids): bool
method handleData (line 67) | protected function handleData($data)
method tree (line 81) | public function tree($where = []): array
method auth (line 97) | public function auth(): array
method getAllMenus (line 115) | public function getAllMenus(): array
method getAllAuth (line 126) | public function getAllAuth(): array
method getAuthByRole (line 139) | public function getAuthByRole($roleIds): array
method getMenuByRole (line 156) | public function getMenuByRole($roleIds): array
method filterMenuIds (line 175) | public function filterMenuIds(array &$roleData): array
FILE: src/orm/eloquent/app/logic/system/SystemOperLogLogic.php
class SystemOperLogLogic (line 16) | class SystemOperLogLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method getOwnOperLogList (line 31) | public function getOwnOperLogList($where): array
FILE: src/orm/eloquent/app/logic/system/SystemPostLogic.php
class SystemPostLogic (line 18) | class SystemPostLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method accessPost (line 33) | public function accessPost(array $where = []): array
method import (line 43) | public function import($file)
method export (line 75) | public function export($where = [])
FILE: src/orm/eloquent/app/logic/system/SystemRoleLogic.php
class SystemRoleLogic (line 20) | class SystemRoleLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): bool
method destroy (line 55) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method accessRole (line 88) | public function accessRole(array $where = []): array
method getMenuIdsByRoleIds (line 104) | public function getMenuIdsByRoleIds($ids): array
method getMenuByRole (line 121) | public function getMenuByRole($id): array
method saveMenuPermission (line 137) | public function saveMenuPermission($id, $menu_ids): mixed
FILE: src/orm/eloquent/app/logic/system/SystemUserLogic.php
class SystemUserLogic (line 24) | class SystemUserLogic extends BaseLogic
method __construct (line 30) | public function __construct()
method indexList (line 40) | public function indexList($where): array
method openUserList (line 53) | public function openUserList($where): array
method getUser (line 65) | public function getUser($id): array
method read (line 80) | public function read($id): array
method add (line 97) | public function add($data): mixed
method edit (line 129) | public function edit($id, $data): mixed
method destroy (line 172) | public function destroy($ids): bool
method login (line 211) | public function login(string $username, string $password, string $type...
method updateInfo (line 257) | public function updateInfo($id, $data): bool
method modifyPassword (line 272) | public function modifyPassword($adminId, $oldPassword, $newPassword): ...
method authEdit (line 286) | public function authEdit($id, $data)
method deptProtect (line 306) | public function deptProtect($dept, $dept_id): bool
method roleProtect (line 325) | public function roleProtect($roleList, $role_ids): bool
FILE: src/orm/eloquent/app/logic/tool/CrontabLogLogic.php
class CrontabLogLogic (line 15) | class CrontabLogLogic extends BaseLogic
method __construct (line 20) | public function __construct()
FILE: src/orm/eloquent/app/logic/tool/CrontabLogic.php
class CrontabLogic (line 21) | class CrontabLogic extends BaseLogic
method __construct (line 26) | public function __construct()
method add (line 34) | public function add($data): bool
method edit (line 79) | public function edit($id, $data): bool
method destroy (line 133) | public function destroy($ids): bool
method changeStatus (line 156) | public function changeStatus($id, $status): bool
method run (line 176) | public function run($id): bool
FILE: src/orm/eloquent/app/logic/tool/GenerateColumnsLogic.php
class GenerateColumnsLogic (line 16) | class GenerateColumnsLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method saveExtra (line 26) | public function saveExtra($data)
method update (line 89) | public function update($data, $where)
method fieldDispose (line 100) | private function fieldDispose(array $column): array
FILE: src/orm/eloquent/app/logic/tool/GenerateTablesLogic.php
class GenerateTablesLogic (line 23) | class GenerateTablesLogic extends BaseLogic
method __construct (line 32) | public function __construct()
method read (line 39) | public function read($id): GenerateTables
method destroy (line 51) | public function destroy($ids): bool
method loadTable (line 66) | public function loadTable($names, $source): void
method sync (line 111) | public function sync($id)
method preview (line 169) | public function preview($id): array
method genModule (line 247) | public function genModule($id)
method renderData (line 268) | protected function renderData($id): array
method generateFile (line 330) | public function generateFile($id)
method generate (line 348) | public function generate($idsArr): array
method updateMenu (line 369) | public function updateMenu($tables)
method getTableColumns (line 442) | public function getTableColumns($table_id): mixed
method edit (line 458) | public function edit($id, $data): mixed
FILE: src/orm/eloquent/app/model/system/SystemAttachment.php
class SystemAttachment (line 34) | class SystemAttachment extends BaseModel
method searchOriginNameAttr (line 47) | public function searchOriginNameAttr($query, $value)
method searchMimeTypeAttr (line 55) | public function searchMimeTypeAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemCategory.php
class SystemCategory (line 28) | class SystemCategory extends BaseModel
method searchCategoryNameAttr (line 41) | public function searchCategoryNameAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemConfig.php
class SystemConfig (line 30) | class SystemConfig extends BaseModel
method casts (line 40) | protected function casts(): array
FILE: src/orm/eloquent/app/model/system/SystemConfigGroup.php
class SystemConfigGroup (line 25) | class SystemConfigGroup extends BaseModel
method configs (line 38) | public function configs()
method searchNameAttr (line 46) | public function searchNameAttr($query, $value)
method searchCodeAttr (line 54) | public function searchCodeAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemDept.php
class SystemDept (line 30) | class SystemDept extends BaseModel
method scopeAuth (line 43) | public function scopeAuth($query, $value)
method leader (line 57) | public function leader()
FILE: src/orm/eloquent/app/model/system/SystemDictData.php
class SystemDictData (line 30) | class SystemDictData extends BaseModel
method searchKeywordsAttr (line 43) | public function searchKeywordsAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemDictType.php
class SystemDictType (line 26) | class SystemDictType extends BaseModel
method dicts (line 39) | public function dicts()
method searchNameAttr (line 47) | public function searchNameAttr($query, $value)
method searchCodeAttr (line 55) | public function searchCodeAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemLoginLog.php
class SystemLoginLog (line 32) | class SystemLoginLog extends BaseModel
method searchLoginTimeAttr (line 45) | public function searchLoginTimeAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemMail.php
class SystemMail (line 27) | class SystemMail extends BaseModel
method searchFromAttr (line 40) | public function searchFromAttr($query, $value)
method searchEmailAttr (line 48) | public function searchEmailAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemMenu.php
class SystemMenu (line 42) | class SystemMenu extends BaseModel
method searchIdAttr (line 52) | public function searchIdAttr($query, $value)
method searchNameAttr (line 60) | public function searchNameAttr($query, $value)
method searchPathAttr (line 68) | public function searchPathAttr($query, $value)
method searchMenuAttr (line 76) | public function searchMenuAttr($query, $value)
method searchTypeAttr (line 86) | public function searchTypeAttr($query, $value)
FILE: src/orm/eloquent/app/model/system/SystemOperLog.php
class SystemOperLog (line 32) | class SystemOperLog extends BaseModel
FILE: src/orm/eloquent/app/model/system/SystemPost.php
class SystemPost (line 27) | class SystemPost extends BaseModel
FILE: src/orm/eloquent/app/model/system/SystemRole.php
class SystemRole (line 29) | class SystemRole extends BaseModel
method scopeAuth (line 47) | public function scopeAuth($query, $value)
method menus (line 65) | public function menus()
method depts (line 73) | public function depts()
FILE: src/orm/eloquent/app/model/system/SystemRoleDept.php
class SystemRoleDept (line 20) | class SystemRoleDept extends Pivot
FILE: src/orm/eloquent/app/model/system/SystemRoleMenu.php
class SystemRoleMenu (line 20) | class SystemRoleMenu extends Pivot
FILE: src/orm/eloquent/app/model/system/SystemUser.php
class SystemUser (line 37) | class SystemUser extends BaseModel
method searchKeywordAttr (line 55) | public function searchKeywordAttr($query, $value)
method scopeAuth (line 65) | public function scopeAuth($query, $value)
method roles (line 79) | public function roles()
method posts (line 87) | public function posts()
method depts (line 95) | public function depts()
FILE: src/orm/eloquent/app/model/system/SystemUserPost.php
class SystemUserPost (line 20) | class SystemUserPost extends Pivot
FILE: src/orm/eloquent/app/model/system/SystemUserRole.php
class SystemUserRole (line 20) | class SystemUserRole extends Pivot
method getRoleIds (line 30) | public static function getRoleIds($user_id): array
FILE: src/orm/eloquent/app/model/tool/Crontab.php
class Crontab (line 30) | class Crontab extends BaseModel
FILE: src/orm/eloquent/app/model/tool/CrontabLog.php
class CrontabLog (line 26) | class CrontabLog extends BaseModel
FILE: src/orm/eloquent/app/model/tool/GenerateColumns.php
class GenerateColumns (line 14) | class GenerateColumns extends BaseModel
FILE: src/orm/eloquent/app/model/tool/GenerateTables.php
class GenerateTables (line 14) | class GenerateTables extends BaseModel
FILE: src/orm/think/app/logic/system/DatabaseLogic.php
class DatabaseLogic (line 16) | class DatabaseLogic extends BaseLogic
method getDbSource (line 22) | public function getDbSource(): array
method getList (line 37) | public function getList($query): mixed
method getTableList (line 49) | public function getTableList($query, $current_page = 1, $per_page = 10...
method getColumnList (line 98) | public function getColumnList($table, $source): array
method optimizeTable (line 126) | public function optimizeTable($tables)
method fragmentTable (line 138) | public function fragmentTable($tables)
method recycleData (line 150) | public function recycleData($table)
method delete (line 181) | public function delete($table, $ids)
method recovery (line 197) | public function recovery($table, $ids)
FILE: src/orm/think/app/logic/system/SystemAttachmentLogic.php
class SystemAttachmentLogic (line 22) | class SystemAttachmentLogic extends BaseLogic
method __construct (line 27) | public function __construct()
method move (line 37) | public function move($category_id, $ids): mixed
method saveNetworkImage (line 53) | public function saveNetworkImage($url, $config): array
method uploadBase (line 144) | public function uploadBase(string $upload = 'image', bool $local = fal...
method chunkUpload (line 184) | public function chunkUpload($data): array
FILE: src/orm/think/app/logic/system/SystemCategoryLogic.php
class SystemCategoryLogic (line 18) | class SystemCategoryLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method add (line 31) | public function add($data): bool
method edit (line 40) | public function edit($id, $data): bool
method destroy (line 59) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method tree (line 89) | public function tree(array $where = []): array
FILE: src/orm/think/app/logic/system/SystemConfigGroupLogic.php
class SystemConfigGroupLogic (line 19) | class SystemConfigGroupLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method destroy (line 32) | public function destroy($ids): bool
FILE: src/orm/think/app/logic/system/SystemConfigLogic.php
class SystemConfigLogic (line 19) | class SystemConfigLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
method edit (line 48) | public function edit($id, $data): bool
method batchUpdate (line 62) | public function batchUpdate($group_id, $config): bool
method getData (line 89) | public function getData($code): array
method getGroup (line 102) | public function getGroup($config): array
FILE: src/orm/think/app/logic/system/SystemDeptLogic.php
class SystemDeptLogic (line 19) | class SystemDeptLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 32) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 64) | public function destroy($ids): bool
method handleData (line 81) | protected function handleData($data)
method tree (line 99) | public function tree(array $where = []): array
method accessDept (line 117) | public function accessDept(array $where = []): array
FILE: src/orm/think/app/logic/system/SystemDictDataLogic.php
class SystemDictDataLogic (line 19) | class SystemDictDataLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
FILE: src/orm/think/app/logic/system/SystemDictTypeLogic.php
class SystemDictTypeLogic (line 18) | class SystemDictTypeLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method add (line 31) | public function add($data): mixed
method edit (line 43) | public function edit($id, $data): mixed
method destroy (line 62) | public function destroy($ids): bool
method getDictAll (line 83) | public function getDictAll(): array
method packageDict (line 100) | private function packageDict($array, $field): array
FILE: src/orm/think/app/logic/system/SystemLoginLogLogic.php
class SystemLoginLogLogic (line 17) | class SystemLoginLogLogic extends BaseLogic
method __construct (line 22) | public function __construct()
method loginChart (line 31) | public function loginChart(): array
method loginBarChart (line 59) | public function loginBarChart(): array
FILE: src/orm/think/app/logic/system/SystemMailLogic.php
class SystemMailLogic (line 16) | class SystemMailLogic extends BaseLogic
method __construct (line 21) | public function __construct()
FILE: src/orm/think/app/logic/system/SystemMenuLogic.php
class SystemMenuLogic (line 20) | class SystemMenuLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 54) | public function destroy($ids): bool
method handleData (line 67) | protected function handleData($data)
method tree (line 85) | public function tree($where = []): array
method auth (line 101) | public function auth(): array
method getAllMenus (line 119) | public function getAllMenus(): array
method getAllAuth (line 130) | public function getAllAuth(): array
method getAuthByRole (line 142) | public function getAuthByRole($roleIds): array
method getMenuByRole (line 158) | public function getMenuByRole($roleIds): array
method filterMenuIds (line 177) | public function filterMenuIds(array &$roleData): array
FILE: src/orm/think/app/logic/system/SystemOperLogLogic.php
class SystemOperLogLogic (line 16) | class SystemOperLogLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method getOwnOperLogList (line 31) | public function getOwnOperLogList($where): array
FILE: src/orm/think/app/logic/system/SystemPostLogic.php
class SystemPostLogic (line 18) | class SystemPostLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method accessPost (line 33) | public function accessPost(array $where = []): array
method import (line 43) | public function import($file)
method export (line 75) | public function export($where = [])
FILE: src/orm/think/app/logic/system/SystemRoleLogic.php
class SystemRoleLogic (line 20) | class SystemRoleLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): bool
method edit (line 42) | public function edit($id, $data): bool
method destroy (line 55) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method accessRole (line 88) | public function accessRole(array $where = []): array
method getMenuIdsByRoleIds (line 104) | public function getMenuIdsByRoleIds($ids): array
method getMenuByRole (line 121) | public function getMenuByRole($id): array
method saveMenuPermission (line 137) | public function saveMenuPermission($id, $menu_ids): mixed
FILE: src/orm/think/app/logic/system/SystemUserLogic.php
class SystemUserLogic (line 23) | class SystemUserLogic extends BaseLogic
method __construct (line 29) | public function __construct()
method indexList (line 39) | public function indexList($where): array
method openUserList (line 52) | public function openUserList($where): array
method getUser (line 64) | public function getUser($id): array
method read (line 79) | public function read($id): array
method add (line 96) | public function add($data): mixed
method edit (line 129) | public function edit($id, $data): mixed
method destroy (line 173) | public function destroy($ids): bool
method login (line 212) | public function login(string $username, string $password, string $type...
method updateInfo (line 258) | public function updateInfo($id, $data): bool
method modifyPassword (line 271) | public function modifyPassword($adminId, $oldPassword, $newPassword): ...
method authEdit (line 285) | public function authEdit($id, $data)
method deptProtect (line 305) | public function deptProtect($dept, $dept_id): bool
method roleProtect (line 324) | public function roleProtect($roleList, $role_ids): bool
FILE: src/orm/think/app/logic/tool/CrontabLogLogic.php
class CrontabLogLogic (line 15) | class CrontabLogLogic extends BaseLogic
method __construct (line 20) | public function __construct()
FILE: src/orm/think/app/logic/tool/CrontabLogic.php
class CrontabLogic (line 21) | class CrontabLogic extends BaseLogic
method __construct (line 26) | public function __construct()
method add (line 34) | public function add($data): bool
method edit (line 79) | public function edit($id, $data): bool
method destroy (line 133) | public function destroy($ids): bool
method changeStatus (line 156) | public function changeStatus($id, $status): bool
method run (line 176) | public function run($id): bool
FILE: src/orm/think/app/logic/tool/GenerateColumnsLogic.php
class GenerateColumnsLogic (line 16) | class GenerateColumnsLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method saveExtra (line 26) | public function saveExtra($data)
method update (line 89) | public function update($data, $where)
method fieldDispose (line 100) | private function fieldDispose(array $column): array
FILE: src/orm/think/app/logic/tool/GenerateTablesLogic.php
class GenerateTablesLogic (line 23) | class GenerateTablesLogic extends BaseLogic
method __construct (line 32) | public function __construct()
method destroy (line 44) | public function destroy($ids): bool
method loadTable (line 61) | public function loadTable($names, $source): void
method sync (line 106) | public function sync($id)
method preview (line 162) | public function preview($id): array
method genModule (line 240) | public function genModule($id)
method renderData (line 261) | protected function renderData($id): array
method generateFile (line 319) | public function generateFile($id)
method generate (line 337) | public function generate($idsArr): array
method updateMenu (line 358) | public function updateMenu($tables)
method getTableColumns (line 432) | public function getTableColumns($table_id): mixed
method edit (line 444) | public function edit($id, $data): mixed
FILE: src/orm/think/app/model/system/SystemAttachment.php
class SystemAttachment (line 34) | class SystemAttachment extends BaseModel
method searchOriginNameAttr (line 47) | public function searchOriginNameAttr($query, $value)
method searchMimeTypeAttr (line 55) | public function searchMimeTypeAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemCategory.php
class SystemCategory (line 28) | class SystemCategory extends BaseModel
method searchCategoryNameAttr (line 41) | public function searchCategoryNameAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemConfig.php
class SystemConfig (line 30) | class SystemConfig extends BaseModel
method getConfigSelectDataAttr (line 40) | public function getConfigSelectDataAttr($value)
FILE: src/orm/think/app/model/system/SystemConfigGroup.php
class SystemConfigGroup (line 25) | class SystemConfigGroup extends BaseModel
method configs (line 38) | public function configs()
method searchNameAttr (line 46) | public function searchNameAttr($query, $value)
method searchCodeAttr (line 54) | public function searchCodeAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemDept.php
class SystemDept (line 30) | class SystemDept extends BaseModel
method scopeAuth (line 43) | public function scopeAuth($query, $value)
method leader (line 57) | public function leader()
FILE: src/orm/think/app/model/system/SystemDictData.php
class SystemDictData (line 30) | class SystemDictData extends BaseModel
method searchKeywordsAttr (line 43) | public function searchKeywordsAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemDictType.php
class SystemDictType (line 26) | class SystemDictType extends BaseModel
method dicts (line 39) | public function dicts()
FILE: src/orm/think/app/model/system/SystemLoginLog.php
class SystemLoginLog (line 32) | class SystemLoginLog extends BaseModel
method searchLoginTimeAttr (line 45) | public function searchLoginTimeAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemMail.php
class SystemMail (line 27) | class SystemMail extends BaseModel
method searchFromAttr (line 40) | public function searchFromAttr($query, $value)
method searchEmailAttr (line 48) | public function searchEmailAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemMenu.php
class SystemMenu (line 42) | class SystemMenu extends BaseModel
method searchIdAttr (line 52) | public function searchIdAttr($query, $value)
method searchNameAttr (line 57) | public function searchNameAttr($query, $value)
method searchPathAttr (line 62) | public function searchPathAttr($query, $value)
method searchMenuAttr (line 67) | public function searchMenuAttr($query, $value)
method searchTypeAttr (line 77) | public function searchTypeAttr($query, $value)
FILE: src/orm/think/app/model/system/SystemOperLog.php
class SystemOperLog (line 32) | class SystemOperLog extends BaseModel
FILE: src/orm/think/app/model/system/SystemPost.php
class SystemPost (line 27) | class SystemPost extends BaseModel
FILE: src/orm/think/app/model/system/SystemRole.php
class SystemRole (line 29) | class SystemRole extends BaseModel
method scopeAuth (line 47) | public function scopeAuth($query, $value)
method menus (line 65) | public function menus()
method depts (line 73) | public function depts()
FILE: src/orm/think/app/model/system/SystemRoleDept.php
class SystemRoleDept (line 20) | class SystemRoleDept extends Pivot
FILE: src/orm/think/app/model/system/SystemRoleMenu.php
class SystemRoleMenu (line 20) | class SystemRoleMenu extends Pivot
FILE: src/orm/think/app/model/system/SystemUser.php
class SystemUser (line 37) | class SystemUser extends BaseModel
method searchKeywordAttr (line 52) | public function searchKeywordAttr($query, $value)
method scopeAuth (line 62) | public function scopeAuth($query, $value)
method roles (line 76) | public function roles()
method posts (line 84) | public function posts()
method depts (line 92) | public function depts()
FILE: src/orm/think/app/model/system/SystemUserPost.php
class SystemUserPost (line 20) | class SystemUserPost extends Pivot
FILE: src/orm/think/app/model/system/SystemUserRole.php
class SystemUserRole (line 20) | class SystemUserRole extends Pivot
method getRoleIds (line 31) | public static function getRoleIds($user_id): array
FILE: src/orm/think/app/model/tool/Crontab.php
class Crontab (line 30) | class Crontab extends BaseModel
FILE: src/orm/think/app/model/tool/CrontabLog.php
class CrontabLog (line 26) | class CrontabLog extends BaseModel
FILE: src/orm/think/app/model/tool/GenerateColumns.php
class GenerateColumns (line 14) | class GenerateColumns extends BaseModel
method getOptionsAttr (line 24) | public function getOptionsAttr($value)
FILE: src/orm/think/app/model/tool/GenerateTables.php
class GenerateTables (line 14) | class GenerateTables extends BaseModel
method getOptionsAttr (line 24) | public function getOptionsAttr($value)
FILE: src/plugin/saiadmin/app/cache/ConfigCache.php
class ConfigCache (line 17) | class ConfigCache
method cacheConfig (line 23) | public static function cacheConfig(): array
method getConfig (line 35) | public static function getConfig(string $code = ''): array
method setConfig (line 59) | public static function setConfig(string $code): array
method clearConfig (line 79) | public static function clearConfig(string $code): bool
method clear (line 89) | public static function clear(): bool
FILE: src/plugin/saiadmin/app/cache/DictCache.php
class DictCache (line 18) | class DictCache
method cacheConfig (line 24) | public static function cacheConfig(): array
method getDictAll (line 35) | public static function getDictAll(): array
method getDict (line 56) | public static function getDict($code): array
method setDictAll (line 69) | public static function setDictAll(): array
method clear (line 81) | public static function clear(): bool
FILE: src/plugin/saiadmin/app/cache/ReflectionCache.php
class ReflectionCache (line 19) | class ReflectionCache
method cacheConfig (line 25) | public static function cacheConfig(): array
method getNoNeedLogin (line 38) | public static function getNoNeedLogin(string $controller): array
method getPermissionAttributes (line 65) | public static function getPermissionAttributes(string $controller, str...
method clear (line 98) | public static function clear(): bool
FILE: src/plugin/saiadmin/app/cache/UserAuthCache.php
class UserAuthCache (line 18) | class UserAuthCache
method cacheConfig (line 24) | public static function cacheConfig(): array
method getUserAuth (line 38) | public static function getUserAuth($uid): array
method setUserAuth (line 62) | public static function setUserAuth($uid): array
method getAllAuth (line 91) | public static function getAllAuth(): array
method clearUserAuth (line 111) | public static function clearUserAuth($uid): bool
method clearUserAuthByRoleId (line 120) | public static function clearUserAuthByRoleId($role_id): bool
method clear (line 138) | public static function clear(): bool
FILE: src/plugin/saiadmin/app/cache/UserInfoCache.php
class UserInfoCache (line 17) | class UserInfoCache
method cacheConfig (line 23) | public static function cacheConfig(): array
method getUserInfo (line 37) | public static function getUserInfo($uid): array
method setUserInfo (line 62) | public static function setUserInfo($uid): array
method clearUserInfo (line 88) | public static function clearUserInfo($uid): bool
method clearUserInfoByDeptId (line 97) | public static function clearUserInfoByDeptId($dept_id): bool
method clearUserInfoByRoleId (line 114) | public static function clearUserInfoByRoleId($role_id): bool
method clearUserInfoByPostId (line 131) | public static function clearUserInfoByPostId($post_id): bool
FILE: src/plugin/saiadmin/app/cache/UserMenuCache.php
class UserMenuCache (line 18) | class UserMenuCache
method cacheConfig (line 24) | public static function cacheConfig(): array
method getUserMenu (line 36) | public static function getUserMenu($uid): array
method setUserMenu (line 60) | public static function setUserMenu($uid): array
method clearUserMenu (line 84) | public static function clearUserMenu($uid): bool
method clearMenuCache (line 94) | public static function clearMenuCache(): bool
FILE: src/plugin/saiadmin/app/controller/InstallController.php
class InstallController (line 18) | class InstallController extends OpenController
method index (line 36) | public function index()
method install (line 60) | public function install(Request $request)
method generateConfig (line 161) | protected function generateConfig()
method getPdo (line 349) | protected function getPdo($host, $username, $password, $port, $databas...
FILE: src/plugin/saiadmin/app/controller/LoginController.php
class LoginController (line 18) | class LoginController extends BaseController
method captcha (line 29) | public function captcha() : Response
method login (line 44) | public function login(Request $request): Response
FILE: src/plugin/saiadmin/app/controller/SystemController.php
class SystemController (line 28) | class SystemController extends BaseController
method userInfo (line 34) | public function userInfo(): Response
method dictAll (line 61) | public function dictAll(): Response
method menu (line 71) | public function menu(): Response
method getResourceCategory (line 82) | #[Permission('附件列表读取', 'core:system:resource')]
method getResourceList (line 95) | #[Permission('附件列表读取', 'core:system:resource')]
method getUserList (line 114) | #[Permission('用户列表读取', 'core:system:user')]
method saveNetworkImage (line 129) | #[Permission('上传网络图片', 'core:system:uploadImage')]
method uploadImage (line 142) | #[Permission('上传图片', 'core:system:uploadImage')]
method uploadFile (line 156) | #[Permission('上传文件', 'core:system:uploadFile')]
method chunkUpload (line 170) | #[Permission('上传文件', 'core:system:chunkUpload')]
method getLoginLogList (line 183) | public function getLoginLogList(): Response
method getOperationLogList (line 196) | public function getOperationLogList(): Response
method clearAllCache (line 208) | public function clearAllCache(): Response
method statistics (line 220) | #[Permission('工作台数据统计', 'core:console:list')]
method loginChart (line 243) | #[Permission('工作台数据统计', 'core:console:list')]
method loginBarChart (line 255) | #[Permission('工作台数据统计', 'core:console:list')]
FILE: src/plugin/saiadmin/app/controller/system/DataBaseController.php
class DataBaseController (line 18) | class DataBaseController extends BaseController
method __construct (line 23) | public function __construct()
method source (line 33) | public function source(): Response
method index (line 44) | #[Permission('数据表列表', 'core:database:index')]
method recycle (line 60) | #[Permission('回收站数据', 'core:recycle:index')]
method delete (line 73) | #[Permission('回收站销毁', 'core:recycle:edit')]
method recovery (line 94) | #[Permission('回收站恢复', 'core:recycle:edit')]
method detailed (line 115) | #[Permission('数据表字段', 'core:database:index')]
method optimize (line 128) | #[Permission('数据表优化表', 'core:database:edit')]
method fragment (line 139) | #[Permission('数据表清理碎片', 'core:database:edit')]
FILE: src/plugin/saiadmin/app/controller/system/SystemAttachmentController.php
class SystemAttachmentController (line 18) | class SystemAttachmentController extends BaseController
method __construct (line 23) | public function __construct()
method index (line 34) | #[Permission('附件数据列表', 'core:attachment:index')]
method update (line 54) | #[Permission('附件数据修改', 'core:attachment:edit')]
method destroy (line 71) | #[Permission('附件数据删除', 'core:attachment:edit')]
method move (line 91) | #[Permission('附件移动分类', 'core:attachment:edit')]
FILE: src/plugin/saiadmin/app/controller/system/SystemCategoryController.php
class SystemCategoryController (line 19) | class SystemCategoryController extends BaseController
method __construct (line 24) | public function __construct()
method index (line 36) | #[Permission('附件分类列表', 'core:attachment:index')]
method read (line 51) | #[Permission('附件分类读取', 'core:attachment:index')]
method save (line 69) | #[Permission('附件分类添加', 'core:attachment:edit')]
method update (line 87) | #[Permission('附件分类修改', 'core:attachment:edit')]
method destroy (line 105) | #[Permission('附件分类删除', 'core:attachment:edit')]
FILE: src/plugin/saiadmin/app/controller/system/SystemConfigController.php
class SystemConfigController (line 21) | class SystemConfigController extends BaseController
method __construct (line 26) | public function __construct()
method index (line 38) | #[Permission('系统设置列表', 'core:config:index')]
method save (line 58) | #[Permission('系统设置管理', 'core:config:edit')]
method update (line 76) | #[Permission('系统设置管理', 'core:config:edit')]
method destroy (line 94) | #[Permission('系统设置管理', 'core:config:edit')]
method batchUpdate (line 114) | #[Permission('系统设置修改', 'core:config:update')]
FILE: src/plugin/saiadmin/app/controller/system/SystemConfigGroupController.php
class SystemConfigGroupController (line 23) | class SystemConfigGroupController extends BaseController
method __construct (line 28) | public function __construct()
method index (line 40) | #[Permission('系统设置列表', 'core:config:index')]
method save (line 57) | #[Permission('系统设置管理', 'core:config:edit')]
method update (line 75) | #[Permission('系统设置管理', 'core:config:edit')]
method destroy (line 94) | #[Permission('系统设置管理', 'core:config:edit')]
method email (line 114) | #[Permission('系统设置修改', 'core:config:update')]
FILE: src/plugin/saiadmin/app/controller/system/SystemDeptController.php
class SystemDeptController (line 19) | class SystemDeptController extends BaseController
method __construct (line 24) | public function __construct()
method index (line 36) | #[Permission('部门数据列表', 'core:dept:index')]
method read (line 53) | #[Permission('部门数据读取', 'core:dept:read')]
method save (line 71) | #[Permission('部门数据添加', 'core:dept:save')]
method update (line 89) | #[Permission('部门数据修改','core:dept:update')]
method destroy (line 107) | #[Permission('部门数据删除','core:dept:destroy')]
method accessDept (line 127) | public function accessDept(Request $request) : Response
FILE: src/plugin/saiadmin/app/controller/system/SystemDictDataController.php
class SystemDictDataController (line 20) | class SystemDictDataController extends BaseController
method __construct (line 25) | public function __construct()
method index (line 37) | #[Permission('数据字典列表', 'core:dict:index')]
method save (line 58) | #[Permission('数据字典管理', 'core:dict:edit')]
method update (line 77) | #[Permission('数据字典管理', 'core:dict:edit')]
method destroy (line 96) | #[Permission('数据字典管理', 'core:dict:edit')]
FILE: src/plugin/saiadmin/app/controller/system/SystemDictTypeController.php
class SystemDictTypeController (line 21) | class SystemDictTypeController extends BaseController
method __construct (line 26) | public function __construct()
method index (line 38) | #[Permission('数据字典列表', 'core:dict:index')]
method save (line 56) | #[Permission('数据字典管理', 'core:dict:edit')]
method update (line 75) | #[Permission('数据字典管理', 'core:dict:edit')]
method destroy (line 94) | #[Permission('数据字典管理', 'core:dict:edit')]
FILE: src/plugin/saiadmin/app/controller/system/SystemLogController.php
class SystemLogController (line 19) | class SystemLogController extends BaseController
method getLoginLogPageList (line 27) | #[Permission('登录日志列表', 'core:logs:login')]
method deleteLoginLog (line 47) | #[Permission('登录日志删除', 'core:logs:deleteLogin')]
method getOperLogPageList (line 65) | #[Permission('操作日志列表', 'core:logs:Oper')]
method deleteOperLog (line 87) | #[Permission('操作日志删除', 'core:logs:deleteOper')]
FILE: src/plugin/saiadmin/app/controller/system/SystemMailController.php
class SystemMailController (line 19) | class SystemMailController extends BaseController
method __construct (line 24) | public function __construct()
method index (line 36) | #[Permission('邮件日志列表', 'core:email:index')]
method destroy (line 57) | #[Permission('邮件日志删除', 'core:email:destroy')]
FILE: src/plugin/saiadmin/app/controller/system/SystemMenuController.php
class SystemMenuController (line 20) | class SystemMenuController extends BaseController
method __construct (line 25) | public function __construct()
method index (line 37) | #[Permission('菜单数据列表', 'core:menu:index')]
method read (line 55) | #[Permission('菜单数据读取', 'core:menu:read')]
method save (line 73) | #[Permission('菜单数据添加', 'core:menu:save')]
method update (line 92) | #[Permission('菜单数据修改', 'core:menu:update')]
method destroy (line 111) | #[Permission('菜单数据删除', 'core:menu:destroy')]
method accessMenu (line 132) | public function accessMenu(Request $request): Response
FILE: src/plugin/saiadmin/app/controller/system/SystemPostController.php
class SystemPostController (line 19) | class SystemPostController extends BaseController
method __construct (line 24) | public function __construct()
method index (line 36) | #[Permission('岗位数据列表', 'core:post:index')]
method read (line 54) | #[Permission('岗位数据读取', 'core:post:read')]
method save (line 72) | #[Permission('岗位数据添加', 'core:post:save')]
method update (line 90) | #[Permission('岗位数据修改', 'core:post:update')]
method destroy (line 108) | #[Permission('岗位数据删除', 'core:post:destroy')]
method import (line 128) | #[Permission('岗位数据导入', 'core:post:import')]
method export (line 144) | #[Permission('岗位数据导出', 'core:post:export')]
method downloadTemplate (line 159) | public function downloadTemplate(): Response
method accessPost (line 170) | public function accessPost(Request $request): Response
FILE: src/plugin/saiadmin/app/controller/system/SystemRoleController.php
class SystemRoleController (line 22) | class SystemRoleController extends BaseController
method __construct (line 27) | public function __construct()
method index (line 39) | #[Permission('角色数据列表', 'core:role:index')]
method read (line 60) | #[Permission('角色数据读取', 'core:role:read')]
method save (line 78) | #[Permission('角色数据添加', 'core:role:save')]
method update (line 96) | #[Permission('角色数据修改', 'core:role:update')]
method destroy (line 114) | #[Permission('角色数据删除', 'core:role:destroy')]
method getMenuByRole (line 134) | #[Permission('角色数据列表', 'core:role:index')]
method menuPermission (line 147) | #[Permission('角色菜单权限', 'core:role:menu')]
method accessRole (line 161) | public function accessRole(Request $request): Response
FILE: src/plugin/saiadmin/app/controller/system/SystemServerController.php
class SystemServerController (line 19) | class SystemServerController extends BaseController
method __construct (line 24) | public function __construct()
method monitor (line 34) | #[Permission('服务监控', 'core:server:monitor')]
method cache (line 50) | #[Permission('缓存信息', 'core:server:cache')]
method clear (line 73) | #[Permission('缓存数据清理', 'core:server:clear')]
FILE: src/plugin/saiadmin/app/controller/system/SystemUserController.php
class SystemUserController (line 22) | class SystemUserController extends BaseController
method __construct (line 27) | public function __construct()
method index (line 39) | #[Permission('用户数据列表', 'core:user:index')]
method read (line 59) | #[Permission('用户数据读取', 'core:user:read')]
method save (line 77) | #[Permission('用户数据保存', 'core:user:save')]
method update (line 95) | #[Permission('用户数据更新', 'core:user:update')]
method destroy (line 113) | #[Permission('用户数据删除', 'core:user:destroy')]
method clearCache (line 130) | #[Permission('清理用户缓存', 'core:user:cache')]
method initUserPassword (line 145) | #[Permission('修改用户密码', 'core:user:password')]
method setHomePage (line 164) | #[Permission('设置用户首页', 'core:user:home')]
method updateInfo (line 180) | #[Permission('用户修改资料')]
method modifyPassword (line 201) | #[Permission('用户修改密码')]
FILE: src/plugin/saiadmin/app/controller/tool/CrontabController.php
class CrontabController (line 21) | class CrontabController extends BaseController
method __construct (line 26) | public function __construct()
method index (line 38) | #[Permission('定时任务列表', 'tool:crontab:index')]
method save (line 57) | #[Permission('定时任务添加', 'tool:crontab:edit')]
method update (line 75) | #[Permission('定时任务修改', 'tool:crontab:edit')]
method destroy (line 93) | #[Permission('定时任务删除', 'tool:crontab:edit')]
method changeStatus (line 113) | #[Permission('定时任务状态修改', 'tool:crontab:edit')]
method run (line 134) | #[Permission('定时任务执行', 'tool:crontab:run')]
method logPageList (line 151) | #[Permission('定时任务日志', 'tool:crontab:index')]
method deleteCrontabLog (line 169) | #[Permission('定时任务日志删除', 'tool:crontab:edit')]
FILE: src/plugin/saiadmin/app/controller/tool/GenerateTablesController.php
class GenerateTablesController (line 20) | class GenerateTablesController extends BaseController
method __construct (line 25) | public function __construct()
method index (line 37) | #[Permission('代码生成列表', 'tool:code:index')]
method read (line 53) | #[Permission('代码生成列表', 'tool:code:index')]
method update (line 71) | #[Permission('代码生成修改', 'tool:code:edit')]
method destroy (line 89) | #[Permission('代码生成删除', 'tool:code:edit')]
method loadTable (line 109) | #[Permission('代码生成装载', 'tool:code:edit')]
method sync (line 123) | #[Permission('代码生成同步表结构', 'tool:code:edit')]
method preview (line 134) | #[Permission('代码生成预览', 'tool:code:edit')]
method generate (line 145) | #[Permission('代码生成文件', 'tool:code:edit')]
method generateFile (line 156) | #[Permission('代码生成到模块', 'tool:code:edit')]
method getTableColumns (line 170) | #[Permission('代码生成读取表字段', 'tool:code:index')]
FILE: src/plugin/saiadmin/app/event/SystemUser.php
class SystemUser (line 13) | class SystemUser
method login (line 19) | public function login($item)
method operateLog (line 42) | public function operateLog(): bool
method getServiceName (line 70) | protected function getServiceName(): string
method filterParams (line 87) | protected function filterParams($params): string
method getIpLocation (line 101) | protected function getIpLocation($ip): string
method getBrowser (line 125) | protected function getBrowser($user_agent): string
method getOs (line 147) | protected function getOs($user_agent): string
FILE: src/plugin/saiadmin/app/exception/Handler.php
class Handler (line 18) | class Handler extends ExceptionHandler
method report (line 24) | public function report(Throwable $exception)
method render (line 43) | public function render(Request $request, Throwable $exception): Response
FILE: src/plugin/saiadmin/app/functions.php
function getCurrentInfo (line 18) | function getCurrentInfo(): bool|array
function fastRoute (line 39) | function fastRoute(string $name, string $controller): void
function downloadFile (line 65) | function downloadFile($file_name): Response
function formatBytes (line 82) | function formatBytes($bytes): string
function getConfigGroup (line 98) | function getConfigGroup($group): array
function dictDataList (line 110) | function dictDataList(string $code): array
FILE: src/plugin/saiadmin/app/logic/system/DatabaseLogic.php
class DatabaseLogic (line 16) | class DatabaseLogic extends BaseLogic
method getDbSource (line 22) | public function getDbSource(): array
method getList (line 37) | public function getList($query): mixed
method getTableList (line 49) | public function getTableList($query, $current_page = 1, $per_page = 10...
method getColumnList (line 98) | public function getColumnList($table, $source): array
method optimizeTable (line 126) | public function optimizeTable($tables)
method fragmentTable (line 138) | public function fragmentTable($tables)
method recycleData (line 150) | public function recycleData($table)
method delete (line 181) | public function delete($table, $ids)
method recovery (line 197) | public function recovery($table, $ids)
FILE: src/plugin/saiadmin/app/logic/system/SystemAttachmentLogic.php
class SystemAttachmentLogic (line 22) | class SystemAttachmentLogic extends BaseLogic
method __construct (line 27) | public function __construct()
method move (line 37) | public function move($category_id, $ids): mixed
method saveNetworkImage (line 53) | public function saveNetworkImage($url, $config): array
method uploadBase (line 144) | public function uploadBase(string $upload = 'image', bool $local = fal...
method chunkUpload (line 184) | public function chunkUpload($data): array
FILE: src/plugin/saiadmin/app/logic/system/SystemCategoryLogic.php
class SystemCategoryLogic (line 18) | class SystemCategoryLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method add (line 31) | public function add($data): bool
method edit (line 40) | public function edit($id, $data): bool
method destroy (line 59) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method tree (line 89) | public function tree(array $where = []): array
FILE: src/plugin/saiadmin/app/logic/system/SystemConfigGroupLogic.php
class SystemConfigGroupLogic (line 19) | class SystemConfigGroupLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method destroy (line 32) | public function destroy($ids): bool
FILE: src/plugin/saiadmin/app/logic/system/SystemConfigLogic.php
class SystemConfigLogic (line 19) | class SystemConfigLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
method edit (line 48) | public function edit($id, $data): bool
method batchUpdate (line 62) | public function batchUpdate($group_id, $config): bool
method getData (line 89) | public function getData($code): array
method getGroup (line 102) | public function getGroup($config): array
FILE: src/plugin/saiadmin/app/logic/system/SystemDeptLogic.php
class SystemDeptLogic (line 19) | class SystemDeptLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 32) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 64) | public function destroy($ids): bool
method handleData (line 81) | protected function handleData($data)
method tree (line 99) | public function tree(array $where = []): array
method accessDept (line 117) | public function accessDept(array $where = []): array
FILE: src/plugin/saiadmin/app/logic/system/SystemDictDataLogic.php
class SystemDictDataLogic (line 19) | class SystemDictDataLogic extends BaseLogic
method __construct (line 24) | public function __construct()
method add (line 34) | public function add($data): mixed
FILE: src/plugin/saiadmin/app/logic/system/SystemDictTypeLogic.php
class SystemDictTypeLogic (line 18) | class SystemDictTypeLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method add (line 31) | public function add($data): mixed
method edit (line 43) | public function edit($id, $data): mixed
method destroy (line 62) | public function destroy($ids): bool
method getDictAll (line 83) | public function getDictAll(): array
method packageDict (line 100) | private function packageDict($array, $field): array
FILE: src/plugin/saiadmin/app/logic/system/SystemLoginLogLogic.php
class SystemLoginLogLogic (line 17) | class SystemLoginLogLogic extends BaseLogic
method __construct (line 22) | public function __construct()
method loginChart (line 31) | public function loginChart(): array
method loginBarChart (line 59) | public function loginBarChart(): array
FILE: src/plugin/saiadmin/app/logic/system/SystemMailLogic.php
class SystemMailLogic (line 16) | class SystemMailLogic extends BaseLogic
method __construct (line 21) | public function __construct()
FILE: src/plugin/saiadmin/app/logic/system/SystemMenuLogic.php
class SystemMenuLogic (line 20) | class SystemMenuLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): mixed
method edit (line 42) | public function edit($id, $data): mixed
method destroy (line 54) | public function destroy($ids): bool
method handleData (line 67) | protected function handleData($data)
method tree (line 85) | public function tree($where = []): array
method auth (line 101) | public function auth(): array
method getAllMenus (line 119) | public function getAllMenus(): array
method getAllAuth (line 130) | public function getAllAuth(): array
method getAuthByRole (line 142) | public function getAuthByRole($roleIds): array
method getMenuByRole (line 158) | public function getMenuByRole($roleIds): array
method filterMenuIds (line 177) | public function filterMenuIds(array &$roleData): array
FILE: src/plugin/saiadmin/app/logic/system/SystemOperLogLogic.php
class SystemOperLogLogic (line 16) | class SystemOperLogLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method getOwnOperLogList (line 31) | public function getOwnOperLogList($where): array
FILE: src/plugin/saiadmin/app/logic/system/SystemPostLogic.php
class SystemPostLogic (line 18) | class SystemPostLogic extends BaseLogic
method __construct (line 23) | public function __construct()
method accessPost (line 33) | public function accessPost(array $where = []): array
method import (line 43) | public function import($file)
method export (line 75) | public function export($where = [])
FILE: src/plugin/saiadmin/app/logic/system/SystemRoleLogic.php
class SystemRoleLogic (line 20) | class SystemRoleLogic extends BaseLogic
method __construct (line 25) | public function __construct()
method add (line 33) | public function add($data): bool
method edit (line 42) | public function edit($id, $data): bool
method destroy (line 55) | public function destroy($ids): bool
method handleData (line 72) | protected function handleData($data)
method accessRole (line 88) | public function accessRole(array $where = []): array
method getMenuIdsByRoleIds (line 104) | public function getMenuIdsByRoleIds($ids): array
method getMenuByRole (line 121) | public function getMenuByRole($id): array
method saveMenuPermission (line 137) | public function saveMenuPermission($id, $menu_ids): mixed
FILE: src/plugin/saiadmin/app/logic/system/SystemUserLogic.php
class SystemUserLogic (line 23) | class SystemUserLogic extends BaseLogic
method __construct (line 29) | public function __construct()
method indexList (line 39) | public function indexList($where): array
method openUserList (line 52) | public function openUserList($where): array
method getUser (line 64) | public function getUser($id): array
method read (line 79) | public function read($id): array
method add (line 96) | public function add($data): mixed
method edit (line 129) | public function edit($id, $data): mixed
method destroy (line 173) | public function destroy($ids): bool
method login (line 212) | public function login(string $username, string $password, string $type...
method updateInfo (line 258) | public function updateInfo($id, $data): bool
method modifyPassword (line 271) | public function modifyPassword($adminId, $oldPassword, $newPassword): ...
method authEdit (line 285) | public function authEdit($id, $data)
method deptProtect (line 305) | public function deptProtect($dept, $dept_id): bool
method roleProtect (line 324) | public function roleProtect($roleList, $role_ids): bool
FILE: src/plugin/saiadmin/app/logic/tool/CrontabLogLogic.php
class CrontabLogLogic (line 15) | class CrontabLogLogic extends BaseLogic
method __construct (line 20) | public function __construct()
FILE: src/plugin/saiadmin/app/logic/tool/CrontabLogic.php
class CrontabLogic (line 21) | class CrontabLogic extends BaseLogic
method __construct (line 26) | public function __construct()
method add (line 34) | public function add($data): bool
method edit (line 79) | public function edit($id, $data): bool
method destroy (line 133) | public function destroy($ids): bool
method changeStatus (line 156) | public function changeStatus($id, $status): bool
method run (line 176) | public function run($id): bool
FILE: src/plugin/saiadmin/app/logic/tool/GenerateColumnsLogic.php
class GenerateColumnsLogic (line 16) | class GenerateColumnsLogic extends BaseLogic
method __construct (line 21) | public function __construct()
method saveExtra (line 26) | public function saveExtra($data)
method update (line 89) | public function update($data, $where)
method fieldDispose (line 100) | private function fieldDispose(array $column): array
FILE: src/plugin/saiadmin/app/logic/tool/GenerateTablesLogic.php
class GenerateTablesLogic (line 23) | class GenerateTablesLogic extends BaseLogic
method __construct (line 32) | public function __construct()
method destroy (line 44) | public function destroy($ids): bool
method loadTable (line 61) | public function loadTable($names, $source): void
method sync (line 106) | public function sync($id)
method preview (line 161) | public function preview($id): array
method genModule (line 239) | public function genModule($id)
method renderData (line 260) | protected function renderData($id): array
method generateFile (line 318) | public function generateFile($id)
method generate (line 336) | public function generate($idsArr): array
method updateMenu (line 357) | public function updateMenu($tables)
method getTableColumns (line 431) | public function getTableColumns($table_id): mixed
method edit (line 443) | public function edit($id, $data): mixed
FILE: src/plugin/saiadmin/app/middleware/CheckAuth.php
class CheckAuth (line 19) | class CheckAuth implements MiddlewareInterface
method process (line 22) | public function process(Request $request, callable $handler) : Response
method checkPermissions (line 64) | private function checkPermissions(array $attr, array $userPermissions)...
FILE: src/plugin/saiadmin/app/middleware/CheckLogin.php
class CheckLogin (line 19) | class CheckLogin implements MiddlewareInterface
method process (line 21) | public function process(Request $request, callable $handler): Response
FILE: src/plugin/saiadmin/app/middleware/CrossDomain.php
class CrossDomain (line 16) | class CrossDomain implements MiddlewareInterface
method process (line 18) | public function process(Request $request, callable $handler) : Response
FILE: src/plugin/saiadmin/app/middleware/SystemLog.php
class SystemLog (line 16) | class SystemLog implements MiddlewareInterface
method process (line 23) | public function process(Request $request, callable $handler): Response
FILE: src/plugin/saiadmin/app/model/system/SystemAttachment.php
class SystemAttachment (line 34) | class SystemAttachment extends BaseModel
method searchOriginNameAttr (line 47) | public function searchOriginNameAttr($query, $value)
method searchMimeTypeAttr (line 55) | public function searchMimeTypeAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemCategory.php
class SystemCategory (line 28) | class SystemCategory extends BaseModel
method searchCategoryNameAttr (line 41) | public function searchCategoryNameAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemConfig.php
class SystemConfig (line 30) | class SystemConfig extends BaseModel
method getConfigSelectDataAttr (line 40) | public function getConfigSelectDataAttr($value)
FILE: src/plugin/saiadmin/app/model/system/SystemConfigGroup.php
class SystemConfigGroup (line 25) | class SystemConfigGroup extends BaseModel
method configs (line 38) | public function configs()
method searchNameAttr (line 46) | public function searchNameAttr($query, $value)
method searchCodeAttr (line 54) | public function searchCodeAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemDept.php
class SystemDept (line 30) | class SystemDept extends BaseModel
method scopeAuth (line 43) | public function scopeAuth($query, $value)
method leader (line 57) | public function leader()
FILE: src/plugin/saiadmin/app/model/system/SystemDictData.php
class SystemDictData (line 30) | class SystemDictData extends BaseModel
method searchKeywordsAttr (line 43) | public function searchKeywordsAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemDictType.php
class SystemDictType (line 26) | class SystemDictType extends BaseModel
method dicts (line 39) | public function dicts()
FILE: src/plugin/saiadmin/app/model/system/SystemLoginLog.php
class SystemLoginLog (line 32) | class SystemLoginLog extends BaseModel
method searchLoginTimeAttr (line 45) | public function searchLoginTimeAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemMail.php
class SystemMail (line 27) | class SystemMail extends BaseModel
method searchFromAttr (line 40) | public function searchFromAttr($query, $value)
method searchEmailAttr (line 48) | public function searchEmailAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemMenu.php
class SystemMenu (line 42) | class SystemMenu extends BaseModel
method searchIdAttr (line 52) | public function searchIdAttr($query, $value)
method searchNameAttr (line 57) | public function searchNameAttr($query, $value)
method searchPathAttr (line 62) | public function searchPathAttr($query, $value)
method searchMenuAttr (line 67) | public function searchMenuAttr($query, $value)
method searchTypeAttr (line 77) | public function searchTypeAttr($query, $value)
FILE: src/plugin/saiadmin/app/model/system/SystemOperLog.php
class SystemOperLog (line 32) | class SystemOperLog extends BaseModel
FILE: src/plugin/saiadmin/app/model/system/SystemPost.php
class SystemPost (line 27) | class SystemPost extends BaseModel
FILE: src/plugin/saiadmin/app/model/system/SystemRole.php
class SystemRole (line 29) | class SystemRole extends BaseModel
method scopeAuth (line 47) | public function scopeAuth($query, $value)
method menus (line 65) | public function menus()
method depts (line 73) | public function depts()
FILE: src/plugin/saiadmin/app/model/system/SystemRoleDept.php
class SystemRoleDept (line 20) | class SystemRoleDept extends Pivot
FILE: src/plugin/saiadmin/app/model/system/SystemRoleMenu.php
class SystemRoleMenu (line 20) | class SystemRoleMenu extends Pivot
FILE: src/plugin/saiadmin/app/model/system/SystemUser.php
class SystemUser (line 37) | class SystemUser extends BaseModel
method searchKeywordAttr (line 52) | public function searchKeywordAttr($query, $value)
method scopeAuth (line 62) | public function scopeAuth($query, $value)
method roles (line 76) | public function roles()
method posts (line 84) | public function posts()
method depts (line 92) | public function depts()
FILE: src/plugin/saiadmin/app/model/system/SystemUserPost.php
class SystemUserPost (line 20) | class SystemUserPost extends Pivot
FILE: src/plugin/saiadmin/app/model/system/SystemUserRole.php
class SystemUserRole (line 20) | class SystemUserRole extends Pivot
method getRoleIds (line 31) | public static function getRoleIds($user_id): array
FILE: src/plugin/saiadmin/app/model/tool/Crontab.php
class Crontab (line 30) | class Crontab extends BaseModel
FILE: src/plugin/saiadmin/app/model/tool/CrontabLog.php
class CrontabLog (line 26) | class CrontabLog extends BaseModel
FILE: src/plugin/saiadmin/app/model/tool/GenerateColumns.php
class GenerateColumns (line 14) | class GenerateColumns extends BaseModel
method getOptionsAttr (line 24) | public function getOptionsAttr($value)
FILE: src/plugin/saiadmin/app/model/tool/GenerateTables.php
class GenerateTables (line 14) | class GenerateTables extends BaseModel
method getOptionsAttr (line 24) | public function getOptionsAttr($value)
FILE: src/plugin/saiadmin/app/validate/system/SystemCategoryValidate.php
class SystemCategoryValidate (line 14) | class SystemCategoryValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemConfigGroupValidate.php
class SystemConfigGroupValidate (line 15) | class SystemConfigGroupValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemConfigValidate.php
class SystemConfigValidate (line 14) | class SystemConfigValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemCrontabValidate.php
class SystemCrontabValidate (line 14) | class SystemCrontabValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemDeptValidate.php
class SystemDeptValidate (line 14) | class SystemDeptValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemDictDataValidate.php
class SystemDictDataValidate (line 14) | class SystemDictDataValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemDictTypeValidate.php
class SystemDictTypeValidate (line 15) | class SystemDictTypeValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemMailValidate.php
class SystemMailValidate (line 14) | class SystemMailValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemMenuValidate.php
class SystemMenuValidate (line 14) | class SystemMenuValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemNoticeValidate.php
class SystemNoticeValidate (line 14) | class SystemNoticeValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemPostValidate.php
class SystemPostValidate (line 14) | class SystemPostValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemRoleValidate.php
class SystemRoleValidate (line 15) | class SystemRoleValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/system/SystemUserValidate.php
class SystemUserValidate (line 15) | class SystemUserValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/tool/CrontabValidate.php
class CrontabValidate (line 14) | class CrontabValidate extends BaseValidate
FILE: src/plugin/saiadmin/app/validate/tool/GenerateTablesValidate.php
class GenerateTablesValidate (line 14) | class GenerateTablesValidate extends BaseValidate
FILE: src/plugin/saiadmin/basic/AbstractLogic.php
class AbstractLogic (line 15) | abstract class AbstractLogic implements LogicInterface
method init (line 46) | public function init($user): void
method setOrderField (line 56) | public function setOrderField(string $field): static
method setOrderType (line 67) | public function setOrderType(string $type): static
method getModel (line 77) | public function getModel(): object
method getImport (line 87) | public function getImport($file): string
method __call (line 105) | public function __call(string $name, array $arguments): mixed
FILE: src/plugin/saiadmin/basic/BaseController.php
class BaseController (line 15) | class BaseController extends OpenController
method init (line 46) | protected function init(): void
method validate (line 64) | protected function validate(string $scene, $data): bool
FILE: src/plugin/saiadmin/basic/BaseValidate.php
class BaseValidate (line 14) | class BaseValidate extends Validate
method unique (line 26) | public function unique($value, $rule, array $data = [], string $field ...
FILE: src/plugin/saiadmin/basic/OpenController.php
class OpenController (line 15) | class OpenController
method __construct (line 21) | public function __construct()
method success (line 34) | public function success(array | string $data = [], string $msg = 'succ...
method fail (line 47) | public function fail(string $msg = 'fail'): Response
method init (line 55) | protected function init(): void
FILE: src/plugin/saiadmin/basic/contracts/LogicInterface.php
type LogicInterface (line 13) | interface LogicInterface
method init (line 20) | public function init($user): void;
method add (line 27) | public function add(array $data): mixed;
method edit (line 35) | public function edit($id, array $data): mixed;
method read (line 42) | public function read($id): mixed;
method destroy (line 49) | public function destroy($ids): bool;
method search (line 56) | public function search(array $searchWhere = []): mixed;
method getList (line 63) | public function getList($query): mixed;
method getAll (line 70) | public function getAll($query): mixed;
method transaction (line 78) | public function transaction(callable $closure, bool $isTran = true): m...
FILE: src/plugin/saiadmin/basic/contracts/ModelInterface.php
type ModelInterface (line 13) | interface ModelInterface
method getTableName (line 19) | public function getTableName(): string;
method getPrimaryKeyName (line 25) | public function getPrimaryKeyName(): string;
FILE: src/plugin/saiadmin/basic/eloquent/BaseLogic.php
class BaseLogic (line 16) | class BaseLogic extends AbstractLogic
method transaction (line 24) | public function transaction(callable $closure, bool $isTran = true): m...
method add (line 34) | public function add(array $data): mixed
method edit (line 46) | public function edit($id, array $data): mixed
method read (line 60) | public function read($id): mixed
method destroy (line 74) | public function destroy($ids): bool
method search (line 84) | public function search(array $searchWhere = []): mixed
method getList (line 102) | public function getList($query): mixed
method getAll (line 138) | public function getAll($query): mixed
FILE: src/plugin/saiadmin/basic/eloquent/BaseModel.php
class BaseModel (line 16) | class BaseModel extends Model implements ModelInterface
method casts (line 51) | protected function casts(): array
method serializeDate (line 64) | protected function serializeDate(\DateTimeInterface $date): string
method getTableName (line 73) | public function getTableName(): string
method getPrimaryKeyName (line 82) | public function getPrimaryKeyName(): string
method withSearch (line 93) | public function withSearch(array $fields, array $data): mixed
method toCamelCase (line 112) | protected function toCamelCase(string $str): string
method searchCreateTimeAttr (line 122) | public function searchCreateTimeAttr($query, $value)
method searchUpdateTimeAttr (line 136) | public function searchUpdateTimeAttr($query, $value)
method boot (line 149) | protected static function boot(): void
FILE: src/plugin/saiadmin/basic/think/BaseLogic.php
class BaseLogic (line 16) | class BaseLogic extends AbstractLogic
method transaction (line 24) | public function transaction(callable $closure, bool $isTran = true): m...
method add (line 34) | public function add(array $data): mixed
method edit (line 46) | public function edit($id, array $data): mixed
method read (line 60) | public function read($id): mixed
method destroy (line 74) | public function destroy($ids): bool
method search (line 84) | public function search(array $searchWhere = []): mixed
method getList (line 102) | public function getList($query): mixed
method getAll (line 129) | public function getAll($query): mixed
FILE: src/plugin/saiadmin/basic/think/BaseModel.php
class BaseModel (line 16) | class BaseModel extends Model implements ModelInterface
method getTableName (line 54) | public function getTableName(): string
method getPrimaryKeyName (line 63) | public function getPrimaryKeyName(): string
method searchCreateTimeAttr (line 73) | public function searchCreateTimeAttr($query, $value)
method searchUpdateTimeAttr (line 87) | public function searchUpdateTimeAttr($query, $value)
method onBeforeInsert (line 101) | public static function onBeforeInsert($model): void
method onBeforeWrite (line 112) | public static function onBeforeWrite($model): void
FILE: src/plugin/saiadmin/command/SaiOrm.php
class SaiOrm (line 15) | class SaiOrm extends Command
method configure (line 39) | protected function configure(): void
method execute (line 45) | protected function execute(InputInterface $input, OutputInterface $out...
method copyDirectory (line 134) | protected function copyDirectory(string $source, string $dest, Symfony...
FILE: src/plugin/saiadmin/command/SaiPlugin.php
class SaiPlugin (line 15) | class SaiPlugin extends Command
method configure (line 23) | protected function configure()
method execute (line 33) | protected function execute(InputInterface $input, OutputInterface $out...
method createAll (line 66) | protected function createAll($name)
method mkdir (line 88) | protected function mkdir($path, $mode = 0777, $recursive = false)
method createControllerFile (line 102) | protected function createControllerFile($path, $name)
method createFunctionsFile (line 134) | protected function createFunctionsFile($file)
method createConfigFiles (line 153) | protected function createConfigFiles($base, $name)
FILE: src/plugin/saiadmin/command/SaiUpgrade.php
class SaiUpgrade (line 14) | class SaiUpgrade extends Command
method configure (line 29) | protected function configure(): void
method execute (line 35) | protected function execute(InputInterface $input, OutputInterface $out...
method copyDirectory (line 129) | protected function copyDirectory(string $source, string $dest, Symfony...
method getVersion (line 183) | protected function getVersion(string $path): ?string
FILE: src/plugin/saiadmin/db/saiadmin-6.0.sql
type `sa_system_attachment` (line 9) | CREATE TABLE `sa_system_attachment` (
type `sa_system_category` (line 43) | CREATE TABLE `sa_system_category` (
type `sa_system_config` (line 74) | CREATE TABLE `sa_system_config` (
type `sa_system_config_group` (line 149) | CREATE TABLE `sa_system_config_group` (
type `sa_system_dept` (line 173) | CREATE TABLE `sa_system_dept` (
type `sa_system_dict_data` (line 213) | CREATE TABLE `sa_system_dict_data` (
type `sa_system_dict_type` (line 267) | CREATE TABLE `sa_system_dict_type` (
type `sa_system_login_log` (line 299) | CREATE TABLE `sa_system_login_log` (
type `sa_system_mail` (line 329) | CREATE TABLE `sa_system_mail` (
type `sa_system_menu` (line 353) | CREATE TABLE `sa_system_menu` (
type `sa_system_oper_log` (line 479) | CREATE TABLE `sa_system_oper_log` (
type `sa_system_post` (line 508) | CREATE TABLE `sa_system_post` (
type `sa_system_role` (line 533) | CREATE TABLE `sa_system_role` (
type `sa_system_role_dept` (line 565) | CREATE TABLE `sa_system_role_dept` (
type `sa_system_role_menu` (line 582) | CREATE TABLE `sa_system_role_menu` (
type `sa_system_user` (line 599) | CREATE TABLE `sa_system_user` (
type `sa_system_user_post` (line 642) | CREATE TABLE `sa_system_user_post` (
type `sa_system_user_role` (line 659) | CREATE TABLE `sa_system_user_role` (
type `sa_tool_crontab` (line 677) | CREATE TABLE `sa_tool_crontab` (
type `sa_tool_crontab_log` (line 707) | CREATE TABLE `sa_tool_crontab_log` (
type `sa_tool_generate_columns` (line 729) | CREATE TABLE `sa_tool_generate_columns` (
type `sa_tool_generate_tables` (line 766) | CREATE TABLE `sa_tool_generate_tables` (
type `sa_article` (line 806) | CREATE TABLE `sa_article` (
type `sa_article_banner` (line 845) | CREATE TABLE `sa_article_banner` (
type `sa_article_category` (line 874) | CREATE TABLE `sa_article_category` (
FILE: src/plugin/saiadmin/db/saiadmin-pure.sql
type `sa_system_attachment` (line 9) | CREATE TABLE `sa_system_attachment` (
type `sa_system_category` (line 43) | CREATE TABLE `sa_system_category` (
type `sa_system_config` (line 74) | CREATE TABLE `sa_system_config` (
type `sa_system_config_group` (line 149) | CREATE TABLE `sa_system_config_group` (
type `sa_system_dept` (line 173) | CREATE TABLE `sa_system_dept` (
type `sa_system_dict_data` (line 202) | CREATE TABLE `sa_system_dict_data` (
type `sa_system_dict_type` (line 256) | CREATE TABLE `sa_system_dict_type` (
type `sa_system_login_log` (line 288) | CREATE TABLE `sa_system_login_log` (
type `sa_system_mail` (line 318) | CREATE TABLE `sa_system_mail` (
type `sa_system_menu` (line 342) | CREATE TABLE `sa_system_menu` (
type `sa_system_oper_log` (line 468) | CREATE TABLE `sa_system_oper_log` (
type `sa_system_post` (line 497) | CREATE TABLE `sa_system_post` (
type `sa_system_role` (line 516) | CREATE TABLE `sa_system_role` (
type `sa_system_role_dept` (line 543) | CREATE TABLE `sa_system_role_dept` (
type `sa_system_role_menu` (line 560) | CREATE TABLE `sa_system_role_menu` (
type `sa_system_user` (line 577) | CREATE TABLE `sa_system_user` (
type `sa_system_user_post` (line 613) | CREATE TABLE `sa_system_user_post` (
type `sa_system_user_role` (line 630) | CREATE TABLE `sa_system_user_role` (
type `sa_tool_crontab` (line 648) | CREATE TABLE `sa_tool_crontab` (
type `sa_tool_crontab_log` (line 671) | CREATE TABLE `sa_tool_crontab_log` (
type `sa_tool_generate_columns` (line 693) | CREATE TABLE `sa_tool_generate_columns` (
type `sa_tool_generate_tables` (line 730) | CREATE TABLE `sa_tool_generate_tables` (
FILE: src/plugin/saiadmin/exception/ApiException.php
class ApiException (line 16) | class ApiException extends BusinessException
method render (line 18) | public function render(Request $request): ?Response
FILE: src/plugin/saiadmin/exception/SystemException.php
class SystemException (line 14) | class SystemException extends \RuntimeException
method __construct (line 16) | public function __construct($message, $code = 400, Throwable $previous...
FILE: src/plugin/saiadmin/process/Task.php
class Task (line 13) | class Task
method __construct (line 18) | public function __construct()
method onWorkerStart (line 31) | public function onWorkerStart()
method initStart (line 39) | public function initStart()
method reload (line 52) | public function reload($data)
FILE: src/plugin/saiadmin/process/Test.php
class Test (line 9) | class Test
method run (line 11) | public function run($args): void
FILE: src/plugin/saiadmin/service/EmailService.php
class EmailService (line 18) | class EmailService
method getConfig (line 24) | public static function getConfig(): array
method getMailer (line 38) | public static function getMailer(): PHPMailer
method send (line 66) | public static function send($from, $to, $subject, $content): string
method sendByTemplate (line 87) | public static function sendByTemplate($to, $subject, $content, array $...
FILE: src/plugin/saiadmin/service/OpenSpoutWriter.php
class OpenSpoutWriter (line 14) | class OpenSpoutWriter
method __construct (line 32) | public function __construct(string $fileName)
method getFileName (line 44) | public function getFileName(string $fileName): string
method setWidth (line 56) | public function setWidth(array $width = [])
method setHeader (line 73) | public function setHeader(array $header = [], $style = null): void
method setData (line 97) | public function setData(array $data = [], $style = null, array $filter...
method returnFile (line 130) | public function returnFile(): string
FILE: src/plugin/saiadmin/service/Permission.php
class Permission (line 8) | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]
method __construct (line 26) | public function __construct(
method getTitle (line 38) | public function getTitle(): string
method getSlug (line 46) | public function getSlug(): ?string
FILE: src/plugin/saiadmin/service/storage/ChunkUploadService.php
class ChunkUploadService (line 12) | class ChunkUploadService
method __construct (line 26) | public function __construct($folder = "chunk")
method checkPath (line 38) | public function checkPath(): string
method checkChunk (line 53) | public function checkChunk($data): array
method uploadChunk (line 79) | public function uploadChunk($data): array
method mergeChunk (line 103) | public function mergeChunk($data): array
FILE: src/plugin/saiadmin/service/storage/UploadService.php
class UploadService (line 19) | class UploadService
method disk (line 28) | public static function disk(int $type = 1, string $upload = 'image', b...
method __callStatic (line 132) | public static function __callStatic($name, $arguments)
FILE: src/plugin/saiadmin/utils/Arr.php
class Arr (line 13) | class Arr
method getArrayColumn (line 21) | public static function getArrayColumn($source, $column): array
method getArrayColumns (line 36) | public static function getArrayColumns($source, $columns): array
method fieldAsKey (line 61) | public static function fieldAsKey($array, $field, $unique = false) {
method unique (line 84) | public static function unique(array $data)
method getUniqueKey (line 95) | public static function getUniqueKey(array $list, string $key)
method mergeArray (line 107) | public static function mergeArray(array $arr1, array $arr2, string $key)
method groupSameField (line 127) | public static function groupSameField(array $data, string $field)
method makeTree (line 143) | public static function makeTree($arr, $pid = 0, $column_name = 'id|pid...
method sortArray (line 164) | public static function sortArray($arr, $key, $sort = SORT_ASC)
method getArrayByColumn (line 177) | public static function getArrayByColumn($array, $column, $value): array
method getConfigValue (line 194) | public static function getConfigValue($array, $key)
FILE: src/plugin/saiadmin/utils/Captcha.php
class Captcha (line 18) | class Captcha
method imageCaptcha (line 24) | public static function imageCaptcha(): array
method numberCaptcha (line 65) | public static function numberCaptcha(string $key, int $length = 4): array
method checkCaptcha (line 98) | public static function checkCaptcha(string $uuid, string|int $captcha)...
FILE: src/plugin/saiadmin/utils/Helper.php
class Helper (line 12) | class Helper
method makeTree (line 22) | public static function makeTree(array $data, string $childrenname = 'c...
method makeArcoMenus (line 47) | public static function makeArcoMenus(array $data, string $childrenname...
method makeArtdMenus (line 109) | public static function makeArtdMenus(array $data, string $childrenname...
method camelize (line 156) | public static function camelize($uncamelized_words,$separator='_')
method uncamelize (line 165) | public static function uncamelize($camelCaps,$separator='_')
method camel (line 175) | public static function camel(string $value): string
method get_business (line 194) | public static function get_business(string $tableName)
method get_big_business (line 210) | public static function get_big_business(string $tableName)
method str_replace_once (line 224) | public static function str_replace_once($needle, $replace, $haystack)
method get_dir (line 238) | public static function get_dir($template_name)
FILE: src/plugin/saiadmin/utils/ServerMonitor.php
class ServerMonitor (line 12) | class ServerMonitor
method getMemoryInfo (line 18) | public function getMemoryInfo(): array
method getPhpAndEnvInfo (line 101) | public function getPhpAndEnvInfo(): array
method getDiskInfo (line 122) | public function getDiskInfo(): array
method formatBytes (line 241) | private function formatBytes($bytes, int $precision = 2): string
FILE: src/plugin/saiadmin/utils/code/CodeEngine.php
class CodeEngine (line 20) | class CodeEngine
method _getConfig (line 37) | private static function _getConfig(): array
method __construct (line 49) | public function __construct(array $data)
method setStub (line 71) | public function setStub($stub): void
method renderContent (line 79) | public function renderContent($path, $filename): string
method generateBackend (line 133) | public function generateBackend($action, $content): void
method generateFrontend (line 175) | public function generateFrontend($action, $content): void
method generateTemp (line 214) | public function generateTemp(): void
method checkPath (line 282) | protected function checkPath($path): void
FILE: src/plugin/saiadmin/utils/code/CodeZip.php
class CodeZip (line 14) | class CodeZip
method _getConfig (line 21) | private static function _getConfig(): array
method __construct (line 32) | public function __construct()
method compress (line 52) | public function compress(bool $isDownload = false)
method deCompress (line 75) | public function deCompress(string $file, string $dirName)
method addFileToZip (line 98) | public function addFileToZip($rootPath, $zip)
method recursiveDelete (line 122) | public function recursiveDelete($dir)
method toBinary (line 145) | public function toBinary(string $fileName)
Condensed preview — 232 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (939K chars).
[
{
"path": "LICENSE",
"chars": 1065,
"preview": "MIT License\n\nCopyright (c) 2024 saithink\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no"
},
{
"path": "README.md",
"chars": 2292,
"preview": "<p align=\"center\">\n <img src=\"https://saithink.top/images/logo.png\" width=\"120\" />\n</p>\n<p align=\"center\">\n <img src=\""
},
{
"path": "composer.json",
"chars": 1258,
"preview": "{\n \"name\": \"saithink/saiadmin\",\n \"description\": \"webman plugin\",\n \"type\": \"library\",\n \"license\": \"MIT\",\n "
},
{
"path": "src/Install.php",
"chars": 3592,
"preview": "<?php\nnamespace Webman\\saiadmin;\n\nclass Install\n{\n const WEBMAN_PLUGIN = true;\n\n /**\n * @var array\n */\n "
},
{
"path": "src/orm/eloquent/app/logic/system/DatabaseLogic.php",
"chars": 6520,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemAttachmentLogic.php",
"chars": 6659,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemCategoryLogic.php",
"chars": 2664,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemConfigGroupLogic.php",
"chars": 1609,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemConfigLogic.php",
"chars": 2746,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemDeptLogic.php",
"chars": 3706,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemDictDataLogic.php",
"chars": 1204,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemDictTypeLogic.php",
"chars": 2891,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemLoginLogLogic.php",
"chars": 2793,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemMailLogic.php",
"chars": 655,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemMenuLogic.php",
"chars": 4789,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemOperLogLogic.php",
"chars": 1004,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemPostLogic.php",
"chars": 2855,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemRoleLogic.php",
"chars": 3792,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/system/SystemUserLogic.php",
"chars": 10027,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/tool/CrontabLogLogic.php",
"chars": 619,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/tool/CrontabLogic.php",
"chars": 7416,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/tool/GenerateColumnsLogic.php",
"chars": 7447,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/logic/tool/GenerateTablesLogic.php",
"chars": 16968,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemAttachment.php",
"chars": 1442,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemCategory.php",
"chars": 1095,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemConfig.php",
"chars": 1135,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemConfigGroup.php",
"chars": 1311,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemDept.php",
"chars": 1549,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemDictData.php",
"chars": 1121,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemDictType.php",
"chars": 1321,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemLoginLog.php",
"chars": 1170,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/orm/eloquent/app/model/system/SystemMail.php",
"chars": 1176,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemMenu.php",
"chars": 2197,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemOperLog.php",
"chars": 1016,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/orm/eloquent/app/model/system/SystemPost.php",
"chars": 870,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemRole.php",
"chars": 1919,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemRoleDept.php",
"chars": 645,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemRoleMenu.php",
"chars": 639,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemUser.php",
"chars": 2387,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemUserPost.php",
"chars": 651,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/system/SystemUserRole.php",
"chars": 866,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/tool/Crontab.php",
"chars": 961,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/tool/CrontabLog.php",
"chars": 933,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/tool/GenerateColumns.php",
"chars": 623,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/eloquent/app/model/tool/GenerateTables.php",
"chars": 579,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/DatabaseLogic.php",
"chars": 6154,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemAttachmentLogic.php",
"chars": 6704,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemCategoryLogic.php",
"chars": 2671,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemConfigGroupLogic.php",
"chars": 1628,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemConfigLogic.php",
"chars": 2734,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemDeptLogic.php",
"chars": 3667,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemDictDataLogic.php",
"chars": 1233,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemDictTypeLogic.php",
"chars": 3146,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemLoginLogLogic.php",
"chars": 2794,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemMailLogic.php",
"chars": 652,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemMenuLogic.php",
"chars": 4921,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemOperLogLogic.php",
"chars": 986,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemPostLogic.php",
"chars": 2828,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemRoleLogic.php",
"chars": 4057,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/system/SystemUserLogic.php",
"chars": 9999,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/tool/CrontabLogLogic.php",
"chars": 616,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/tool/CrontabLogic.php",
"chars": 7460,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/tool/GenerateColumnsLogic.php",
"chars": 7437,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/logic/tool/GenerateTablesLogic.php",
"chars": 16169,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemAttachment.php",
"chars": 1432,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemCategory.php",
"chars": 1084,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemConfig.php",
"chars": 1083,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemConfigGroup.php",
"chars": 1300,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemDept.php",
"chars": 1524,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemDictData.php",
"chars": 1110,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemDictType.php",
"chars": 994,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemLoginLog.php",
"chars": 1159,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/orm/think/app/model/system/SystemMail.php",
"chars": 1165,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemMenu.php",
"chars": 2105,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemOperLog.php",
"chars": 1005,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/orm/think/app/model/system/SystemPost.php",
"chars": 859,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemRole.php",
"chars": 1898,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemRoleDept.php",
"chars": 610,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemRoleMenu.php",
"chars": 604,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemUser.php",
"chars": 2322,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemUserPost.php",
"chars": 616,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/system/SystemUserRole.php",
"chars": 822,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/tool/Crontab.php",
"chars": 958,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/tool/CrontabLog.php",
"chars": 874,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/tool/GenerateColumns.php",
"chars": 684,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/orm/think/app/model/tool/GenerateTables.php",
"chars": 680,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/ConfigCache.php",
"chars": 2155,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/DictCache.php",
"chars": 1887,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/ReflectionCache.php",
"chars": 2750,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/UserAuthCache.php",
"chars": 3353,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/UserInfoCache.php",
"chars": 3681,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/cache/UserMenuCache.php",
"chars": 2355,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/InstallController.php",
"chars": 10138,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/LoginController.php",
"chars": 1641,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/SystemController.php",
"chars": 7683,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/DataBaseController.php",
"chars": 3781,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemAttachmentController.php",
"chars": 2888,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemCategoryController.php",
"chars": 3168,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemConfigController.php",
"chars": 3438,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemConfigGroupController.php",
"chars": 4423,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemDeptController.php",
"chars": 3442,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemDictDataController.php",
"chars": 3008,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemDictTypeController.php",
"chars": 2909,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemLogController.php",
"chars": 2766,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemMailController.php",
"chars": 1915,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemMenuController.php",
"chars": 3733,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemPostController.php",
"chars": 4471,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemRoleController.php",
"chars": 4512,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemServerController.php",
"chars": 2437,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/system/SystemUserController.php",
"chars": 5838,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/tool/CrontabController.php",
"chars": 4780,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/controller/tool/GenerateTablesController.php",
"chars": 4726,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/event/SystemUser.php",
"chars": 4683,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/exception/Handler.php",
"chars": 2565,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/functions.php",
"chars": 3287,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/DatabaseLogic.php",
"chars": 6154,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemAttachmentLogic.php",
"chars": 6704,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemCategoryLogic.php",
"chars": 2671,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemConfigGroupLogic.php",
"chars": 1628,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemConfigLogic.php",
"chars": 2734,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemDeptLogic.php",
"chars": 3667,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemDictDataLogic.php",
"chars": 1233,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemDictTypeLogic.php",
"chars": 3146,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemLoginLogLogic.php",
"chars": 2794,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemMailLogic.php",
"chars": 652,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemMenuLogic.php",
"chars": 4921,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemOperLogLogic.php",
"chars": 986,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemPostLogic.php",
"chars": 2828,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemRoleLogic.php",
"chars": 4057,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/system/SystemUserLogic.php",
"chars": 9999,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/tool/CrontabLogLogic.php",
"chars": 616,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/tool/CrontabLogic.php",
"chars": 7460,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/tool/GenerateColumnsLogic.php",
"chars": 7566,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/logic/tool/GenerateTablesLogic.php",
"chars": 16124,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/middleware/CheckAuth.php",
"chars": 1951,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/middleware/CheckLogin.php",
"chars": 1345,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/middleware/CrossDomain.php",
"chars": 1167,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/middleware/SystemLog.php",
"chars": 1217,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemAttachment.php",
"chars": 1432,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemCategory.php",
"chars": 1084,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemConfig.php",
"chars": 1083,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemConfigGroup.php",
"chars": 1300,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemDept.php",
"chars": 1524,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemDictData.php",
"chars": 1110,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemDictType.php",
"chars": 994,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemLoginLog.php",
"chars": 1159,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemMail.php",
"chars": 1165,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemMenu.php",
"chars": 2105,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemOperLog.php",
"chars": 1005,
"preview": "<?php\n\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +-"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemPost.php",
"chars": 859,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemRole.php",
"chars": 1898,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemRoleDept.php",
"chars": 610,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemRoleMenu.php",
"chars": 604,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemUser.php",
"chars": 2322,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemUserPost.php",
"chars": 616,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/system/SystemUserRole.php",
"chars": 822,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/tool/Crontab.php",
"chars": 958,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/tool/CrontabLog.php",
"chars": 874,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/tool/GenerateColumns.php",
"chars": 684,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/model/tool/GenerateTables.php",
"chars": 680,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemCategoryValidate.php",
"chars": 847,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemConfigGroupValidate.php",
"chars": 1194,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemConfigValidate.php",
"chars": 1144,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemCrontabValidate.php",
"chars": 1223,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saithink [ saithink快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemDeptValidate.php",
"chars": 910,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemDictDataValidate.php",
"chars": 1173,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemDictTypeValidate.php",
"chars": 1258,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemMailValidate.php",
"chars": 1018,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemMenuValidate.php",
"chars": 969,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemNoticeValidate.php",
"chars": 1079,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemPostValidate.php",
"chars": 1014,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemRoleValidate.php",
"chars": 1244,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/system/SystemUserValidate.php",
"chars": 1301,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/tool/CrontabValidate.php",
"chars": 1116,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/validate/tool/GenerateTablesValidate.php",
"chars": 1708,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/app/view/install/error.html",
"chars": 7660,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-wi"
},
{
"path": "src/plugin/saiadmin/app/view/install/index.html",
"chars": 34356,
"preview": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-wi"
},
{
"path": "src/plugin/saiadmin/basic/AbstractLogic.php",
"chars": 2222,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/BaseController.php",
"chars": 1611,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/BaseValidate.php",
"chars": 2018,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/OpenController.php",
"chars": 1301,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/contracts/LogicInterface.php",
"chars": 1615,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/contracts/ModelInterface.php",
"chars": 614,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/eloquent/BaseLogic.php",
"chars": 4019,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/eloquent/BaseModel.php",
"chars": 3995,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/think/BaseLogic.php",
"chars": 3754,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/basic/think/BaseModel.php",
"chars": 2435,
"preview": "<?php\n// +----------------------------------------------------------------------\n// | saiadmin [ saiadmin快速开发框架 ]\n// +--"
},
{
"path": "src/plugin/saiadmin/command/SaiOrm.php",
"chars": 4899,
"preview": "<?php\n\nnamespace plugin\\saiadmin\\command;\n\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\"
},
{
"path": "src/plugin/saiadmin/command/SaiPlugin.php",
"chars": 6690,
"preview": "<?php\n\nnamespace plugin\\saiadmin\\command;\n\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\"
},
{
"path": "src/plugin/saiadmin/command/SaiUpgrade.php",
"chars": 5292,
"preview": "<?php\n\nnamespace plugin\\saiadmin\\command;\n\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\"
},
{
"path": "src/plugin/saiadmin/config/app.php",
"chars": 161,
"preview": "<?php\n\nuse support\\Request;\n\nreturn [\n 'debug' => true,\n 'controller_suffix' => 'Controller',\n 'controller_reus"
},
{
"path": "src/plugin/saiadmin/config/autoload.php",
"chars": 100,
"preview": "<?php\nreturn [\n 'files' => [\n base_path() . '/plugin/saiadmin/app/functions.php',\n ]\n];"
},
{
"path": "src/plugin/saiadmin/config/container.php",
"chars": 35,
"preview": "<?php\nreturn new Webman\\Container;\n"
},
{
"path": "src/plugin/saiadmin/config/database.php",
"chars": 17,
"preview": "<?php\nreturn [];"
},
{
"path": "src/plugin/saiadmin/config/event.php",
"chars": 212,
"preview": "<?php\nreturn [\n 'user.login' => [\n [plugin\\saiadmin\\app\\event\\SystemUser::class, 'login'],\n ],\n 'user.op"
},
{
"path": "src/plugin/saiadmin/config/exception.php",
"chars": 76,
"preview": "<?php\n\nreturn [\n '' => \\plugin\\saiadmin\\app\\exception\\Handler::class,\n];\n"
},
{
"path": "src/plugin/saiadmin/config/log.php",
"chars": 547,
"preview": "<?php\n\nreturn [\n 'default' => [\n 'handlers' => [\n [\n 'class' => Monolog\\Handler\\Rota"
},
{
"path": "src/plugin/saiadmin/config/middleware.php",
"chars": 256,
"preview": "<?php\n\nuse plugin\\saiadmin\\app\\middleware\\SystemLog;\nuse plugin\\saiadmin\\app\\middleware\\CheckLogin;\nuse plugin\\saiadmin\\"
},
{
"path": "src/plugin/saiadmin/config/process.php",
"chars": 99,
"preview": "<?php\nreturn [\n 'task' => [\n 'handler' => plugin\\saiadmin\\process\\Task::class\n ]\n];\n"
},
{
"path": "src/plugin/saiadmin/config/route.php",
"chars": 8659,
"preview": "<?php\n\nuse Webman\\Route;\n\nRoute::group('/core', function () {\n\n Route::get('/install', [plugin\\saiadmin\\app\\controlle"
}
]
// ... and 32 more files (download for full content)
About this extraction
This page contains the full source code of the saithink/saiadmin GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 232 files (801.9 KB), approximately 237.6k tokens, and a symbol index with 1005 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.