作者 邓超

es

... ... @@ -218,9 +218,25 @@ class MailListV2Es extends Base {
$query['bool']['must'][] = $this->assignSql('收件箱');
}
logs('请求es前');
if($folder=='收件箱'&&empty($is_auto_inbox)){
$from_not_in_like = app()->request('from_not_in_like');
if ($from_not_in_like) {
$from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
$notinquery = [];
foreach ($from_not_in_like as $k => $sub) {
if($sub){
$notinquery[] = ['match'=>['from.email'=>$sub]];
}
}
if($notinquery){
$query['bool']['must_not'] = $notinquery;
}
}
}
$result = $this->es->search(['query'=>$query],($page-1) * $limit,$limit,['udate'=>"desc"]);
logs('请求es后');
$total = $result['hits']['total']['value']??0;
$lists = $result['hits']['hits']??[];
... ... @@ -441,12 +457,10 @@ class MailListV2Es extends Base {
},$udate);
// 时间范围搜索
$body['query']['bool']['must'][] = [
'query' => [
'range' => [
'udate' => [
'gte' => $udate[0], // 大于等于开始日期
'lte' => $udate[1] // 小于等于结束日期
]
'range' => [
'udate' => [
'gte' => $udate[0], // 大于等于开始日期
'lte' => $udate[1] // 小于等于结束日期
]
]
];
... ... @@ -522,6 +536,23 @@ class MailListV2Es extends Base {
private function countMail($body,$folder,$seen=null){
if($folder == '收件箱'){
$body['query']['bool']['must'][] = ['term'=>['is_auto'=>0]];
$from_not_in_like = app()->request('from_not_in_like');
if ($from_not_in_like) {
$from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
$notinquery = [];
foreach ($from_not_in_like as $k => $sub) {
if($sub){
$notinquery[] = ['match'=>['from.email'=>$sub]];
}
}
if($notinquery){
$body['query']['bool']['must_not'] = $notinquery;
}
}
}
if($seen!==null){
$body['query']['bool']['must'][] = ['term'=>['seen'=>$seen]];
... ...