up. 开发控制器块
This commit is contained in:
parent
aa06a99e6d
commit
b4df42f82f
53
app/controller/admin/system/dev/CommandController.php
Normal file
53
app/controller/admin/system/dev/CommandController.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller\admin\system\dev;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
use think\facade\Console;
|
||||||
|
use think\response\Json;
|
||||||
|
|
||||||
|
class CommandController extends BaseController
|
||||||
|
{
|
||||||
|
public function list(): Json
|
||||||
|
{
|
||||||
|
$all = Console::all();
|
||||||
|
$lists = [];
|
||||||
|
foreach ($all as $cmdName => $class) {
|
||||||
|
$names = explode(':', $cmdName);
|
||||||
|
$group = '';
|
||||||
|
if(count($names) > 1){
|
||||||
|
$group = $names[0];
|
||||||
|
}
|
||||||
|
if(is_string($class)){
|
||||||
|
$classObj = Console::getCommand($cmdName);
|
||||||
|
$className = $class;
|
||||||
|
}else{
|
||||||
|
$classObj = $class;
|
||||||
|
$className = get_class($class);
|
||||||
|
}
|
||||||
|
$className = ltrim($className, '\\');
|
||||||
|
$type = "";
|
||||||
|
if(str_starts_with($className, 'think\\')){
|
||||||
|
$type = "think";
|
||||||
|
}
|
||||||
|
|
||||||
|
$lists[$group][] = [
|
||||||
|
'name' => $cmdName,
|
||||||
|
'type' => $type,
|
||||||
|
'group' => $group,
|
||||||
|
'class' => $className,
|
||||||
|
'description'=> $classObj->getDescription(),
|
||||||
|
'aliases' => $classObj->getAliases(),
|
||||||
|
'arguments' => $classObj->getDefinition()->getArguments(),
|
||||||
|
'options' => $classObj->getDefinition()->getOptions()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$results = [];
|
||||||
|
foreach ($lists as $group => $list) {
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$results[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->writeSuccess('ok', $results);
|
||||||
|
}
|
||||||
|
}
|
||||||
16
app/controller/admin/system/dev/ComposerController.php
Normal file
16
app/controller/admin/system/dev/ComposerController.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller\admin\system\dev;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
use think\response\Json;
|
||||||
|
|
||||||
|
class ComposerController extends BaseController
|
||||||
|
{
|
||||||
|
public function list(): Json
|
||||||
|
{
|
||||||
|
$composerLockFile = $this->app->getRootPath() . 'composer.lock';
|
||||||
|
$composerLockData = json_decode(file_get_contents($composerLockFile), true);
|
||||||
|
return $this->writeSuccess('ok', $composerLockData);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/controller/admin/system/dev/CrontabController.php
Normal file
17
app/controller/admin/system/dev/CrontabController.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\adminx\controller;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
use app\entity\SysDevCrontab;
|
||||||
|
|
||||||
|
class CrontabController extends BaseController
|
||||||
|
{
|
||||||
|
public function page()
|
||||||
|
{
|
||||||
|
$crontab = new SysDevCrontab();
|
||||||
|
$result = $crontab->paginate();
|
||||||
|
|
||||||
|
return $this->writeSuccess('ok', $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user