mirror of https://gitee.com/karson/fastadmin.git
Compare commits
10 Commits
fdb912e3e2
...
bcbfa4a9e4
| Author | SHA1 | Date |
|---|---|---|
|
|
bcbfa4a9e4 | |
|
|
a909967bd4 | |
|
|
fea7b3021a | |
|
|
57468badd8 | |
|
|
d0ddb8a2d4 | |
|
|
d6d20c6d53 | |
|
|
4b6c209575 | |
|
|
53e916eeb7 | |
|
|
fa2992687b | |
|
|
016b7a0d28 |
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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": "*",
|
||||
|
|
|
|||
Loading…
Reference in New Issue