|
@@ -56,27 +56,31 @@ class Mail { |
|
@@ -56,27 +56,31 @@ class Mail { |
56
|
|
56
|
|
57
|
// $db->transaction();
|
57
|
// $db->transaction();
|
58
|
foreach ($folders as $folder){
|
58
|
foreach ($folders as $folder){
|
59
|
- // 处理子父文件夹
|
|
|
60
|
- $folder['id'] = explode('/',$folder['folder']);
|
|
|
61
|
- $folder['name'] = explode('/',$folder['parseFolder']);
|
|
|
62
|
$pid = 0;
|
59
|
$pid = 0;
|
63
|
- foreach ($folder['id'] as $k=>$item){
|
|
|
64
|
- $data = [
|
60
|
+ $uuid = md5($email_id.$folder['folder']);
|
|
|
61
|
+
|
|
|
62
|
+ // 处理子父文件夹
|
|
|
63
|
+ if(str_contains($folder['folder'], '/')){
|
|
|
64
|
+ // 子目录
|
|
|
65
|
+ $folder['name'] = explode('/',$folder['parseFolder']);
|
|
|
66
|
+ // 查找pid
|
|
|
67
|
+ $pid = $db->value(folderSql::has(['uuid'=>md5($email_id.explode('/',$folder['folder'])[0])]));
|
|
|
68
|
+ // 去掉父目录名称
|
|
|
69
|
+ $folder['parseFolder'] = explode('/',$folder['parseFolder'])[1];
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
|
72
|
+ try {
|
|
|
73
|
+ $db->insert(folderSql::$table,[
|
65
|
'email_id' => $email_id,
|
74
|
'email_id' => $email_id,
|
66
|
- 'folder' => $folder['name'][$k],
|
|
|
67
|
- 'origin_folder' => $item,
|
|
|
68
|
- 'pid' => $pid
|
|
|
69
|
- ];
|
|
|
70
|
-
|
|
|
71
|
- if(!$db->value(folderSql::has($data))){
|
|
|
72
|
- // 插入到数据库
|
|
|
73
|
- $pid = $db->insert(
|
|
|
74
|
- folderSql::$table,
|
|
|
75
|
- $data,
|
|
|
76
|
- false
|
|
|
77
|
- );
|
|
|
78
|
- }
|
75
|
+ 'folder' => $folder['parseFolder'],
|
|
|
76
|
+ 'origin_folder' => $folder['folder'],
|
|
|
77
|
+ 'uuid' => $uuid,
|
|
|
78
|
+ 'pid' => $pid
|
|
|
79
|
+ ],false);
|
|
|
80
|
+ }catch (\Throwable $e){
|
|
|
81
|
+ // 这里就不处理失败了
|
79
|
}
|
82
|
}
|
|
|
83
|
+
|
80
|
}
|
84
|
}
|
81
|
// $db->commit();
|
85
|
// $db->commit();
|
82
|
|
86
|
|