作者 邓超

fob

... ... @@ -28,7 +28,10 @@ class MailList extends Base {
*/
private function getFolderId(string $folder){
// 查询 文件夹
$folderList = db()->all(folderSql::all($this->getEmails('id')));
static $folderList;
if(!$folderList){
$folderList = db()->all(folderSql::all($this->getEmails('id')));
}
$folder_id = [];
// 文件夹id
if($folderList){
... ... @@ -195,43 +198,38 @@ class MailList extends Base {
public function count(){
$emails = $this->getEmails('id');
$sql = "select count(*) from `fob_hot_mail` left join `lists` on `fob_hot_mail`.`lists_id` = `lists`.`id` where ";
$sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ";
$where = ['lists|email_id'=>$emails];
$where['deleted'] = 0; //未删状态
// 预热收件箱
$where['folder'] = 's';
$sCount = db()->count($sql.dbWhere($where));
// 预热发件箱
$where['folder'] = 'f';
$fCount = db()->count($sql.dbWhere($where));
unset($where['folder']);
$where['lists|deleted'] = 0; //未删状态
// 屏蔽哪些邮件
$where['from.notin'] = $this->from_not_in();
if(!$where['from.notin']) unset($where['from.notin']);
$where['folder_id'] = $this->getFolderId('发件箱');
// 发件箱
$sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ISNULL(`lists_id`) and ";
$faCount = db()->count($sql.dbWhere($where));
$where['lists|folder_id'] = $this->getFolderId('发件箱');
// 预热发件箱
$where['fob_hot_mail|folder'] = 'f';
$fCount = db()->count($sql.dbWhere($where)." and `lists_id` > 0");
// 预热收件箱
$where['lists|folder_id'] = $this->getFolderId('收件箱');
$where['fob_hot_mail|folder'] = 's';
$sCount = db()->count($sql.dbWhere($where)." and `lists_id` > 0");
unset($where['folder']);
// 垃圾箱
$sql = $sql." ISNULL(`lists_id`) and ";
$where['lists|folder_id'] = $this->getFolderId('发件箱');
$faCount = db()->count($sql.dbWhere($where));
// 垃圾箱
$where['folder_id'] = $this->getFolderId('垃圾箱');
$lajiCount = db()->count($sql.dbWhere($where));
// 收件箱
// 收件箱
$where['folder_id'] = $this->getFolderId('收件箱');
$shouCount = db()->count($sql.dbWhere($where));
// 未读
$where['seen'] = 0;
$seenCount = db()->count($sql.dbWhere($where));
unset($where['seen']);
// 星标
$where['flagged'] = 1;
$flaggedCount = db()->count($sql.dbWhere($where));
... ...