作者 邓超

全部标记 已读未读

... ... @@ -546,6 +546,24 @@ class Home extends Base {
$emails = $this->getEmails();
$mail_ids = app()->request('mail_ids');
// 全部标记
if(!$mail_ids){
$folder = app()->request('folder','收件箱');
// 查询 当前的 文件夹 如果有选中文件夹 就 查询出 选中文件夹的id
$fids = db()->all(folderSql::all(array_column($emails,'id'),'`id`,`folder`'));
foreach ($fids as $fk=>$fid){
if($fid['folder'] != $folder){
unset($fids[$fk]);
}
}
// 查询要标记的 邮件id
$mail_ids = db()->all(listsSql::all(dbWhere(['folder_id'=>array_column($fids,'id'),'seen'=>0]),'`id`'));
$mail_ids = array_column($mail_ids,'id');
}
if(!($mail_ids && is_array($mail_ids))){
app()->e('param_request_error');
}
... ...
... ... @@ -72,6 +72,18 @@ class listsSql {
*/
public static function first(string $where,$filed='*'):string {
return "select {$filed} from `".self::$table."` where ".$where.' limit 1';
}
/**
* 查询所有
* @param $where
* @param string $filed
* @return string
* @author:dc
* @time 2024/1/22 11:15
*/
public static function all($where,$filed='*'){
return "select {$filed} from `".self::$table."` where ".$where;
}
... ...