Skip to content

Commit

Permalink
更新:优化菜单备份功能
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Jan 16, 2023
1 parent 4858fe6 commit ffe5d11
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Plugins/Core/Menu.php
Expand Up @@ -129,8 +129,15 @@ private function unserialize($data)
public function backup()
{

$menu_serialize = $this->serialize($this->get());
$menu = json_encode($this->get(),JSON_PRETTY_PRINT,JSON_UNESCAPED_UNICODE);
$data = [];
foreach ($this->get() as $k=>$v){
if(arr_has($v,'quanxian') && $v['quanxian'] instanceof \Closure){
$v['quanxian']=$this->serialize($v['quanxian']);
}
$data[$k]=$v;
}
$menu_serialize = $this->serialize($data);
$menu = json_encode($data,JSON_PRETTY_PRINT,JSON_UNESCAPED_UNICODE);
if (! is_dir(BASE_PATH . '/runtime/backup')) {
System::exec('cd ' . BASE_PATH . '/runtime' . '&& mkdir ' . 'backup');
}
Expand Down

0 comments on commit ffe5d11

Please sign in to comment.