作者 邓超

统计

@@ -597,21 +597,23 @@ class MailListV2Es2 extends Base { @@ -597,21 +597,23 @@ class MailListV2Es2 extends Base {
597 "bool"=>[ 597 "bool"=>[
598 "must"=>[ 598 "must"=>[
599 ["term"=>["postid"=>$postid]], 599 ["term"=>["postid"=>$postid]],
600 - ["term"=>["source"=>2]],  
601 - ["term"=>["folder_as_int"=>1]],  
602 - [  
603 - 'query_string' => [  
604 - 'query'=> implode(" ",array_map(function ($v){  
605 - return '"'.addcslashes($v,'"').'"';  
606 - },$subjects)),  
607 - "default_field"=> "subject"  
608 - ]  
609 - ] 600 + ["term"=>["source"=>2]], // ai邮件
  601 + ["term"=>["folder_as_int"=>1]], // 收件箱
  602 + ["term"=>["deleted"=>0]], // 非删除
  603 + ["term"=>["is_hots"=>0]], // 不是预热
  604 + ["term"=>["is_auto"=>0]], // 非自动回复
610 ] 605 ]
611 ] 606 ]
612 ]; 607 ];
613 - $count = $this->es->count(['query'=>$query]);  
614 - 608 + $lists = $this->es->search(['query'=>$query,"_source" => ["subject"]],0,5000);
  609 + $count = 0;
  610 + foreach ($lists['hits']['hits']??[] as $item){
  611 + foreach ($subjects as $subject){
  612 + if(str_ends_with($item['_source']['subject'],$subject)){
  613 + $count++;
  614 + }
  615 + }
  616 + }
615 return [ 617 return [
616 'count' => $count 618 'count' => $count
617 ]; 619 ];