|
@@ -458,6 +458,13 @@ class Home extends Base { |
|
@@ -458,6 +458,13 @@ class Home extends Base { |
458
|
* @time 2023/3/21 11:41
|
458
|
* @time 2023/3/21 11:41
|
459
|
*/
|
459
|
*/
|
460
|
public function move(){
|
460
|
public function move(){
|
|
|
461
|
+ $this->moveCopy(function (Mail $mailInstance,$uid,$origin_folder,$to_origin_folder){
|
|
|
462
|
+ return $mailInstance->move($uid,$origin_folder,$to_origin_folder);
|
|
|
463
|
+ });
|
|
|
464
|
+ }
|
|
|
465
|
+
|
|
|
466
|
+
|
|
|
467
|
+ private function moveCopy(\Closure $call){
|
461
|
$emails = $this->getEmails();
|
468
|
$emails = $this->getEmails();
|
462
|
|
469
|
|
463
|
$mail_ids = app()->request('mail_ids');
|
470
|
$mail_ids = app()->request('mail_ids');
|
|
@@ -520,15 +527,16 @@ class Home extends Base { |
|
@@ -520,15 +527,16 @@ class Home extends Base { |
520
|
$mailInstance = new Mail($emails[$eid]['email'],base64_decode($emails[$eid]['password']),$emails[$eid]['imap']);
|
527
|
$mailInstance = new Mail($emails[$eid]['email'],base64_decode($emails[$eid]['password']),$emails[$eid]['imap']);
|
521
|
|
528
|
|
522
|
if($mailInstance->login()){
|
529
|
if($mailInstance->login()){
|
|
|
530
|
+ $ret = $call($mailInstance,array_column($uid,'uid'),$folder['origin_folder'],$to_origin_folder['origin_folder']);
|
523
|
// TODO:: 这个过程无法保证原子性。没办法
|
531
|
// TODO:: 这个过程无法保证原子性。没办法
|
524
|
// 先复制
|
532
|
// 先复制
|
525
|
- $ret = $mailInstance->move(array_column($uid,'uid'),$folder['origin_folder'],$to_origin_folder['origin_folder']);
|
|
|
526
|
if($ret){
|
533
|
if($ret){
|
527
|
$uret = db()->update(listsSql::$table,['deleted'=>1],dbWhere(['id'=>array_column($uid,'id')]));
|
534
|
$uret = db()->update(listsSql::$table,['deleted'=>1],dbWhere(['id'=>array_column($uid,'id')]));
|
528
|
}
|
535
|
}
|
529
|
|
536
|
|
530
|
- $mailInstance = null;
|
537
|
+
|
531
|
}
|
538
|
}
|
|
|
539
|
+ $mailInstance = null;
|
532
|
|
540
|
|
533
|
}
|
541
|
}
|
534
|
$folder = null;
|
542
|
$folder = null;
|
|
@@ -547,6 +555,21 @@ class Home extends Base { |
|
@@ -547,6 +555,21 @@ class Home extends Base { |
547
|
}
|
555
|
}
|
548
|
|
556
|
|
549
|
|
557
|
|
|
|
558
|
+ /**
|
|
|
559
|
+ * 复制邮件
|
|
|
560
|
+ * @throws \Lib\Err
|
|
|
561
|
+ * @author:dc
|
|
|
562
|
+ * @time 2024/3/9 13:50
|
|
|
563
|
+ */
|
|
|
564
|
+ public function copy(){
|
|
|
565
|
+ $this->moveCopy(function (Mail $mailInstance,$uid,$origin_folder,$to_origin_folder){
|
|
|
566
|
+
|
|
|
567
|
+ return $mailInstance->copy($uid,$origin_folder,$to_origin_folder);
|
|
|
568
|
+
|
|
|
569
|
+ });
|
|
|
570
|
+ }
|
|
|
571
|
+
|
|
|
572
|
+
|
550
|
|
573
|
|
551
|
|
574
|
|
552
|
/**
|
575
|
/**
|