作者 邓超

x

@@ -176,25 +176,23 @@ class MailListV2 extends Base { @@ -176,25 +176,23 @@ class MailListV2 extends Base {
176 // 模糊标题搜索 176 // 模糊标题搜索
177 $subject = app()->request('subject'); 177 $subject = app()->request('subject');
178 if($subject){ 178 if($subject){
179 - $sql.=' and (';  
180 $subject = is_array($subject) ? $subject : [$subject]; 179 $subject = is_array($subject) ? $subject : [$subject];
181 - foreach ($subject as $sub){  
182 - $sql.=' `subject` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%" or '; 180 + foreach ($subject as $k=>$sub){
  181 + $subject[$k] = '`subject` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%"';
183 } 182 }
184 - $sql = rtrim($sql,'or ');  
185 - $sql.=')';  
186 } 183 }
187 // 不在此邮箱中的 184 // 不在此邮箱中的
188 $from_not_in_like = app()->request('from_not_in_like'); 185 $from_not_in_like = app()->request('from_not_in_like');
189 if($from_not_in_like){ 186 if($from_not_in_like){
190 - $sql.=' and (';  
191 $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like]; 187 $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
192 - foreach ($from_not_in_like as $sub){  
193 - $sql.='`from` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%" or '; 188 + foreach ($from_not_in_like as $k=>$sub){
  189 + $from_not_in_like[$k] = '`from` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%"';
194 } 190 }
195 - $sql = rtrim($sql,'or ');  
196 - $sql.=')';  
197 } 191 }
  192 +
  193 + $sql .= ' and ('. implode(' or ',$subject).' or '. implode(' or ',$from_not_in_like) .')';
  194 +
  195 +
198 /************ 2024-09-02 *************/ 196 /************ 2024-09-02 *************/
199 197
200 // 查询列表数据 198 // 查询列表数据