FastMovieAI AI短剧创作平台 二开基线
- 源码: xhadmincn/FastMovieAI (Apache 2.0) - 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION - vendor/示例资源已gitignore
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\DataboardBuilder;
|
||||
use support\Request;
|
||||
|
||||
class IndexController extends Basic
|
||||
{
|
||||
/**
|
||||
* 不需要登录的方法
|
||||
* @var string[]
|
||||
*/
|
||||
protected $notNeedLogin = ['index'];
|
||||
protected $notNeedAuth = ['index'];
|
||||
public function index(Request $request)
|
||||
{
|
||||
$path = $request->path();
|
||||
# 如果不是以/结尾的,就重定向到以/结尾的URL
|
||||
if (substr($path, -1) != '/') {
|
||||
return redirect($path . '/');
|
||||
}
|
||||
return view(public_path('index.html'));
|
||||
}
|
||||
public function control(Request $request)
|
||||
{
|
||||
$builder = new DataboardBuilder([
|
||||
'gutter' => 6
|
||||
]);
|
||||
$pluginConfig = glob(base_path("plugin/*/api/{$request->app}/IndexController.php"));
|
||||
foreach ($pluginConfig as $path) {
|
||||
$plugin_name = basename(dirname(dirname(dirname($path))));
|
||||
$class = 'plugin\\' . $plugin_name . "\\api\\{$request->app}\\IndexController";
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
$plugin = new $class;
|
||||
if (method_exists($plugin, 'control')) {
|
||||
$plugin->control($builder);
|
||||
}
|
||||
}
|
||||
foreach ($pluginConfig as $path) {
|
||||
$plugin_name = basename(dirname(dirname(dirname($path))));
|
||||
$class = 'plugin\\' . $plugin_name . "\\api\\{$request->app}\\IndexController";
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
$plugin = new $class;
|
||||
if (method_exists($plugin, 'echarts')) {
|
||||
$plugin->echarts($builder);
|
||||
}
|
||||
}
|
||||
return $this->resData($builder);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user