update
This commit is contained in:
1
addons/command/.addonrc
Normal file
1
addons/command/.addonrc
Normal file
@@ -0,0 +1 @@
|
||||
{"files":["application\\admin\\controller\\Command.php","application\\admin\\lang\\zh-cn\\command.php","application\\admin\\model\\Command.php","application\\admin\\validate\\Command.php","application\\admin\\view\\command\\add.html","application\\admin\\view\\command\\detail.html","application\\admin\\view\\command\\index.html","public\\assets\\js\\backend\\command.js"],"license":"regular","licenseto":"6223","licensekey":"rKTYoS1sgHL8izbp ZQeoL2x4s2yxbmzh7HAICQ==","domains":["hphb.com"],"licensecodes":[],"validations":["f8b7a3069155d30685a8a2976040a1d7"],"menus":["command","command\/index","command\/add","command\/detail","command\/execute","command\/del","command\/multi"]}
|
||||
69
addons/command/Command.php
Normal file
69
addons/command/Command.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace addons\command;
|
||||
|
||||
use app\common\library\Menu;
|
||||
use think\Addons;
|
||||
|
||||
/**
|
||||
* 在线命令插件
|
||||
*/
|
||||
class Command extends Addons
|
||||
{
|
||||
|
||||
/**
|
||||
* 插件安装方法
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
$menu = [
|
||||
[
|
||||
'name' => 'command',
|
||||
'title' => '在线命令管理',
|
||||
'icon' => 'fa fa-terminal',
|
||||
'sublist' => [
|
||||
['name' => 'command/index', 'title' => '查看'],
|
||||
['name' => 'command/add', 'title' => '添加'],
|
||||
['name' => 'command/detail', 'title' => '详情'],
|
||||
['name' => 'command/execute', 'title' => '运行'],
|
||||
['name' => 'command/del', 'title' => '删除'],
|
||||
['name' => 'command/multi', 'title' => '批量更新'],
|
||||
]
|
||||
]
|
||||
];
|
||||
Menu::create($menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件卸载方法
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
Menu::delete('command');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件启用方法
|
||||
* @return bool
|
||||
*/
|
||||
public function enable()
|
||||
{
|
||||
Menu::enable('command');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件禁用方法
|
||||
* @return bool
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
Menu::disable('command');
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
4
addons/command/config.php
Normal file
4
addons/command/config.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
];
|
||||
15
addons/command/controller/Index.php
Normal file
15
addons/command/controller/Index.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace addons\command\controller;
|
||||
|
||||
use think\addons\Controller;
|
||||
|
||||
class Index extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->error("当前插件暂无前台页面");
|
||||
}
|
||||
|
||||
}
|
||||
10
addons/command/info.ini
Normal file
10
addons/command/info.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
name = command
|
||||
title = 在线命令
|
||||
intro = 可在线执行一键生成CRUD、一键生成菜单等相关命令
|
||||
author = FastAdmin
|
||||
website = https://www.fastadmin.net
|
||||
version = 1.1.0
|
||||
state = 1
|
||||
url = /addons/command
|
||||
license = regular
|
||||
licenseto = 6223
|
||||
12
addons/command/install.sql
Normal file
12
addons/command/install.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS `__PREFIX__command` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '类型',
|
||||
`params` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '参数',
|
||||
`command` varchar(1500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '命令',
|
||||
`content` text COMMENT '返回结果',
|
||||
`executetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '执行时间',
|
||||
`createtime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '创建时间',
|
||||
`updatetime` bigint(16) UNSIGNED DEFAULT NULL COMMENT '更新时间',
|
||||
`status` enum('successed','failured') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'failured' COMMENT '状态',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '在线命令表';
|
||||
28
addons/command/library/Output.php
Normal file
28
addons/command/library/Output.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace addons\command\library;
|
||||
|
||||
/**
|
||||
* Class Output
|
||||
*/
|
||||
class Output extends \think\console\Output
|
||||
{
|
||||
|
||||
protected $message = [];
|
||||
|
||||
public function __construct($driver = 'console')
|
||||
{
|
||||
parent::__construct($driver);
|
||||
}
|
||||
|
||||
protected function block($style, $message)
|
||||
{
|
||||
$this->message[] = $message;
|
||||
}
|
||||
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user