作者 邓超

分区表兼容

... ... @@ -76,7 +76,7 @@ class HotMail {
private $folder = [];
private function run($id){
$list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id]),'`id`,`from`,`to`,`folder_id`,`is_hots`'));
$list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id,'is_hots'=>0]),'`id`,`from`,`to`,`folder_id`,`is_hots`'));
foreach ($list as $item){
if(empty($this->folder[$item['folder_id']])){
$this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder')));
... ...
... ... @@ -22,6 +22,13 @@ class MailListV2 extends Base {
private $cache = 600;
private function getTable(){
if(app()->request('table')=='lists2'){
return 'lists_2';
}
return 'lists';
}
/**
* 当前邮箱下指定的文件夹
* @param string $folder
... ... @@ -172,14 +179,14 @@ class MailListV2 extends Base {
// 软删
$where['deleted'] = 0;
$filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`';
$filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`'.$this->getTable().'`.`email_id`,`to_name`';
$sql = "select %s from `lists` where ".dbWhere($where);
$sql = "select %s from `".$this->getTable()."` where ".dbWhere($where);
/************ 2024-09-02 *************/
if($folder=='收件箱' && empty($where['flagged']) && !$ids) {
$sql = "select %s from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where ".dbWhere($where);
$sql = "select %s from `".$this->getTable()."` left join `lists_auto` on `".$this->getTable()."`.`id`= `lists_auto`.`list_id` where ".dbWhere($where);
if(!empty($is_auto_inbox)){
$sql.= ' and `lists_auto`.`list_id` IS NOT NULL';
}else{
... ... @@ -354,7 +361,7 @@ class MailListV2 extends Base {
// show_count_filed
$show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']);
$sql = "select count(*) from `lists` where ";
$sql = "select count(*) from `".$this->getTable()."` where ";
$where['deleted'] = 0; //未删状态
... ... @@ -389,7 +396,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 ".$this->assignSql('收件箱');
$sql = "select count(*) from `".$this->getTable()."` left join `lists_auto` on `".$this->getTable()."`.`id`= `lists_auto`.`list_id` where `lists_auto`.`list_id` IS NULL and ".$this->assignSql('收件箱');
// 模糊标题搜索
$subject = app()->request('subject');
... ... @@ -442,7 +449,7 @@ class MailListV2 extends Base {
unset($where['folder_id']);
// $where['email_id'] = $emails;
unset($where['is_hots']);
$flaggedCount = db()->cache($this->cache)->count("SELECT COUNT(*) FROM (select `id` from `lists` where " . $this->assignSql2().dbWhere($where).' group by `udate`) as c');
$flaggedCount = db()->cache($this->cache)->count("SELECT COUNT(*) FROM (select `id` from `".$this->getTable()."` where " . $this->assignSql2().dbWhere($where).' group by `udate`) as c');
}
$data = [];
... ...