|
@@ -201,6 +201,9 @@ class MailList extends Base { |
|
@@ -201,6 +201,9 @@ class MailList extends Base { |
201
|
public function count(){
|
201
|
public function count(){
|
202
|
$emails = $this->getEmails('id');
|
202
|
$emails = $this->getEmails('id');
|
203
|
|
203
|
|
|
|
204
|
+ // show_count_filed
|
|
|
205
|
+ $show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']);
|
|
|
206
|
+
|
204
|
$sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ";
|
207
|
$sql = "select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where ";
|
205
|
|
208
|
|
206
|
$where = ['lists|email_id'=>$emails];
|
209
|
$where = ['lists|email_id'=>$emails];
|
|
@@ -209,43 +212,58 @@ class MailList extends Base { |
|
@@ -209,43 +212,58 @@ class MailList extends Base { |
209
|
$where['from.notin'] = $this->from_not_in();
|
212
|
$where['from.notin'] = $this->from_not_in();
|
210
|
if(!$where['from.notin']) unset($where['from.notin']);
|
213
|
if(!$where['from.notin']) unset($where['from.notin']);
|
211
|
|
214
|
|
|
|
215
|
+ // 发件箱
|
|
|
216
|
+ if(in_array('hot_send',$show_count_filed)){
|
212
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
217
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
213
|
// 预热发件箱
|
218
|
// 预热发件箱
|
214
|
$where['fob_hot_mail|folder'] = 'f';
|
219
|
$where['fob_hot_mail|folder'] = 'f';
|
215
|
$fCount = db()->count($sql.dbWhere($where));
|
220
|
$fCount = db()->count($sql.dbWhere($where));
|
|
|
221
|
+ }
|
|
|
222
|
+
|
216
|
// 预热收件箱
|
223
|
// 预热收件箱
|
|
|
224
|
+ if(in_array('hot_inbox',$show_count_filed)) {
|
217
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
225
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
218
|
$where['fob_hot_mail|folder'] = 's';
|
226
|
$where['fob_hot_mail|folder'] = 's';
|
219
|
- $sCount = db()->count($sql.dbWhere($where));
|
|
|
220
|
-
|
227
|
+ $sCount = db()->count($sql . dbWhere($where));
|
|
|
228
|
+ }
|
221
|
unset($where['fob_hot_mail|folder']);
|
229
|
unset($where['fob_hot_mail|folder']);
|
222
|
|
230
|
|
223
|
$sql = $sql." ISNULL(`lists_id`) and ";
|
231
|
$sql = $sql." ISNULL(`lists_id`) and ";
|
|
|
232
|
+ if(in_array('send',$show_count_filed)) {
|
224
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
233
|
$where['lists|folder_id'] = $this->getFolderId('发件箱');
|
225
|
- $faCount = db()->count($sql.dbWhere($where));
|
234
|
+ $faCount = db()->count($sql . dbWhere($where));
|
|
|
235
|
+ }
|
226
|
// 垃圾箱
|
236
|
// 垃圾箱
|
|
|
237
|
+ if(in_array('junk',$show_count_filed)) {
|
227
|
$where['lists|folder_id'] = $this->getFolderId('垃圾箱');
|
238
|
$where['lists|folder_id'] = $this->getFolderId('垃圾箱');
|
228
|
- $lajiCount = db()->count($sql.dbWhere($where));
|
239
|
+ $lajiCount = db()->count($sql . dbWhere($where));
|
|
|
240
|
+ }
|
229
|
// 收件箱
|
241
|
// 收件箱
|
|
|
242
|
+ if(in_array('inbox',$show_count_filed)) {
|
230
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
243
|
$where['lists|folder_id'] = $this->getFolderId('收件箱');
|
231
|
- $shouCount = db()->count($sql.dbWhere($where));
|
244
|
+ $shouCount = db()->count($sql . dbWhere($where));
|
|
|
245
|
+ }
|
232
|
// 未读
|
246
|
// 未读
|
|
|
247
|
+ if(in_array('unseen',$show_count_filed)) {
|
233
|
$where['seen'] = 0;
|
248
|
$where['seen'] = 0;
|
234
|
- $seenCount = db()->count($sql.dbWhere($where));
|
249
|
+ $seenCount = db()->count($sql . dbWhere($where));
|
235
|
unset($where['seen']);
|
250
|
unset($where['seen']);
|
|
|
251
|
+ }
|
236
|
// 星标
|
252
|
// 星标
|
|
|
253
|
+ if(in_array('flagged',$show_count_filed)) {
|
237
|
$where['flagged'] = 1;
|
254
|
$where['flagged'] = 1;
|
238
|
- $flaggedCount = db()->count($sql.dbWhere($where));
|
|
|
239
|
-
|
|
|
240
|
- app()->_json([
|
|
|
241
|
- 'inbox'=> $shouCount,
|
|
|
242
|
- 'send'=> $faCount,
|
|
|
243
|
- 'unseen'=> $seenCount,
|
|
|
244
|
- 'flagged' => $flaggedCount,
|
|
|
245
|
- 'junk' => $lajiCount,
|
|
|
246
|
- 'hot_inbox'=> $sCount,
|
|
|
247
|
- 'hot_send'=> $fCount,
|
|
|
248
|
- ]);
|
255
|
+ $flaggedCount = db()->count($sql . dbWhere($where));
|
|
|
256
|
+ }
|
|
|
257
|
+ $data = [];
|
|
|
258
|
+ if(isset($shouCount)) $data['inbox'] = $shouCount;
|
|
|
259
|
+ if(isset($faCount)) $data['send'] = $faCount;
|
|
|
260
|
+ if(isset($seenCount)) $data['unseen'] = $seenCount;
|
|
|
261
|
+ if(isset($flaggedCount)) $data['flagged'] = $flaggedCount;
|
|
|
262
|
+ if(isset($lajiCount)) $data['junk'] = $lajiCount;
|
|
|
263
|
+ if(isset($sCount)) $data['hot_inbox'] = $sCount;
|
|
|
264
|
+ if(isset($fCount)) $data['hot_send'] = $fCount;
|
|
|
265
|
+
|
|
|
266
|
+ app()->_json($data);
|
249
|
|
267
|
|
250
|
}
|
268
|
}
|
251
|
|
269
|
|