FastMovieAI 二开基线 v1.0 (完整源码)

This commit is contained in:
李建琦
2026-08-26 18:41:02 +08:00
parent fad7690c0c
commit d54584f70d
888 changed files with 105571 additions and 1 deletions
@@ -0,0 +1,56 @@
<?php
namespace plugin\control\expose\api;
trait Control
{
protected $path;
/**
* 多语言必须在构造函数中设置plugin值为插件名
*/
protected $plugin;
/**
* 获取菜单
*
* @return array|mixed
*/
public function getMenus()
{
clearstatcache();
# 当前类的运行目录
if (is_file($menu_file = $this->path . '/../control.json')) {
return json_decode(file_get_contents($menu_file), true);
}
return false;
}
public function getPermissions(){
$menus = $this->getMenus();
$permissions = [];
if($menus){
$this->getPath($menus,$permissions);
}
return $permissions;
}
public function getPath($arr,&$data)
{
if(isset($arr['path'])){
$data[] = $arr['path'];
if(isset($arr['children'])){
$this->getPath($arr['children'],$data);
}
}else{
foreach ($arr as $key => $value) {
if (isset($value['path'])) {
$data[] = $value['path'];
}
if (isset($value['children'])) {
$this->getPath($value['children'],$data);
}
}
}
}
public function getPlugin()
{
return $this->plugin;
}
}