Compare commits

...

10 Commits

Author SHA1 Message Date
unsetMe bcbfa4a9e4 Update Backend.php
修改为安全的htmlentities调用,兼容php8+版本
2025-06-26 21:55:00 +08:00
Xiaohe a909967bd4 修改生成api接口路径问题
修改生成api接口路径问题 控制器在文件夹下面api路径会生成带“.”统一替换成“/”
2025-06-26 21:55:00 +08:00
shali fea7b3021a update application/common.php.
refactor: 优化逻辑短路,例如空字符串,做了 2 次逻辑判断

Signed-off-by: shali <15549351+goodbugood@user.noreply.gitee.com>
2025-06-26 21:22:48 +08:00
Simon 57468badd8 删除多余代码 2025-06-26 21:22:42 +08:00
Karson d0ddb8a2d4 更新composer依赖版本号 2025-06-26 21:14:39 +08:00
Karson d6d20c6d53 优化组别列表显示 2025-06-26 21:14:14 +08:00
Karson 4b6c209575 优化POST请求过大时日志记录 2025-06-26 21:13:28 +08:00
reatang 53e916eeb7 fix:rmdir(XXXX): Text file busy 2025-06-26 17:27:55 +08:00
Karson fa2992687b 优化CRUD菜单图标 2025-06-26 17:03:31 +08:00
Karson 016b7a0d28 优化登录后跳转 2025-06-26 16:54:34 +08:00
9 changed files with 36 additions and 25 deletions

View File

@ -205,6 +205,7 @@ class Builder
if ($subdomain) {
$route = substr($route, 4);
}
$route = str_replace('.', '/', $route);
$docsList[$section][$name] = [
'id' => $counter,
'method' => is_array($docs['ApiMethod'][0]) ? $docs['ApiMethod'][0]['data'] : $docs['ApiMethod'][0],

View File

@ -493,20 +493,20 @@ class Crud extends Command
//关联模式
'relationFields' => isset($relationFields[$index]) ? explode(',', $relationFields[$index]) : [],
//关联模式
'relationMode' => isset($relationMode[$index]) ? $relationMode[$index] : 'belongsto',
'relationMode' => $relationMode[$index] ?? 'belongsto',
//关联模型控制器
'relationController' => isset($relationController[$index]) ? $relationController[$index] : '',
'relationController' => $relationController[$index] ?? '',
//关联表外键
'relationForeignKey' => isset($relationForeignKey[$index]) ? $relationForeignKey[$index] : '',
'relationForeignKey' => $relationForeignKey[$index] ?? '',
//关联表主键
'relationPrimaryKey' => isset($relationPrimaryKey[$index]) ? $relationPrimaryKey[$index] : '',
'relationPrimaryKey' => $relationPrimaryKey[$index] ?? '',
];
}
}
//根据表名匹配对应的Fontawesome图标
$iconPath = ROOT_PATH . str_replace('/', DS, '/public/assets/libs/font-awesome/less/variables.less');
$iconName = is_file($iconPath) && stripos(file_get_contents($iconPath), '@fa-var-' . $table . ':') ? 'fa fa-' . $table : 'fa fa-circle-o';
$iconPath = ROOT_PATH . str_replace('/', DS, '/public/assets/libs/font-awesome/css/font-awesome.css');
$iconName = is_file($iconPath) && stripos(file_get_contents($iconPath), '.fa-' . $table . ' {') ? 'fa fa-' . $table : 'fa fa-circle-o';
//控制器
list($controllerNamespace, $controllerName, $controllerFile, $controllerArr) = $this->getControllerData($moduleName, $controller, $table);
@ -1322,6 +1322,7 @@ EOD;
$iterator = new \FilesystemIterator($parentDir);
$isDirEmpty = !$iterator->valid();
if ($isDirEmpty) {
unset($iterator);
rmdir($parentDir);
$parentDir = dirname($parentDir);
} else {

View File

@ -70,7 +70,7 @@ class Index extends Backend
public function login()
{
$url = $this->request->get('url', '', 'url_clean');
$url = $url ?: 'index/index';
$url = $url && !preg_match('/\/index\/(login|logout)$/', $url) ? $url : 'index/index';
if ($this->auth->isLogin()) {
$this->success(__("You've logged in, do not login again"), $url);
}

View File

@ -3,6 +3,7 @@
namespace app\admin\controller\auth;
use app\admin\model\AuthGroup;
use app\admin\model\AuthGroupAccess;
use app\common\controller\Backend;
use fast\Tree;
use think\Db;
@ -38,22 +39,24 @@ class Group extends Backend
$groupList = collection(AuthGroup::where('id', 'in', $this->childrenGroupIds)->select())->toArray();
Tree::instance()->init($groupList);
$groupList = [];
if ($this->auth->isSuperAdmin()) {
$groupList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0));
$tree = Tree::instance()->init($groupList);
$groupList = $tree->getTreeList($tree->getTreeArray(0));
} else {
$groups = $this->auth->getGroups();
$groupIds = [];
foreach ($groups as $m => $n) {
if (in_array($n['id'], $groupIds) || in_array($n['pid'], $groupIds)) {
continue;
}
$groupList = array_merge($groupList, Tree::instance()->getTreeList(Tree::instance()->getTreeArray($n['pid'])));
foreach ($groupList as $index => $item) {
$groupIds[] = $item['id'];
$allIds = array_column($groups, 'id');
foreach ($groups as &$item) {
$item['parent_id'] = $item['pid'];
if (!in_array($item['parent_id'], $allIds)) {
$item['parent_id'] = 0;
}
$item['status'] = 'normal';
}
unset($item);
$tree = Tree::instance()->init($groups, 'parent_id');
$groupList = $tree->getTreeList($tree->getTreeArray(0));
}
$groupName = [];
foreach ($groupList as $k => $v) {

View File

@ -54,7 +54,6 @@ class Profile extends Backend
$params,
array_flip(array('email', 'nickname', 'password', 'avatar'))
));
unset($v);
if (!Validate::is($params['email'], "email")) {
$this->error(__("Please input correct email"));
}

View File

@ -67,6 +67,10 @@ class AdminLog extends Model
$content = $content ?: self::$content;
if (!$content) {
$content = request()->param('') ?: file_get_contents("php://input");
$contentLength = request()->server('CONTENT_LENGTH');
if (is_string($content) && $contentLength && strlen($content) < $contentLength) {
$content = '[Request Data Truncated]';
}
$content = self::getPureContent($content);
}
$title = $title ?: self::$title;

View File

@ -16,7 +16,7 @@ if (!function_exists('__')) {
*/
function __($name, $vars = [], $lang = '')
{
if (is_numeric($name) || !$name) {
if (!$name || is_numeric($name)) {
return $name;
}
if (!is_array($vars)) {

View File

@ -582,7 +582,10 @@ class Backend extends Controller
$result = array_intersect_key(($item instanceof Model ? $item->toArray() : (array)$item), array_flip($fields));
}
$result['pid'] = isset($item['pid']) ? $item['pid'] : (isset($item['parent_id']) ? $item['parent_id'] : 0);
$result = array_map("htmlentities", $result);
// 修改为安全的htmlentities调用兼容php8+版本
$result = array_map(function($value) {
return $value === null ? '' : htmlentities((string)$value);
}, $result);
$list[] = $result;
}
if ($istree && !$primaryvalue) {

View File

@ -21,11 +21,11 @@
"topthink/think-installer": "^1.0.14",
"topthink/think-queue": "1.1.6",
"topthink/think-helper": "^1.0.7",
"fastadminnet/fastadmin-addons": "~1.4.0",
"fastadminnet/fastadmin-mailer": "^2.0.0",
"fastadminnet/fastadmin-addons": "~1.4.3",
"fastadminnet/fastadmin-mailer": "^2.1.1",
"overtrue/pinyin": "^3.0",
"phpoffice/phpspreadsheet": "^1.29.1",
"overtrue/wechat": "^5.36.0",
"phpoffice/phpspreadsheet": "^1.29.11",
"overtrue/wechat": "^5.36.3",
"ext-json": "*",
"ext-curl": "*",
"ext-pdo": "*",