|
@@ -339,73 +339,7 @@ class MailListV2Es extends Base { |
|
@@ -339,73 +339,7 @@ class MailListV2Es extends Base { |
339
|
return ['terms'=>['folder_id'=> $this->getFolderId($folder)]];
|
339
|
return ['terms'=>['folder_id'=> $this->getFolderId($folder)]];
|
340
|
|
340
|
|
341
|
}
|
341
|
}
|
342
|
- private function assignSql2(){
|
|
|
343
|
- // 被分配的
|
|
|
344
|
- $assign = app()->request('assign');
|
|
|
345
|
- $sql = '';
|
|
|
346
|
- $query = [];
|
|
|
347
|
- if(!empty($assign['email_id'])){
|
|
|
348
|
- // 分配的联系人
|
|
|
349
|
- $email = array_values(array_intersect($assign['email_id'],$this->getEmails('id')));
|
|
|
350
|
- if($email&&!empty($assign['from'])){
|
|
|
351
|
- $query['must'] = [
|
|
|
352
|
- ['terms'=>['email_id'=>$email]]
|
|
|
353
|
- ];
|
|
|
354
|
- $query['must'][] = [
|
|
|
355
|
- 'query'=>[
|
|
|
356
|
- 'bool'=>[
|
|
|
357
|
- 'must'=>[
|
|
|
358
|
- ['terms'=>['from.email'=>$assign['from']]]
|
|
|
359
|
- ],
|
|
|
360
|
- 'should'=>[
|
|
|
361
|
- "query_string" =>[
|
|
|
362
|
- "query" => implode(' ',$assign['from']),
|
|
|
363
|
- 'default_field' => 'to'
|
|
|
364
|
- ]
|
|
|
365
|
- ]
|
|
|
366
|
- ]
|
|
|
367
|
- ]
|
|
|
368
|
- ];
|
|
|
369
|
- }
|
|
|
370
|
|
342
|
|
371
|
- // 分配的邮箱
|
|
|
372
|
- $email2 = array_diff($this->getEmails('id'),$assign['email_id']);
|
|
|
373
|
- if($email2){
|
|
|
374
|
- if($query){
|
|
|
375
|
- $query['must'][] = [
|
|
|
376
|
- 'query'=>[
|
|
|
377
|
- 'bool'=>[
|
|
|
378
|
- 'must'=>[
|
|
|
379
|
- $query
|
|
|
380
|
- ],
|
|
|
381
|
- 'should'=>[
|
|
|
382
|
- ['terms'=>['email_id'=>$email2]]
|
|
|
383
|
- ]
|
|
|
384
|
- ]
|
|
|
385
|
- ]
|
|
|
386
|
- ];
|
|
|
387
|
- return ['query'=>[
|
|
|
388
|
- 'bool'=> $query
|
|
|
389
|
- ]];
|
|
|
390
|
- }
|
|
|
391
|
-
|
|
|
392
|
- return ['terms'=>['email_id'=>$email2]];
|
|
|
393
|
- }
|
|
|
394
|
-
|
|
|
395
|
- if($sql){
|
|
|
396
|
- return ['query'=>[
|
|
|
397
|
- 'bool'=> $query
|
|
|
398
|
- ]];
|
|
|
399
|
- }
|
|
|
400
|
-
|
|
|
401
|
-
|
|
|
402
|
- return ['term'=>['email_id'=>-1]];
|
|
|
403
|
- }
|
|
|
404
|
-
|
|
|
405
|
- // 默认
|
|
|
406
|
- return ['terms'=>['email_id'=> $this->getEmails('id')]];
|
|
|
407
|
-
|
|
|
408
|
- }
|
|
|
409
|
|
343
|
|
410
|
private function assignSql3($folder){
|
344
|
private function assignSql3($folder){
|
411
|
// 被分配的
|
345
|
// 被分配的
|