作者 邓超

fob

@@ -51,7 +51,7 @@ class MailList extends Base { @@ -51,7 +51,7 @@ class MailList extends Base {
51 } 51 }
52 } 52 }
53 53
54 - $where = ['email_id'=>$this->getEmails('id')]; 54 + $where = ['lists|email_id'=>$this->getEmails('id')];
55 55
56 // 目录 56 // 目录
57 $folder = app()->request('folder','收件箱'); 57 $folder = app()->request('folder','收件箱');
@@ -72,7 +72,7 @@ class MailList extends Base { @@ -72,7 +72,7 @@ class MailList extends Base {
72 $extSql = "f"; 72 $extSql = "f";
73 } 73 }
74 // 查询 文件夹 74 // 查询 文件夹
75 - $folderList = db()->all(folderSql::all($where['email_id'])); 75 + $folderList = db()->all(folderSql::all($this->getEmails('id')));
76 $folder_id = []; 76 $folder_id = [];
77 // 文件夹id 77 // 文件夹id
78 if($folderList){ 78 if($folderList){
@@ -124,10 +124,10 @@ class MailList extends Base { @@ -124,10 +124,10 @@ class MailList extends Base {
124 } 124 }
125 125
126 126
127 - $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`email_id`,`to_name`'; 127 + $filed = '`id`,`uid`,`subject`,`from`,`from_name`,`flagged`,`seen`,`udate`,`folder_id`,`is_file`,`description`,`lists`.`email_id`,`to_name`';
128 128
129 if($extSql){ 129 if($extSql){
130 - $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); 130 + $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);
131 }else{ 131 }else{
132 $sql = "select %s from `lists` where ".dbWhere($where); 132 $sql = "select %s from `lists` where ".dbWhere($where);
133 } 133 }
@@ -152,6 +152,7 @@ function dbWhere(array $where, string $ar = 'and'):string{ @@ -152,6 +152,7 @@ function dbWhere(array $where, string $ar = 'and'):string{
152 foreach ($where as $f=>$v){ 152 foreach ($where as $f=>$v){
153 153
154 list($f,$t) = explode('.',$f.'.'); 154 list($f,$t) = explode('.',$f.'.');
  155 + $f = '`'.str_replace('|','`.`',$f).'`';
155 156
156 if(is_array($v)){ 157 if(is_array($v)){
157 if($f ==='_'){ 158 if($f ==='_'){
@@ -166,21 +167,21 @@ function dbWhere(array $where, string $ar = 'and'):string{ @@ -166,21 +167,21 @@ function dbWhere(array $where, string $ar = 'and'):string{
166 },$v); 167 },$v);
167 if(count($v)===1){ 168 if(count($v)===1){
168 if($t=='notin'){ 169 if($t=='notin'){
169 - $sql[] = "`{$f}` != ".$v[0]; 170 + $sql[] = "{$f} != ".$v[0];
170 }else{ 171 }else{
171 // 只有一个值时就是 = 172 // 只有一个值时就是 =
172 - $sql[] = "`{$f}` = ".$v[0]; 173 + $sql[] = "{$f} = ".$v[0];
173 } 174 }
174 175
175 }elseif (count($v) > 1){ 176 }elseif (count($v) > 1){
176 - $sql[] = "`{$f}` ".($t=='notin'?'not in':'in')." (".implode(',',$v).")"; 177 + $sql[] = "{$f} ".($t=='notin'?'not in':'in')." (".implode(',',$v).")";
177 } 178 }
178 179
179 }else{ 180 }else{
180 if($f ==='_'){ 181 if($f ==='_'){
181 $sql[] = $v; 182 $sql[] = $v;
182 }else{ 183 }else{
183 - $sql[] = "`{$f}` = '". (is_string($v) ? addslashes($v): $v) ."'"; 184 + $sql[] = "{$f} = '". (is_string($v) ? addslashes($v): $v) ."'";
184 } 185 }
185 186
186 } 187 }