作者 邓超

统计

@@ -581,6 +581,41 @@ class MailListV2Es2 extends Base { @@ -581,6 +581,41 @@ class MailListV2Es2 extends Base {
581 return $hits; 581 return $hits;
582 } 582 }
583 583
  584 + /**
  585 + * 统计模板的回复数量
  586 + * @author:dc
  587 + * @time 2025/12/19 16:56
  588 + */
  589 + public function aiTempReplyCount(){
  590 + $postid = app()->request('postid',0);
  591 + if(!$postid){
  592 + return [];
  593 + }
  594 + $subjects = app()->request('subjects');
  595 +
  596 + $query = [
  597 + "bool"=>[
  598 + "must"=>[
  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 + ]
  610 + ]
  611 + ]
  612 + ];
  613 + $count = $this->es->count(['query'=>$query]);
  614 +
  615 + return [
  616 + 'count' => $count
  617 + ];
  618 + }
584 619
585 620
586 } 621 }
@@ -93,6 +93,8 @@ return [ @@ -93,6 +93,8 @@ return [
93 93
94 // fob流程服务用到的搜索 94 // fob流程服务用到的搜索
95 ,'fob/ai/search' => [\Controller\fob_ai\MailListV2Es2::class,'search'] 95 ,'fob/ai/search' => [\Controller\fob_ai\MailListV2Es2::class,'search']
  96 + // 统计模板的回复数量
  97 + ,'ai-temp-reply-count' => [\Controller\fob_ai\MailListV2Es2::class,'aiTempReplyCount']
96 98
97 99
98 // 附件预览 100 // 附件预览