作者 邓超

mailbody

@@ -486,6 +486,42 @@ class MailListV2Es2 extends Base { @@ -486,6 +486,42 @@ class MailListV2Es2 extends Base {
486 return $this->es->count($body); 486 return $this->es->count($body);
487 } 487 }
488 488
  489 +
  490 +
  491 +
  492 + /**
  493 + *
  494 + */
  495 + public function search(){
  496 + $postid = app()->request('postid',0);
  497 + $email = app()->request('email');
  498 + $udate = app()->request('udate');
  499 + if(!is_numeric($udate)){
  500 + $udate = strtotime($udate);
  501 + }
  502 + $query = [
  503 + "bool"=>[
  504 + "must"=>[
  505 + ["term"=>["postid"=>$postid]],
  506 + ["term"=>["source"=>2]],
  507 + ["term"=>["folder_as_int"=>1]],
  508 + ["match_phrase"=>["from.email"=>$email]],
  509 + ["range"=>["udate"=>['gte'=>$udate]]],
  510 + ]
  511 + ]
  512 + ];
  513 + $result = $this->es->search(
  514 + ['query'=>['constant_score'=>['filter'=>$query]]],
  515 + 0,10,
  516 + ['udate'=>"desc"],
  517 + 50
  518 + );
  519 + $hits = $result['hits']['hits']??[];
  520 + return $hits;
  521 + }
  522 +
  523 +
  524 +
489 } 525 }
490 526
491 527
@@ -85,6 +85,9 @@ return [ @@ -85,6 +85,9 @@ return [
85 // 解析 订阅url参数 数据 85 // 解析 订阅url参数 数据
86 'desubscribe' => [\Controller\Home::class, 'desubscribe'] 86 'desubscribe' => [\Controller\Home::class, 'desubscribe']
87 87
  88 + // fob流程服务用到的搜索
  89 + ,'fob/ai/search' => [\Controller\fob_ai\MailListV2Es2::class,'search']
  90 +
88 ]; 91 ];
89 92
90 93