更新
This commit is contained in:
@@ -80,4 +80,62 @@ function parse_config_attr($string) {
|
|||||||
$value = $array;
|
$value = $array;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mk_dir($dir, $mode = 0755) {
|
||||||
|
if (is_dir($dir) || @mkdir($dir, $mode, true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mk_dir(dirname($dir), $mode, true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @mkdir($dir, $mode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转换为数组,主要用于把分隔符调整到第二个参数
|
||||||
|
* @param string $str 要分割的字符串
|
||||||
|
* @param string $glue 分割符
|
||||||
|
* @return array
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
function str2arr($str = '', $glue = ',') {
|
||||||
|
if ($str) {
|
||||||
|
return explode($glue, $str);
|
||||||
|
} else {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数组转换为字符串,主要用于把分隔符调整到第二个参数
|
||||||
|
* @param array $arr 要连接的数组
|
||||||
|
* @param string $glue 分割符
|
||||||
|
* @return string
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
function arr2str($arr = array(), $glue = ',') {
|
||||||
|
if (empty($arr)) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return implode($glue, $arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化字节大小
|
||||||
|
* @param number $size 字节数
|
||||||
|
* @param string $delimiter 数字和单位分隔符
|
||||||
|
* @return string 格式化后的带单位的大小
|
||||||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
|
*/
|
||||||
|
function format_bytes($size, $delimiter = '') {
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
|
||||||
|
for ($i = 0; $size >= 1024 && $i < 5; $i++) {
|
||||||
|
$size /= 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
return round($size, 2) . $delimiter . $units[$i];
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ class Database extends Admin {
|
|||||||
/* 数据还原 */
|
/* 数据还原 */
|
||||||
case 'import':
|
case 'import':
|
||||||
//列出备份文件列表
|
//列出备份文件列表
|
||||||
$path = config('data_backup_path');
|
$path = \think\facade\Cache::get('system_config_data.data_backup_path');
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
mkdir($path, 0755, true);
|
mkdir($path, 0755, true);
|
||||||
}
|
}
|
||||||
@@ -63,8 +63,7 @@ class Database extends Admin {
|
|||||||
break;
|
break;
|
||||||
/* 数据备份 */
|
/* 数据备份 */
|
||||||
case 'export':
|
case 'export':
|
||||||
$Db = \think\Db::connect();
|
$list = \think\facade\Db::query('SHOW TABLE STATUS');
|
||||||
$list = $Db->query('SHOW TABLE STATUS');
|
|
||||||
$list = array_map('array_change_key_case', $list);
|
$list = array_map('array_change_key_case', $list);
|
||||||
$title = '数据备份';
|
$title = '数据备份';
|
||||||
break;
|
break;
|
||||||
@@ -72,8 +71,9 @@ class Database extends Admin {
|
|||||||
return $this->error('参数错误!');
|
return $this->error('参数错误!');
|
||||||
}
|
}
|
||||||
//渲染模板
|
//渲染模板
|
||||||
$this->setMeta($title);
|
$this->data = [
|
||||||
$this->assign('list', $list);
|
'list' => $list
|
||||||
|
];
|
||||||
return $this->fetch($type);
|
return $this->fetch($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,23 +59,26 @@ class Config extends Model {
|
|||||||
private static function parse($type, $value) {
|
private static function parse($type, $value) {
|
||||||
$data = [];
|
$data = [];
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'textarea': //解析数组
|
case 'textarea': //解析数组
|
||||||
$array = preg_split('/[,;\r\n]+/', trim($value, ",;\r\n"));
|
$array = preg_split('/[,;\r\n]+/', trim($value, ",;\r\n"));
|
||||||
if (strpos($value, ':')) {
|
if (strpos($value, ':')) {
|
||||||
foreach ($array as $val) {
|
foreach ($array as $val) {
|
||||||
$list = explode(':', $val);
|
$list = explode(':', $val);
|
||||||
if (isset($list[2])) {
|
if (isset($list[2])) {
|
||||||
$data[] = ['key' => is_numeric($list[0]) ? (int) $list[0] : $list[0], 'value' => $list[1], 'label' => $list[1], 'other' => $list[2]];
|
$data[] = ['key' => is_numeric($list[0]) ? (int) $list[0] : $list[0], 'value' => $list[1], 'label' => $list[1], 'other' => $list[2]];
|
||||||
} else {
|
} else {
|
||||||
$data[] = ['key' => is_numeric($list[0]) ? (int) $list[0] : $list[0], 'value' => $list[1], 'label' => $list[1]];
|
$data[] = ['key' => is_numeric($list[0]) ? (int) $list[0] : $list[0], 'value' => $list[1], 'label' => $list[1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($array as $key => $val) {
|
||||||
|
$data[] = ['key' => $key, 'value' => $val, 'label' => $val];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
foreach ($array as $key => $val) {
|
default:
|
||||||
$data[] = ['key' => $key, 'value' => $val, 'label' => $val];
|
return $value;
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
2
public/uploads/files/.gitignore
vendored
Normal file
2
public/uploads/files/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
public/uploads/images/.gitignore
vendored
Normal file
2
public/uploads/images/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
public/uploads/media/.gitignore
vendored
Normal file
2
public/uploads/media/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user