作者 邓超

分区表兼容

@@ -76,7 +76,7 @@ class HotMail { @@ -76,7 +76,7 @@ class HotMail {
76 private $folder = []; 76 private $folder = [];
77 77
78 private function run($id){ 78 private function run($id){
79 - $list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id]),'`id`,`from`,`to`,`folder_id`,`is_hots`')); 79 + $list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id,'is_hots'=>0]),'`id`,`from`,`to`,`folder_id`,`is_hots`'));
80 foreach ($list as $item){ 80 foreach ($list as $item){
81 if(empty($this->folder[$item['folder_id']])){ 81 if(empty($this->folder[$item['folder_id']])){
82 $this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder'))); 82 $this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder')));
@@ -22,6 +22,13 @@ class MailListV2 extends Base { @@ -22,6 +22,13 @@ class MailListV2 extends Base {
22 22
23 private $cache = 600; 23 private $cache = 600;
24 24
  25 + private function getTable(){
  26 + if(app()->request('table')=='lists2'){
  27 + return 'lists_2';
  28 + }
  29 + return 'lists';
  30 + }
  31 +
25 /** 32 /**
26 * 当前邮箱下指定的文件夹 33 * 当前邮箱下指定的文件夹
27 * @param string $folder 34 * @param string $folder
@@ -172,14 +179,14 @@ class MailListV2 extends Base { @@ -172,14 +179,14 @@ class MailListV2 extends Base {
172 // 软删 179 // 软删
173 $where['deleted'] = 0; 180 $where['deleted'] = 0;
174 181
175 - $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`'; 182 + $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`'.$this->getTable().'`.`email_id`,`to_name`';
176 183
177 - $sql = "select %s from `lists` where ".dbWhere($where); 184 + $sql = "select %s from `".$this->getTable()."` where ".dbWhere($where);
178 185
179 /************ 2024-09-02 *************/ 186 /************ 2024-09-02 *************/
180 if($folder=='收件箱' && empty($where['flagged']) && !$ids) { 187 if($folder=='收件箱' && empty($where['flagged']) && !$ids) {
181 188
182 - $sql = "select %s from `lists` left join `lists_auto` on `lists`.`id`= `lists_auto`.`list_id` where ".dbWhere($where); 189 + $sql = "select %s from `".$this->getTable()."` left join `lists_auto` on `".$this->getTable()."`.`id`= `lists_auto`.`list_id` where ".dbWhere($where);
183 if(!empty($is_auto_inbox)){ 190 if(!empty($is_auto_inbox)){
184 $sql.= ' and `lists_auto`.`list_id` IS NOT NULL'; 191 $sql.= ' and `lists_auto`.`list_id` IS NOT NULL';
185 }else{ 192 }else{
@@ -354,7 +361,7 @@ class MailListV2 extends Base { @@ -354,7 +361,7 @@ class MailListV2 extends Base {
354 // show_count_filed 361 // show_count_filed
355 $show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']); 362 $show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']);
356 363
357 - $sql = "select count(*) from `lists` where "; 364 + $sql = "select count(*) from `".$this->getTable()."` where ";
358 365
359 $where['deleted'] = 0; //未删状态 366 $where['deleted'] = 0; //未删状态
360 367
@@ -389,7 +396,7 @@ class MailListV2 extends Base { @@ -389,7 +396,7 @@ class MailListV2 extends Base {
389 // 收件箱 396 // 收件箱
390 // $where['folder_id'] = $this->getFolderId('收件箱'); 397 // $where['folder_id'] = $this->getFolderId('收件箱');
391 $where['is_hots'] = 0; 398 $where['is_hots'] = 0;
392 - $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('收件箱'); 399 + $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('收件箱');
393 400
394 // 模糊标题搜索 401 // 模糊标题搜索
395 $subject = app()->request('subject'); 402 $subject = app()->request('subject');
@@ -442,7 +449,7 @@ class MailListV2 extends Base { @@ -442,7 +449,7 @@ class MailListV2 extends Base {
442 unset($where['folder_id']); 449 unset($where['folder_id']);
443 // $where['email_id'] = $emails; 450 // $where['email_id'] = $emails;
444 unset($where['is_hots']); 451 unset($where['is_hots']);
445 - $flaggedCount = db()->cache($this->cache)->count("SELECT COUNT(*) FROM (select `id` from `lists` where " . $this->assignSql2().dbWhere($where).' group by `udate`) as c'); 452 + $flaggedCount = db()->cache($this->cache)->count("SELECT COUNT(*) FROM (select `id` from `".$this->getTable()."` where " . $this->assignSql2().dbWhere($where).' group by `udate`) as c');
446 } 453 }
447 454
448 $data = []; 455 $data = [];