...
|
...
|
@@ -56,27 +56,31 @@ class Mail { |
|
|
|
|
|
// $db->transaction();
|
|
|
foreach ($folders as $folder){
|
|
|
// 处理子父文件夹
|
|
|
$folder['id'] = explode('/',$folder['folder']);
|
|
|
$folder['name'] = explode('/',$folder['parseFolder']);
|
|
|
$pid = 0;
|
|
|
foreach ($folder['id'] as $k=>$item){
|
|
|
$data = [
|
|
|
$uuid = md5($email_id.$folder['folder']);
|
|
|
|
|
|
// 处理子父文件夹
|
|
|
if(str_contains($folder['folder'], '/')){
|
|
|
// 子目录
|
|
|
$folder['name'] = explode('/',$folder['parseFolder']);
|
|
|
// 查找pid
|
|
|
$pid = $db->value(folderSql::has(['uuid'=>md5($email_id.explode('/',$folder['folder'])[0])]));
|
|
|
// 去掉父目录名称
|
|
|
$folder['parseFolder'] = explode('/',$folder['parseFolder'])[1];
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
$db->insert(folderSql::$table,[
|
|
|
'email_id' => $email_id,
|
|
|
'folder' => $folder['name'][$k],
|
|
|
'origin_folder' => $item,
|
|
|
'pid' => $pid
|
|
|
];
|
|
|
|
|
|
if(!$db->value(folderSql::has($data))){
|
|
|
// 插入到数据库
|
|
|
$pid = $db->insert(
|
|
|
folderSql::$table,
|
|
|
$data,
|
|
|
false
|
|
|
);
|
|
|
}
|
|
|
'folder' => $folder['parseFolder'],
|
|
|
'origin_folder' => $folder['folder'],
|
|
|
'uuid' => $uuid,
|
|
|
'pid' => $pid
|
|
|
],false);
|
|
|
}catch (\Throwable $e){
|
|
|
// 这里就不处理失败了
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// $db->commit();
|
|
|
|
...
|
...
|
|