修改 js
This commit is contained in:
parent
438582ad6a
commit
6e73f78bd3
73
extend/catcher/command/CompressPackageCommand.php
Normal file
73
extend/catcher/command/CompressPackageCommand.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace catcher\command;
|
||||||
|
|
||||||
|
use catcher\CatchAdmin;
|
||||||
|
use think\console\Command;
|
||||||
|
use think\console\Input;
|
||||||
|
use think\console\input\Argument;
|
||||||
|
use think\console\input\Option;
|
||||||
|
use think\console\Output;
|
||||||
|
|
||||||
|
class CompressPackageToZipCommand extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
// 指令配置
|
||||||
|
$this->setName('package:zip')
|
||||||
|
->addArgument('package', Argument::REQUIRED, 'package name')
|
||||||
|
->setDescription('compress package to zip');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(Input $input, Output $output)
|
||||||
|
{
|
||||||
|
$package = $this->input->getArgument('package');
|
||||||
|
if (!is_dir(CatchAdmin::directory() . $package)) {
|
||||||
|
$package = $this->output->ask($this->input, sprintf('Can not find [%s] in catchAdmin directory, you should input package again', $package));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir(CatchAdmin::directory() . $package)) {
|
||||||
|
$this->output->error('check package exists?');exit;
|
||||||
|
}
|
||||||
|
$this->zip($package);
|
||||||
|
|
||||||
|
// 指令输出
|
||||||
|
$output->info('succeed!');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function zip($package)
|
||||||
|
{
|
||||||
|
$packageZip = new \ZipArchive($package . '.zip', \ZipArchive::CREATE);
|
||||||
|
|
||||||
|
$files = $dirs = [];
|
||||||
|
$this->getFilesFromDir(CatchAdmin::directory() . $package, $files, $dirs);
|
||||||
|
|
||||||
|
dd($dirs);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
var_dump(basename($file));
|
||||||
|
}
|
||||||
|
$packageZip->addFile();
|
||||||
|
$packageZip->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function unzip()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getFilesFromDir($packageDir, &$files = [], &$dir = [])
|
||||||
|
{
|
||||||
|
$fileSystemIterator = new \FilesystemIterator($packageDir);
|
||||||
|
|
||||||
|
foreach ($fileSystemIterator as $fileSystem) {
|
||||||
|
if ($fileSystem->isDir()) {
|
||||||
|
$this->getFilesFromDir($fileSystem->getPathName(), $files);
|
||||||
|
$dir[] = $fileSystem->getPathName();
|
||||||
|
} else {
|
||||||
|
$files[] = $fileSystem->getPathName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,11 +29,13 @@ layui.config({
|
|||||||
var admin = layui.admin;
|
var admin = layui.admin;
|
||||||
|
|
||||||
admin.ajaxSuccessBefore = function (res, requestUrl) {
|
admin.ajaxSuccessBefore = function (res, requestUrl) {
|
||||||
if(res.code !== 10000){
|
if (typeof(res) != 'string') {
|
||||||
|
if (res.code !== 10000) {
|
||||||
layer.msg(res.msg, {icon: 2});
|
layer.msg(res.msg, {icon: 2});
|
||||||
return false; // 返回false阻止代码执行
|
return false; // 返回false阻止代码执行
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 移除loading动画
|
// 移除loading动画
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user