作者 邓超

x

... ... @@ -194,29 +194,39 @@ class MailListV2 extends Base {
/************ 2024-09-02 *************/
if($folder=='收件箱' && empty($where['flagged'])) {
// 模糊标题搜索
$subject = app()->request('subject');
if ($subject) {
$subject = is_array($subject) ? $subject : [$subject];
foreach ($subject as $k => $sub) {
$subject[$k] = '`subject` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
$sql = "select %s from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where ".dbWhere($where);
if(!empty($is_auto_inbox)){
$sql.= ' and `lists_auto`.`list_id` IS NOT NULL';
}else{
$sql.= ' and `lists_auto`.`list_id` IS NULL';
// 模糊标题搜索
$subject = app()->request('subject');
if ($subject) {
$subject = is_array($subject) ? $subject : [$subject];
foreach ($subject as $k => $sub) {
$subject[$k] = '`subject` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
}
}
}
// 不在此邮箱中的
$from_not_in_like = app()->request('from_not_in_like');
if ($from_not_in_like) {
$from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
foreach ($from_not_in_like as $k => $sub) {
$from_not_in_like[$k] = '`from` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
// 不在此邮箱中的
$from_not_in_like = app()->request('from_not_in_like');
if ($from_not_in_like) {
$from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like];
foreach ($from_not_in_like as $k => $sub) {
$from_not_in_like[$k] = '`from` ' . (empty($is_auto_inbox) ? ' not ' : '') . 'like "' . $this->getLikeStr($sub) . '"';
}
}
if ($subject || $from_not_in_like) {
$sql .= ' and (';
if ($subject) $sql .= implode(empty($is_auto_inbox) ? ' and ' : ' or ', $subject);
if ($from_not_in_like) $sql .= ' and (' . implode(empty($is_auto_inbox) ? ' and ' : ' or ', $from_not_in_like) . ')';
$sql .= ')';
}
}
if ($subject || $from_not_in_like) {
$sql .= ' and (';
if ($subject) $sql .= implode(empty($is_auto_inbox) ? ' and ' : ' or ', $subject);
if ($from_not_in_like) $sql .= ' and (' . implode(empty($is_auto_inbox) ? ' and ' : ' or ', $from_not_in_like) . ')';
$sql .= ')';
}
}
/************ 2024-09-02 *************/
... ... @@ -301,6 +311,7 @@ class MailListV2 extends Base {
// 收件箱
$where['folder_id'] = $this->getFolderId('收件箱');
$where['is_hots'] = 0;
$sql = "select count(*) from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where `lists_auto`.`list_id` IS NULL and ";
// 模糊标题搜索
$subject = app()->request('subject');
... ... @@ -336,6 +347,10 @@ class MailListV2 extends Base {
$seenCount = db()->cache($this->cache)->count($sql . dbWhere($where));
unset($where['seen']);
}
// 星标
if(in_array('flagged',$show_count_filed)) {
$where['flagged'] = 1;
... ...