|
@@ -146,47 +146,47 @@ class Mail { |
|
@@ -146,47 +146,47 @@ class Mail { |
146
|
$pid = $db->value(folderSql::has(['uuid'=>md5($email_id.$folder['pname'])]));
|
146
|
$pid = $db->value(folderSql::has(['uuid'=>md5($email_id.$folder['pname'])]));
|
147
|
$pid = $pid ? $pid : 0;
|
147
|
$pid = $pid ? $pid : 0;
|
148
|
// try {
|
148
|
// try {
|
149
|
- $folder_name = '';
|
|
|
150
|
- // 已发送
|
|
|
151
|
- if(in_array('Send',$folder['check'])){
|
|
|
152
|
- $folder_name = folderAlias('Send');
|
|
|
153
|
- }
|
|
|
154
|
- // 草稿
|
|
|
155
|
- elseif(in_array('Drafts',$folder['check'])){
|
|
|
156
|
- $folder_name = folderAlias('Drafts');
|
|
|
157
|
- }
|
|
|
158
|
- // 垃圾
|
|
|
159
|
- elseif(in_array('Junk',$folder['check'])){
|
|
|
160
|
- $folder_name = folderAlias('Junk');
|
|
|
161
|
- }
|
|
|
162
|
- // 回收站
|
|
|
163
|
- elseif(in_array('Trash',$folder['check'])){
|
|
|
164
|
- $folder_name = folderAlias('Trash');
|
|
|
165
|
- }
|
149
|
+ $folder_name = '';
|
|
|
150
|
+ // 已发送
|
|
|
151
|
+ if(in_array('Send',$folder['check'])){
|
|
|
152
|
+ $folder_name = folderAlias('Send');
|
|
|
153
|
+ }
|
|
|
154
|
+ // 草稿
|
|
|
155
|
+ elseif(in_array('Drafts',$folder['check'])){
|
|
|
156
|
+ $folder_name = folderAlias('Drafts');
|
|
|
157
|
+ }
|
|
|
158
|
+ // 垃圾
|
|
|
159
|
+ elseif(in_array('Junk',$folder['check'])){
|
|
|
160
|
+ $folder_name = folderAlias('Junk');
|
|
|
161
|
+ }
|
|
|
162
|
+ // 回收站
|
|
|
163
|
+ elseif(in_array('Trash',$folder['check'])){
|
|
|
164
|
+ $folder_name = folderAlias('Trash');
|
|
|
165
|
+ }
|
166
|
|
166
|
|
167
|
- if(!$folder_name){
|
|
|
168
|
- $fn = explode('/',$folder['parseFolder']);
|
|
|
169
|
- $folder_name = folderAlias(end($fn));
|
|
|
170
|
- }
|
|
|
171
|
- if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
|
|
|
172
|
- $db->insert(folderSql::$table,[
|
|
|
173
|
- 'email_id' => $email_id,
|
|
|
174
|
- 'folder' => folderAlias($folder_name),
|
|
|
175
|
- 'origin_folder' => $folder['folder'],
|
|
|
176
|
- 'uuid' => $uuid,
|
|
|
177
|
- 'pid' => $pid
|
|
|
178
|
- ],false);
|
|
|
179
|
- }else{
|
|
|
180
|
- $db->update(folderSql::$table,[
|
|
|
181
|
- 'email_id' => $email_id,
|
|
|
182
|
- 'folder' => folderAlias($folder_name),
|
|
|
183
|
- 'origin_folder' => $folder['folder'],
|
|
|
184
|
- 'uuid' => $uuid,
|
|
|
185
|
- 'pid' => $pid
|
|
|
186
|
- ],dbWhere(['email_id' => $email_id,'uuid' => $uuid]),false);
|
|
|
187
|
- }
|
167
|
+ if(!$folder_name){
|
|
|
168
|
+ $fn = explode('/',$folder['parseFolder']);
|
|
|
169
|
+ $folder_name = folderAlias(end($fn));
|
|
|
170
|
+ }
|
|
|
171
|
+ if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
|
|
|
172
|
+ $db->insert(folderSql::$table,[
|
|
|
173
|
+ 'email_id' => $email_id,
|
|
|
174
|
+ 'folder' => folderAlias($folder_name),
|
|
|
175
|
+ 'origin_folder' => $folder['folder'],
|
|
|
176
|
+ 'uuid' => $uuid,
|
|
|
177
|
+ 'pid' => $pid
|
|
|
178
|
+ ],false);
|
|
|
179
|
+ }else{
|
|
|
180
|
+ $db->update(folderSql::$table,[
|
|
|
181
|
+ 'email_id' => $email_id,
|
|
|
182
|
+ 'folder' => folderAlias($folder_name),
|
|
|
183
|
+ 'origin_folder' => $folder['folder'],
|
|
|
184
|
+ 'uuid' => $uuid,
|
|
|
185
|
+ 'pid' => $pid
|
|
|
186
|
+ ],dbWhere(['email_id' => $email_id,'uuid' => $uuid]),false);
|
|
|
187
|
+ }
|
188
|
// }catch (\Throwable $e){
|
188
|
// }catch (\Throwable $e){
|
189
|
- // 这里就不处理失败了
|
189
|
+ // 这里就不处理失败了
|
190
|
// }
|
190
|
// }
|
191
|
|
191
|
|
192
|
unset($folders[$fk]);
|
192
|
unset($folders[$fk]);
|
|
@@ -282,7 +282,8 @@ class Mail { |
|
@@ -282,7 +282,8 @@ class Mail { |
282
|
|
282
|
|
283
|
$uids = array_column($uids,'UID');
|
283
|
$uids = array_column($uids,'UID');
|
284
|
foreach ($uids as $k=>$uid){
|
284
|
foreach ($uids as $k=>$uid){
|
285
|
- if($db->cache(86400*30)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
|
285
|
+ if($db->cache(86400*30,false)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
|
|
|
286
|
+
|
286
|
unset($uids[$k]);
|
287
|
unset($uids[$k]);
|
287
|
}
|
288
|
}
|
288
|
}
|
289
|
}
|
|
@@ -444,7 +445,7 @@ class Mail { |
|
@@ -444,7 +445,7 @@ class Mail { |
444
|
if(php_sapi_name()=='cli'){
|
445
|
if(php_sapi_name()=='cli'){
|
445
|
go(function ($id,$header,$data){
|
446
|
go(function ($id,$header,$data){
|
446
|
new syncMail($id,$header,$data);
|
447
|
new syncMail($id,$header,$data);
|
447
|
- },
|
448
|
+ },
|
448
|
...[$id,$header,$data]
|
449
|
...[$id,$header,$data]
|
449
|
);
|
450
|
);
|
450
|
}
|
451
|
}
|