作者 邓超

fob

... ... @@ -51,7 +51,7 @@ class MailList extends Base {
}
}
$where = ['email_id'=>$this->getEmails('id')];
$where = ['lists|email_id'=>$this->getEmails('id')];
// 目录
$folder = app()->request('folder','收件箱');
... ... @@ -72,7 +72,7 @@ class MailList extends Base {
$extSql = "f";
}
// 查询 文件夹
$folderList = db()->all(folderSql::all($where['email_id']));
$folderList = db()->all(folderSql::all($this->getEmails('id')));
$folder_id = [];
// 文件夹id
if($folderList){
... ... @@ -124,10 +124,10 @@ class MailList extends Base {
}
$filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`email_id`,`to_name`';
$filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`';
if($extSql){
$sql = "select %s from `lists` join left `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where `fob_hot_mail`.`folder` = '{$extSql}' and ".dbWhere($where);
$sql = "select %s from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where `fob_hot_mail`.`folder` = '{$extSql}' and ".dbWhere($where);
}else{
$sql = "select %s from `lists` where ".dbWhere($where);
}
... ...
... ... @@ -152,6 +152,7 @@ function dbWhere(array $where, string $ar = 'and'):string{
foreach ($where as $f=>$v){
list($f,$t) = explode('.',$f.'.');
$f = '`'.str_replace('|','`.`',$f).'`';
if(is_array($v)){
if($f ==='_'){
... ... @@ -166,21 +167,21 @@ function dbWhere(array $where, string $ar = 'and'):string{
},$v);
if(count($v)===1){
if($t=='notin'){
$sql[] = "`{$f}` != ".$v[0];
$sql[] = "{$f} != ".$v[0];
}else{
// 只有一个值时就是 =
$sql[] = "`{$f}` = ".$v[0];
$sql[] = "{$f} = ".$v[0];
}
}elseif (count($v) > 1){
$sql[] = "`{$f}` ".($t=='notin'?'not in':'in')." (".implode(',',$v).")";
$sql[] = "{$f} ".($t=='notin'?'not in':'in')." (".implode(',',$v).")";
}
}else{
if($f ==='_'){
$sql[] = $v;
}else{
$sql[] = "`{$f}` = '". (is_string($v) ? addslashes($v): $v) ."'";
$sql[] = "{$f} = '". (is_string($v) ? addslashes($v): $v) ."'";
}
}
... ...