正在显示
1 个修改的文件
包含
20 行增加
和
22 行删除
| @@ -28,7 +28,10 @@ class MailList extends Base { | @@ -28,7 +28,10 @@ class MailList extends Base { | ||
| 28 | */ | 28 | */ |
| 29 | private function getFolderId(string $folder){ | 29 | private function getFolderId(string $folder){ |
| 30 | // 查询 文件夹 | 30 | // 查询 文件夹 |
| 31 | + static $folderList; | ||
| 32 | + if(!$folderList){ | ||
| 31 | $folderList = db()->all(folderSql::all($this->getEmails('id'))); | 33 | $folderList = db()->all(folderSql::all($this->getEmails('id'))); |
| 34 | + } | ||
| 32 | $folder_id = []; | 35 | $folder_id = []; |
| 33 | // 文件夹id | 36 | // 文件夹id |
| 34 | if($folderList){ | 37 | if($folderList){ |
| @@ -195,43 +198,38 @@ class MailList extends Base { | @@ -195,43 +198,38 @@ class MailList extends Base { | ||
| 195 | public function count(){ | 198 | public function count(){ |
| 196 | $emails = $this->getEmails('id'); | 199 | $emails = $this->getEmails('id'); |
| 197 | 200 | ||
| 198 | - $sql = "select count(*) from `fob_hot_mail` left join `lists` on `fob_hot_mail`.`lists_id` = `lists`.`id` where "; | 201 | + $sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where "; |
| 199 | 202 | ||
| 200 | $where = ['lists|email_id'=>$emails]; | 203 | $where = ['lists|email_id'=>$emails]; |
| 201 | - $where['deleted'] = 0; //未删状态 | ||
| 202 | - // 预热收件箱 | ||
| 203 | - $where['folder'] = 's'; | ||
| 204 | - $sCount = db()->count($sql.dbWhere($where)); | ||
| 205 | - // 预热发件箱 | ||
| 206 | - $where['folder'] = 'f'; | ||
| 207 | - $fCount = db()->count($sql.dbWhere($where)); | ||
| 208 | - | ||
| 209 | - unset($where['folder']); | ||
| 210 | - | ||
| 211 | - | ||
| 212 | - | 204 | + $where['lists|deleted'] = 0; //未删状态 |
| 213 | // 屏蔽哪些邮件 | 205 | // 屏蔽哪些邮件 |
| 214 | $where['from.notin'] = $this->from_not_in(); | 206 | $where['from.notin'] = $this->from_not_in(); |
| 215 | if(!$where['from.notin']) unset($where['from.notin']); | 207 | if(!$where['from.notin']) unset($where['from.notin']); |
| 216 | 208 | ||
| 217 | - $where['folder_id'] = $this->getFolderId('发件箱'); | ||
| 218 | - // 发件箱 | ||
| 219 | - $sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ISNULL(`lists_id`) and "; | ||
| 220 | - $faCount = db()->count($sql.dbWhere($where)); | 209 | + $where['lists|folder_id'] = $this->getFolderId('发件箱'); |
| 210 | + // 预热发件箱 | ||
| 211 | + $where['fob_hot_mail|folder'] = 'f'; | ||
| 212 | + $fCount = db()->count($sql.dbWhere($where)." and `lists_id` > 0"); | ||
| 213 | + // 预热收件箱 | ||
| 214 | + $where['lists|folder_id'] = $this->getFolderId('收件箱'); | ||
| 215 | + $where['fob_hot_mail|folder'] = 's'; | ||
| 216 | + $sCount = db()->count($sql.dbWhere($where)." and `lists_id` > 0"); | ||
| 217 | + | ||
| 218 | + unset($where['folder']); | ||
| 221 | 219 | ||
| 222 | - // 垃圾箱 | 220 | + $sql = $sql." ISNULL(`lists_id`) and "; |
| 221 | + $where['lists|folder_id'] = $this->getFolderId('发件箱'); | ||
| 222 | + $faCount = db()->count($sql.dbWhere($where)); | ||
| 223 | +// 垃圾箱 | ||
| 223 | $where['folder_id'] = $this->getFolderId('垃圾箱'); | 224 | $where['folder_id'] = $this->getFolderId('垃圾箱'); |
| 224 | $lajiCount = db()->count($sql.dbWhere($where)); | 225 | $lajiCount = db()->count($sql.dbWhere($where)); |
| 225 | - | ||
| 226 | - // 收件箱 | 226 | +// 收件箱 |
| 227 | $where['folder_id'] = $this->getFolderId('收件箱'); | 227 | $where['folder_id'] = $this->getFolderId('收件箱'); |
| 228 | $shouCount = db()->count($sql.dbWhere($where)); | 228 | $shouCount = db()->count($sql.dbWhere($where)); |
| 229 | // 未读 | 229 | // 未读 |
| 230 | $where['seen'] = 0; | 230 | $where['seen'] = 0; |
| 231 | $seenCount = db()->count($sql.dbWhere($where)); | 231 | $seenCount = db()->count($sql.dbWhere($where)); |
| 232 | - | ||
| 233 | unset($where['seen']); | 232 | unset($where['seen']); |
| 234 | - | ||
| 235 | // 星标 | 233 | // 星标 |
| 236 | $where['flagged'] = 1; | 234 | $where['flagged'] = 1; |
| 237 | $flaggedCount = db()->count($sql.dbWhere($where)); | 235 | $flaggedCount = db()->count($sql.dbWhere($where)); |
-
请 注册 或 登录 后发表评论