...
|
...
|
@@ -201,6 +201,9 @@ class MailList extends Base { |
|
|
public function count(){
|
|
|
$emails = $this->getEmails('id');
|
|
|
|
|
|
// show_count_filed
|
|
|
$show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']);
|
|
|
|
|
|
$sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ";
|
|
|
|
|
|
$where = ['lists|email_id'=>$emails];
|
...
|
...
|
@@ -209,43 +212,58 @@ class MailList extends Base { |
|
|
$where['from.notin'] = $this->from_not_in();
|
|
|
if(!$where['from.notin']) unset($where['from.notin']);
|
|
|
|
|
|
// 发件箱
|
|
|
if(in_array('hot_send',$show_count_filed)){
|
|
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
|
|
// 预热发件箱
|
|
|
$where['fob_hot_mail|folder'] = 'f';
|
|
|
$fCount = db()->count($sql.dbWhere($where));
|
|
|
}
|
|
|
|
|
|
// 预热收件箱
|
|
|
if(in_array('hot_inbox',$show_count_filed)) {
|
|
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
|
|
$where['fob_hot_mail|folder'] = 's';
|
|
|
$sCount = db()->count($sql.dbWhere($where));
|
|
|
|
|
|
$sCount = db()->count($sql . dbWhere($where));
|
|
|
}
|
|
|
unset($where['fob_hot_mail|folder']);
|
|
|
|
|
|
$sql = $sql." ISNULL(`lists_id`) and ";
|
|
|
if(in_array('send',$show_count_filed)) {
|
|
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
|
|
$faCount = db()->count($sql.dbWhere($where));
|
|
|
$faCount = db()->count($sql . dbWhere($where));
|
|
|
}
|
|
|
// 垃圾箱
|
|
|
if(in_array('junk',$show_count_filed)) {
|
|
|
$where['lists|folder_id'] = $this->getFolderId('垃圾箱');
|
|
|
$lajiCount = db()->count($sql.dbWhere($where));
|
|
|
$lajiCount = db()->count($sql . dbWhere($where));
|
|
|
}
|
|
|
// 收件箱
|
|
|
if(in_array('inbox',$show_count_filed)) {
|
|
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
|
|
$shouCount = db()->count($sql.dbWhere($where));
|
|
|
$shouCount = db()->count($sql . dbWhere($where));
|
|
|
}
|
|
|
// 未读
|
|
|
if(in_array('unseen',$show_count_filed)) {
|
|
|
$where['seen'] = 0;
|
|
|
$seenCount = db()->count($sql.dbWhere($where));
|
|
|
$seenCount = db()->count($sql . dbWhere($where));
|
|
|
unset($where['seen']);
|
|
|
}
|
|
|
// 星标
|
|
|
if(in_array('flagged',$show_count_filed)) {
|
|
|
$where['flagged'] = 1;
|
|
|
$flaggedCount = db()->count($sql.dbWhere($where));
|
|
|
|
|
|
app()->_json([
|
|
|
'inbox'=> $shouCount,
|
|
|
'send'=> $faCount,
|
|
|
'unseen'=> $seenCount,
|
|
|
'flagged' => $flaggedCount,
|
|
|
'junk' => $lajiCount,
|
|
|
'hot_inbox'=> $sCount,
|
|
|
'hot_send'=> $fCount,
|
|
|
]);
|
|
|
$flaggedCount = db()->count($sql . dbWhere($where));
|
|
|
}
|
|
|
$data = [];
|
|
|
if(isset($shouCount)) $data['inbox'] = $shouCount;
|
|
|
if(isset($faCount)) $data['send'] = $faCount;
|
|
|
if(isset($seenCount)) $data['unseen'] = $seenCount;
|
|
|
if(isset($flaggedCount)) $data['flagged'] = $flaggedCount;
|
|
|
if(isset($lajiCount)) $data['junk'] = $lajiCount;
|
|
|
if(isset($sCount)) $data['hot_inbox'] = $sCount;
|
|
|
if(isset($fCount)) $data['hot_send'] = $fCount;
|
|
|
|
|
|
app()->_json($data);
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|