ComposerUpdate

This commit is contained in:
Anyon 2019-11-01 17:22:47 +08:00
parent 629e9c715d
commit 73a0a88f30
5 changed files with 30 additions and 16 deletions

View File

@ -24,32 +24,27 @@ use think\admin\Controller;
*/
class Update extends Controller
{
/**
* 基础URL地址
* @var string
*/
protected $baseUri = 'https://demo.thinkadmin.top';
/**
* 获取文件列表
*/
public function tree()
{
$sync = new Sync('Update');
$this->success('获取当前文件列表成功!', $sync->build());
$plugs = new \think\admin\plugs\Plugs();
$this->success('获取当前文件列表成功!', $plugs->buildFileList([
'think', 'app/admin', 'public/static',
], ['public/static/self']));
}
/**
* 读取线上文件数据
* @param string $encode
*/
public function read($encode)
public function get($encode)
{
$this->file = env('root_path') . decode($encode);
$this->file = dirname($this->app->getAppPath()) . '/' . decode($encode);
if (file_exists($this->file)) {
$this->success('读取文件成功!', [
'format' => 'base64',
'content' => base64_encode(file_get_contents($this->file)),
'format' => 'base64', 'content' => base64_encode(file_get_contents($this->file)),
]);
} else {
$this->error('获取文件内容失败!');

View File

@ -66,6 +66,7 @@ class ThinkLibrary extends Service
'think\admin\queue\StartQueue',
'think\admin\queue\QueryQueue',
'think\admin\queue\ListenQueue',
'think\admin\plugs\AdminPlugs'
]);
}

View File

@ -2,7 +2,21 @@
namespace think\admin\plugs;
use think\console\Input;
use think\console\Output;
class AdminPlugs extends Plugs
{
protected function configure()
{
$this->modules = ['application/admin/', 'think'];
$this->setName('xplugs:admin')->setDescription('[同步]覆盖本地Admin模块代码');
}
protected function execute(Input $input, Output $output)
{
$this->modules['admin'];
dump($this->uri);
}
}

View File

@ -22,7 +22,7 @@ class Plugs extends Command
* 项目根目录
* @var string
*/
protected $root;
protected $path;
/**
* 当前版本号
@ -36,13 +36,17 @@ class Plugs extends Command
*/
protected $modules = [];
public function __construct()
/**
* 插件指令初始化
* @param Input $input
* @param Output $output
*/
protected function initialize(Input $input, Output $output)
{
parent::__construct();
$this->version = $this->app->config->get('app.thinkadmin_ver');
if (empty($this->version)) $this->version = 'v4';
$this->uri = "https://{$this->version}.thinkadmin.top";
$this->root = strtr(dirname($this->app->getAppPath()) . '/', '\\', '/');
$this->path = strtr($this->app->getAppPath(), '\\', '/');
}
protected function execute(Input $input, Output $output)