作者 邓超

全部标记 已读未读

@@ -546,6 +546,24 @@ class Home extends Base { @@ -546,6 +546,24 @@ class Home extends Base {
546 $emails = $this->getEmails(); 546 $emails = $this->getEmails();
547 547
548 $mail_ids = app()->request('mail_ids'); 548 $mail_ids = app()->request('mail_ids');
  549 +
  550 + // 全部标记
  551 + if(!$mail_ids){
  552 + $folder = app()->request('folder','收件箱');
  553 + // 查询 当前的 文件夹 如果有选中文件夹 就 查询出 选中文件夹的id
  554 + $fids = db()->all(folderSql::all(array_column($emails,'id'),'`id`,`folder`'));
  555 + foreach ($fids as $fk=>$fid){
  556 + if($fid['folder'] != $folder){
  557 + unset($fids[$fk]);
  558 + }
  559 + }
  560 + // 查询要标记的 邮件id
  561 + $mail_ids = db()->all(listsSql::all(dbWhere(['folder_id'=>array_column($fids,'id'),'seen'=>0]),'`id`'));
  562 +
  563 + $mail_ids = array_column($mail_ids,'id');
  564 + }
  565 +
  566 +
549 if(!($mail_ids && is_array($mail_ids))){ 567 if(!($mail_ids && is_array($mail_ids))){
550 app()->e('param_request_error'); 568 app()->e('param_request_error');
551 } 569 }
@@ -72,6 +72,18 @@ class listsSql { @@ -72,6 +72,18 @@ class listsSql {
72 */ 72 */
73 public static function first(string $where,$filed='*'):string { 73 public static function first(string $where,$filed='*'):string {
74 74
  75 + return "select {$filed} from `".self::$table."` where ".$where.' limit 1';
  76 + }
  77 +
  78 + /**
  79 + * 查询所有
  80 + * @param $where
  81 + * @param string $filed
  82 + * @return string
  83 + * @author:dc
  84 + * @time 2024/1/22 11:15
  85 + */
  86 + public static function all($where,$filed='*'){
75 return "select {$filed} from `".self::$table."` where ".$where; 87 return "select {$filed} from `".self::$table."` where ".$where;
76 } 88 }
77 89