[更新]修改项目同步更新

This commit is contained in:
Anyon 2019-07-19 14:24:10 +08:00
parent 5cfc17b0eb
commit 16aa9ecf29
2 changed files with 17 additions and 24 deletions

View File

@ -28,14 +28,13 @@ class Plugs extends Controller
{
/**
* Plugs constructor.
* 系统选择器图标
*/
public function __construct()
public function icon()
{
parent::__construct();
if (!NodeService::islogin()) {
$this->error('访问授权失败,请重新登录授权再试!');
}
$this->title = '图标选择器';
$this->field = input('field', 'icon');
$this->fetch();
}
/**
@ -46,13 +45,16 @@ class Plugs extends Controller
*/
public function plupload()
{
if (!NodeService::islogin()) {
$this->error('访问授权失败,请重新登录授权再试!');
}
if (!($file = $this->getUploadFile()) || empty($file)) {
return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]);
}
if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
return json(['uploaded' => false, 'error' => ['message' => '文件上传类型受限,请在后台配置']]);
}
if ($file->checkExt('php')) {
if ($file->checkExt('php,sh')) {
return json(['uploaded' => false, 'error' => ['message' => '可执行文件禁止上传到本地服务器']]);
}
$this->safe = boolval(input('safe'));
@ -95,14 +97,4 @@ class Plugs extends Controller
}
}
/**
* 系统选择器图标
*/
public function icon()
{
$this->title = '图标选择器';
$this->field = input('field', 'icon');
$this->fetch();
}
}

View File

@ -36,7 +36,7 @@ class Update extends Controller
*/
public function tree()
{
$sync = new Sync('update');
$sync = new Sync('Update');
$this->success('获取当前文件列表成功!', $sync->build());
}
@ -46,13 +46,14 @@ class Update extends Controller
*/
public function read($encode)
{
$file = env('root_path') . decode($encode);
if (!file_exists($file)) {
$this->error('获取文件内容失败!');
} else {
$this->success('获取文件内容成功!', [
'format' => 'base64', 'content' => base64_encode(file_get_contents($file)),
$this->file = env('root_path') . decode($encode);
if (file_exists($this->file)) {
$this->success('读取文件成功!', [
'format' => 'base64',
'content' => base64_encode(file_get_contents($this->file)),
]);
} else {
$this->error('获取文件内容失败!');
}
}