作者 邓超

1

... ... @@ -10,4 +10,4 @@ include_once __DIR__."/../vendor/autoload.php";
//print_r(db()->value(listsSql::lastMsgno(1,89)));
start_now_mail();
\ No newline at end of file
start_now_mail();
... ...
... ... @@ -270,7 +270,7 @@ function sync($worker_id=0){
}else{
foreach ($folder as $item){
// 同步子文件夹
$mailServer->syncMail($id,$item['id'],$folder['origin_folder'].'/'.$item['origin_folder']);
$mailServer->syncMail($id,$item['id'],$item['origin_folder']);
}
}
... ...
... ... @@ -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();
... ...