正在显示
1 个修改的文件
包含
27 行增加
和
0 行删除
@@ -107,6 +107,16 @@ class Folder extends Base { | @@ -107,6 +107,16 @@ class Folder extends Base { | ||
107 | 107 | ||
108 | // 加密后的文件夹 | 108 | // 加密后的文件夹 |
109 | $origin_folder = MailFun::folderEncoding($formData['folder']); | 109 | $origin_folder = MailFun::folderEncoding($formData['folder']); |
110 | + | ||
111 | + // 修改 | ||
112 | + $id = app()->request('id',0,'intval'); | ||
113 | + if($id){ | ||
114 | + $folder = db()->first(folderSql::first($id)); | ||
115 | + if(!$folder || $folder['email_id'] != $email['id']){ | ||
116 | + app()->e('folder_not_exist'); | ||
117 | + } | ||
118 | + | ||
119 | + }else{ | ||
110 | // 不为空上级 | 120 | // 不为空上级 |
111 | if(!empty($formData['pid'])){ | 121 | if(!empty($formData['pid'])){ |
112 | $parent = db()->first(folderSql::first(['id'=>$formData['pid']])); | 122 | $parent = db()->first(folderSql::first(['id'=>$formData['pid']])); |
@@ -120,6 +130,7 @@ class Folder extends Base { | @@ -120,6 +130,7 @@ class Folder extends Base { | ||
120 | // 加密后的文件夹 | 130 | // 加密后的文件夹 |
121 | $origin_folder = $parent['origin_folder'].'/'.$origin_folder; | 131 | $origin_folder = $parent['origin_folder'].'/'.$origin_folder; |
122 | } | 132 | } |
133 | + } | ||
123 | 134 | ||
124 | // 判断文件夹是否存在 | 135 | // 判断文件夹是否存在 |
125 | $has = db()->count(folderSql::has( | 136 | $has = db()->count(folderSql::has( |
@@ -144,13 +155,27 @@ class Folder extends Base { | @@ -144,13 +155,27 @@ class Folder extends Base { | ||
144 | app()->e('login_error_imap'); | 155 | app()->e('login_error_imap'); |
145 | } | 156 | } |
146 | 157 | ||
158 | + if($id){ | ||
159 | + // 远程创建 | ||
160 | + $ret = $mail->client->folderRename($folder['origin_folder'],$origin_folder); | ||
161 | + | ||
162 | + }else{ | ||
147 | // 远程创建 | 163 | // 远程创建 |
148 | $ret = $mail->client->folderCreate($origin_folder); | 164 | $ret = $mail->client->folderCreate($origin_folder); |
165 | + } | ||
149 | 166 | ||
150 | if($ret[0] === false){ | 167 | if($ret[0] === false){ |
151 | app()->e($ret[1]); | 168 | app()->e($ret[1]); |
152 | } | 169 | } |
153 | 170 | ||
171 | + if($id){ | ||
172 | + // 更新 | ||
173 | + db()->update(folderSql::$table,[ | ||
174 | + 'folder' => $formData['folder'], | ||
175 | + 'origin_folder' => $origin_folder, | ||
176 | + 'uuid' => md5($email['id'].$origin_folder), | ||
177 | + ],dbWhere(['id'=>$id]),false); | ||
178 | + }else{ | ||
154 | // 插入数据,就算插入失败了,也会把文件夹同步回来 | 179 | // 插入数据,就算插入失败了,也会把文件夹同步回来 |
155 | $id = db()->insert(folderSql::$table,[ | 180 | $id = db()->insert(folderSql::$table,[ |
156 | 'pid' => $parent['id']??0, | 181 | 'pid' => $parent['id']??0, |
@@ -160,6 +185,8 @@ class Folder extends Base { | @@ -160,6 +185,8 @@ class Folder extends Base { | ||
160 | 'uuid' => md5($email['id'].$origin_folder), | 185 | 'uuid' => md5($email['id'].$origin_folder), |
161 | ],false); | 186 | ],false); |
162 | 187 | ||
188 | + } | ||
189 | + | ||
163 | // if(!$id){ | 190 | // if(!$id){ |
164 | // app()->e('folder_create_save_error'); | 191 | // app()->e('folder_create_save_error'); |
165 | // } | 192 | // } |
-
请 注册 或 登录 后发表评论