作者 邓超

统计

... ... @@ -581,6 +581,41 @@ class MailListV2Es2 extends Base {
return $hits;
}
/**
* 统计模板的回复数量
* @author:dc
* @time 2025/12/19 16:56
*/
public function aiTempReplyCount(){
$postid = app()->request('postid',0);
if(!$postid){
return [];
}
$subjects = app()->request('subjects');
$query = [
"bool"=>[
"must"=>[
["term"=>["postid"=>$postid]],
["term"=>["source"=>2]],
["term"=>["folder_as_int"=>1]],
[
'query_string' => [
'query'=> implode(" ",array_map(function ($v){
return '"'.addcslashes($v,'"').'"';
},$subjects)),
"default_field"=> "subject"
]
]
]
]
];
$count = $this->es->count(['query'=>$query]);
return [
'count' => $count
];
}
}
... ...
... ... @@ -93,6 +93,8 @@ return [
// fob流程服务用到的搜索
,'fob/ai/search' => [\Controller\fob_ai\MailListV2Es2::class,'search']
// 统计模板的回复数量
,'ai-temp-reply-count' => [\Controller\fob_ai\MailListV2Es2::class,'aiTempReplyCount']
// 附件预览
... ...