...
|
...
|
@@ -42,19 +42,35 @@ class Home extends Base { |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 邮件文件夹的id
|
|
|
$folder_id = (int) app()->request('folder_id');
|
|
|
// 附件
|
|
|
$attachment = app()->request('attachment');
|
|
|
// 已读/未读
|
|
|
$seen = app()->request('seen',-1,'intval');
|
|
|
// 软删
|
|
|
$deleted = app()->request('deleted',0,'intval');
|
|
|
|
|
|
|
|
|
$where = ['email_id'=>$this->getEmails('id')];
|
|
|
|
|
|
// 目录
|
|
|
$folder = app()->request('folder','INBOX');
|
|
|
$folderList = db()->all(folderSql::all($where['email_id']));
|
|
|
$folder_id = [];
|
|
|
// 文件夹id
|
|
|
if($folderList){
|
|
|
foreach ($folderList as $item){
|
|
|
if($item['folder'] == $folder){
|
|
|
$folder_id[] = $item['id'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//目录
|
|
|
if($folder_id) $where['folder_id'] = $folder_id;
|
|
|
if($ids) $where['id'] = $ids;
|
|
|
if($attachment) $where['is_file'] = 1; //附件
|
|
|
// 软删
|
|
|
$where['deleted'] = $deleted;
|
|
|
// 已读/未读
|
|
|
if(in_array($seen,[0,1])){
|
|
|
$where['seen'] = $seen;
|
...
|
...
|
@@ -164,6 +180,24 @@ class Home extends Base { |
|
|
* @time 2023/3/17 16:15
|
|
|
*/
|
|
|
public function seen_2_unseen(){
|
|
|
$this->setFlags('seen');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 邮件回收站,进行回收,恢复邮件
|
|
|
* @author:dc
|
|
|
* @time 2023/3/21 11:41
|
|
|
*/
|
|
|
public function recycle(){
|
|
|
$this->setFlags('deleted');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function setFlags($d){
|
|
|
$emails = $this->getEmails();
|
|
|
|
|
|
$mail_ids = app()->request('mail_ids');
|
...
|
...
|
@@ -173,8 +207,8 @@ class Home extends Base { |
|
|
}
|
|
|
}
|
|
|
// 已读或未读
|
|
|
$seen = (int) app()->request('seen');
|
|
|
$seen = $seen ? 1 : 0;
|
|
|
$fv = (int) app()->request($d);
|
|
|
$fv = $fv ? 1 : 0;
|
|
|
|
|
|
$data = db()->all(listsSql::first(dbWhere(['id'=>$mail_ids,'email_id'=>array_column($emails,'id')])));
|
|
|
if($data){
|
...
|
...
|
@@ -200,12 +234,23 @@ class Home extends Base { |
|
|
$mailInstance = new Mail($emails[$eid]['email'],base64_decode($emails[$eid]['password']),$emails[$eid]['imap']);
|
|
|
|
|
|
if($mailInstance->login()){
|
|
|
$mailInstance->seen(array_column($uid,'uid'),$folder['origin_folder'],$seen);
|
|
|
switch ($d){
|
|
|
// 已读 未读
|
|
|
case 'seen':{
|
|
|
$mailInstance->seen(array_column($uid,'uid'),$folder['origin_folder'],$fv);
|
|
|
break;
|
|
|
}
|
|
|
// 回收站,已删 未删,软删
|
|
|
case 'deleted':{
|
|
|
$mailInstance->recycle(array_column($uid,'uid'),$folder['origin_folder'],$fv);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$mailInstance = null;
|
|
|
// 更新数据
|
|
|
db()->update(listsSql::$table,[
|
|
|
'seen' => $seen
|
|
|
$d => $fv
|
|
|
],dbWhere([
|
|
|
'id' => array_column($uid,'id')
|
|
|
]));
|
...
|
...
|
@@ -223,7 +268,6 @@ class Home extends Base { |
|
|
'mail_id' => $mail_ids
|
|
|
]);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|