...
|
...
|
@@ -107,6 +107,16 @@ class Folder extends Base { |
|
|
|
|
|
// 加密后的文件夹
|
|
|
$origin_folder = MailFun::folderEncoding($formData['folder']);
|
|
|
|
|
|
// 修改
|
|
|
$id = app()->request('id',0,'intval');
|
|
|
if($id){
|
|
|
$folder = db()->first(folderSql::first($id));
|
|
|
if(!$folder || $folder['email_id'] != $email['id']){
|
|
|
app()->e('folder_not_exist');
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
// 不为空上级
|
|
|
if(!empty($formData['pid'])){
|
|
|
$parent = db()->first(folderSql::first(['id'=>$formData['pid']]));
|
...
|
...
|
@@ -120,6 +130,7 @@ class Folder extends Base { |
|
|
// 加密后的文件夹
|
|
|
$origin_folder = $parent['origin_folder'].'/'.$origin_folder;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 判断文件夹是否存在
|
|
|
$has = db()->count(folderSql::has(
|
...
|
...
|
@@ -144,13 +155,27 @@ class Folder extends Base { |
|
|
app()->e('login_error_imap');
|
|
|
}
|
|
|
|
|
|
if($id){
|
|
|
// 远程创建
|
|
|
$ret = $mail->client->folderRename($folder['origin_folder'],$origin_folder);
|
|
|
|
|
|
}else{
|
|
|
// 远程创建
|
|
|
$ret = $mail->client->folderCreate($origin_folder);
|
|
|
}
|
|
|
|
|
|
if($ret[0] === false){
|
|
|
app()->e($ret[1]);
|
|
|
}
|
|
|
|
|
|
if($id){
|
|
|
// 更新
|
|
|
db()->update(folderSql::$table,[
|
|
|
'folder' => $formData['folder'],
|
|
|
'origin_folder' => $origin_folder,
|
|
|
'uuid' => md5($email['id'].$origin_folder),
|
|
|
],dbWhere(['id'=>$id]),false);
|
|
|
}else{
|
|
|
// 插入数据,就算插入失败了,也会把文件夹同步回来
|
|
|
$id = db()->insert(folderSql::$table,[
|
|
|
'pid' => $parent['id']??0,
|
...
|
...
|
@@ -160,6 +185,8 @@ class Folder extends Base { |
|
|
'uuid' => md5($email['id'].$origin_folder),
|
|
|
],false);
|
|
|
|
|
|
}
|
|
|
|
|
|
// if(!$id){
|
|
|
// app()->e('folder_create_save_error');
|
|
|
// }
|
...
|
...
|
|