|
...
|
...
|
@@ -44,6 +44,7 @@ class MailListV2Es2 extends Base { |
|
|
|
* emails 邮箱
|
|
|
|
* folder 文件夹
|
|
|
|
* from_not_in 不在这些发件箱的邮件
|
|
|
|
* not_in_email_id 不在这些邮箱id的邮件(数组)
|
|
|
|
* @throws \Lib\Err
|
|
|
|
* @author:dc
|
|
|
|
* @time 2024/7/18 11:40
|
|
...
|
...
|
@@ -205,11 +206,16 @@ class MailListV2Es2 extends Base { |
|
|
|
}
|
|
|
|
}
|
|
|
|
if($notinquery){
|
|
|
|
$query['bool']['must_not'] = $notinquery;
|
|
|
|
$query['bool']['must_not'] = array_merge($query['bool']['must_not'] ?? [], $notinquery);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 排除指定邮箱id的邮件(数组,全部文件夹生效)
|
|
|
|
if($notInEmailId = $this->notInEmailIdQuery()){
|
|
|
|
$query['bool']['must_not'] = array_merge($query['bool']['must_not'] ?? [], $notInEmailId);
|
|
|
|
}
|
|
|
|
|
|
|
|
// logs('lists '.json_encode(['query'=>['constant_score'=>['filter'=>$query]]]));
|
|
|
|
$result = $this->es->search(['query'=>['constant_score'=>['filter'=>$query]]],($page-1) * $limit,$limit,['udate'=>"desc"],(($where['is_hots']??0)==1||($where['is_auto']??0)==1||$folder=='垃圾箱')?10000:true);
|
|
|
|
|
|
...
|
...
|
@@ -303,6 +309,27 @@ class MailListV2Es2 extends Base { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 排除指定邮箱id的条件(not_in_email_id,数组或逗号分隔)
|
|
|
|
* @return array
|
|
|
|
* @author:dc
|
|
|
|
*/
|
|
|
|
private function notInEmailIdQuery(){
|
|
|
|
$not_in_email_id = app()->requestArr('assign')['not_in_email_id']??[];
|
|
|
|
if(!$not_in_email_id) return [];
|
|
|
|
if(!is_array($not_in_email_id)) $not_in_email_id = [$not_in_email_id];
|
|
|
|
$ids = [];
|
|
|
|
foreach ($not_in_email_id as $v){
|
|
|
|
if(is_numeric($v)) $ids[] = intval($v);
|
|
|
|
}
|
|
|
|
if(!$ids) return [];
|
|
|
|
|
|
|
|
return [
|
|
|
|
['terms'=>['email_id'=>array_values(array_unique($ids))]]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function assignSql($folder){
|
|
|
|
// 被分配的
|
|
|
|
$assign = app()->requestArr('assign');
|
|
...
|
...
|
@@ -372,6 +399,12 @@ class MailListV2Es2 extends Base { |
|
|
|
]
|
|
|
|
];
|
|
|
|
if(count($this->getEmails('id')) == 1) $body['query']['bool']['must'][] = ['terms'=>['email_id'=>$this->getEmails('id')]];
|
|
|
|
|
|
|
|
// 排除指定邮箱id的邮件(计数也要同步排除)
|
|
|
|
if($notInEmailId = $this->notInEmailIdQuery()){
|
|
|
|
$body['query']['bool']['must_not'] = array_merge($body['query']['bool']['must_not'] ?? [], $notInEmailId);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 时间 必须是数组
|
|
|
|
$udate = app()->request('udate');
|
|
|
|
if($udate && is_array($udate) && count($udate) == 2){
|
|
...
|
...
|
@@ -483,7 +516,7 @@ class MailListV2Es2 extends Base { |
|
|
|
}
|
|
|
|
}
|
|
|
|
if($notinquery){
|
|
|
|
$body['query']['bool']['must_not'] = $notinquery;
|
|
|
|
$body['query']['bool']['must_not'] = array_merge($body['query']['bool']['must_not'] ?? [], $notinquery);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|