作者 邓超

fob

@@ -46,6 +46,33 @@ class MailList extends Base { @@ -46,6 +46,33 @@ class MailList extends Base {
46 } 46 }
47 47
48 48
  49 + private function from_not_in(){
  50 + $where['from.notin'] = [];
  51 + /**
  52 + * 不查询哪些发件人的邮件
  53 + */
  54 + $form_not_in = app()->request('from_not_in');
  55 + if($form_not_in){
  56 + $form_not_in = is_array($form_not_in) ? $form_not_in : [$form_not_in];
  57 + $form_not_in = array_filter($form_not_in,function ($v){
  58 + if(is_string($v) && Verify::sEmail($v)){
  59 + return true;
  60 + }
  61 + return false;
  62 + });
  63 + if($form_not_in){
  64 + if(isset($where['from.notin'])){
  65 + $where['from.notin'] = array_merge($where['from.notin'],$form_not_in);
  66 + }else{
  67 + $where['from.notin'] = $form_not_in;
  68 + }
  69 +
  70 + }
  71 + }
  72 +
  73 + return $where['from.notin'];
  74 + }
  75 +
49 /** 76 /**
50 * 邮件列表 77 * 邮件列表
51 * 接收参数 78 * 接收参数
@@ -113,31 +140,8 @@ class MailList extends Base { @@ -113,31 +140,8 @@ class MailList extends Base {
113 // 软删 140 // 软删
114 $where['deleted'] = 0; 141 $where['deleted'] = 0;
115 142
116 - /**  
117 - * 不查询哪些发件人的邮件  
118 - */  
119 - $form_not_in = app()->request('from_not_in');  
120 - if($form_not_in){  
121 - $form_not_in = is_array($form_not_in) ? $form_not_in : [$form_not_in];  
122 - $form_not_in = array_filter($form_not_in,function ($v){  
123 - if(is_string($v) && Verify::sEmail($v)){  
124 - return true;  
125 - }  
126 - return false;  
127 - });  
128 - if($form_not_in){  
129 - if(isset($where['from.notin'])){  
130 - $where['from.notin'] = array_merge($where['from.notin'],$form_not_in);  
131 - }else{  
132 - $where['from.notin'] = $form_not_in;  
133 - }  
134 -  
135 - }  
136 - }  
137 - if(!empty($where['from.notin'])){  
138 - $where['from.notin'] = array_unique($where['from.notin']);  
139 - }  
140 - 143 + $where['from.notin'] = $this->from_not_in();
  144 + if(!$where['from.notin']) unset($where['from.notin']);
141 145
142 $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`'; 146 $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`';
143 147
@@ -202,6 +206,9 @@ class MailList extends Base { @@ -202,6 +206,9 @@ class MailList extends Base {
202 $fCount = db()->count($sql.dbWhere($where)); 206 $fCount = db()->count($sql.dbWhere($where));
203 207
204 208
  209 + // 屏蔽哪些邮件
  210 + $where['from.notin'] = $this->from_not_in();
  211 + if(!$where['from.notin']) unset($where['from.notin']);
205 212
206 $where = ['lists|email_id'=>$emails]; 213 $where = ['lists|email_id'=>$emails];
207 $where['folder_id'] = $this->getFolderId('发件箱'); 214 $where['folder_id'] = $this->getFolderId('发件箱');