作者 邓超

x

@@ -194,29 +194,39 @@ class MailListV2 extends Base { @@ -194,29 +194,39 @@ class MailListV2 extends Base {
194 194
195 /************ 2024-09-02 *************/ 195 /************ 2024-09-02 *************/
196 if($folder=='收件箱' && empty($where['flagged'])) { 196 if($folder=='收件箱' && empty($where['flagged'])) {
197 - // 模糊标题搜索  
198 - $subject = app()->request('subject');  
199 - if ($subject) {  
200 - $subject = is_array($subject) ? $subject : [$subject];  
201 - foreach ($subject as $k => $sub) {  
202 - $subject[$k] = '`subject` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"'; 197 +
  198 + $sql = "select %s from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where ".dbWhere($where);
  199 + if(!empty($is_auto_inbox)){
  200 + $sql.= ' and `lists_auto`.`list_id` IS NOT NULL';
  201 + }else{
  202 + $sql.= ' and `lists_auto`.`list_id` IS NULL';
  203 +
  204 + // 模糊标题搜索
  205 + $subject = app()->request('subject');
  206 + if ($subject) {
  207 + $subject = is_array($subject) ? $subject : [$subject];
  208 + foreach ($subject as $k => $sub) {
  209 + $subject[$k] = '`subject` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
  210 + }
203 } 211 }
204 - }  
205 - // 不在此邮箱中的  
206 - $from_not_in_like = app()->request('from_not_in_like');  
207 - if ($from_not_in_like) {  
208 - $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];  
209 - foreach ($from_not_in_like as $k => $sub) {  
210 - $from_not_in_like[$k] = '`from` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"'; 212 + // 不在此邮箱中的
  213 + $from_not_in_like = app()->request('from_not_in_like');
  214 + if ($from_not_in_like) {
  215 + $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
  216 + foreach ($from_not_in_like as $k => $sub) {
  217 + $from_not_in_like[$k] = '`from` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
  218 + }
  219 + }
  220 +
  221 + if ($subject || $from_not_in_like) {
  222 + $sql .= ' and (';
  223 + if ($subject) $sql .= implode(empty($is_auto_inbox) ? ' and ' : ' or ', $subject);
  224 + if ($from_not_in_like) $sql .= ' and (' . implode(empty($is_auto_inbox) ? ' and ' : ' or ', $from_not_in_like) . ')';
  225 + $sql .= ')';
211 } 226 }
212 - }  
213 227
214 - if ($subject || $from_not_in_like) {  
215 - $sql .= ' and (';  
216 - if ($subject) $sql .= implode(empty($is_auto_inbox) ? ' and ' : ' or ', $subject);  
217 - if ($from_not_in_like) $sql .= ' and (' . implode(empty($is_auto_inbox) ? ' and ' : ' or ', $from_not_in_like) . ')';  
218 - $sql .= ')';  
219 } 228 }
  229 +
220 } 230 }
221 231
222 /************ 2024-09-02 *************/ 232 /************ 2024-09-02 *************/
@@ -301,6 +311,7 @@ class MailListV2 extends Base { @@ -301,6 +311,7 @@ class MailListV2 extends Base {
301 // 收件箱 311 // 收件箱
302 $where['folder_id'] = $this->getFolderId('收件箱'); 312 $where['folder_id'] = $this->getFolderId('收件箱');
303 $where['is_hots'] = 0; 313 $where['is_hots'] = 0;
  314 + $sql = "select count(*) from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where `lists_auto`.`list_id` IS NULL and ";
304 315
305 // 模糊标题搜索 316 // 模糊标题搜索
306 $subject = app()->request('subject'); 317 $subject = app()->request('subject');
@@ -336,6 +347,10 @@ class MailListV2 extends Base { @@ -336,6 +347,10 @@ class MailListV2 extends Base {
336 $seenCount = db()->cache($this->cache)->count($sql . dbWhere($where)); 347 $seenCount = db()->cache($this->cache)->count($sql . dbWhere($where));
337 unset($where['seen']); 348 unset($where['seen']);
338 } 349 }
  350 +
  351 +
  352 +
  353 +
339 // 星标 354 // 星标
340 if(in_array('flagged',$show_count_filed)) { 355 if(in_array('flagged',$show_count_filed)) {
341 $where['flagged'] = 1; 356 $where['flagged'] = 1;