作者 邓超

x

@@ -19,6 +19,8 @@ use function Swoole\Coroutine\Http\request; @@ -19,6 +19,8 @@ use function Swoole\Coroutine\Http\request;
19 */ 19 */
20 class MailListV2 extends Base { 20 class MailListV2 extends Base {
21 21
  22 + private $cache = 0;
  23 +
22 /** 24 /**
23 * 当前邮箱下指定的文件夹 25 * 当前邮箱下指定的文件夹
24 * @param string $folder 26 * @param string $folder
@@ -180,7 +182,7 @@ class MailListV2 extends Base { @@ -180,7 +182,7 @@ class MailListV2 extends Base {
180 },$lists?:[]); 182 },$lists?:[]);
181 183
182 // 总数 184 // 总数
183 - $total = db()->cache(600)->count(sprintf($sql,"count(*)")); 185 + $total = db()->cache($this->cache)->count(sprintf($sql,"count(*)"));
184 186
185 app()->_json(listsPage($lists,$total,$page,$limit)); 187 app()->_json(listsPage($lists,$total,$page,$limit));
186 188
@@ -212,44 +214,44 @@ class MailListV2 extends Base { @@ -212,44 +214,44 @@ class MailListV2 extends Base {
212 $where['folder_id'] = $this->getFolderId('发件箱'); 214 $where['folder_id'] = $this->getFolderId('发件箱');
213 // 预热发件箱 215 // 预热发件箱
214 $where['is_hots'] = 1; 216 $where['is_hots'] = 1;
215 - $fCount = db()->cache(600)->count($sql.dbWhere($where)); 217 + $fCount = db()->cache($this->cache)->count($sql.dbWhere($where));
216 } 218 }
217 219
218 // 预热收件箱 220 // 预热收件箱
219 if(in_array('hot_inbox',$show_count_filed)) { 221 if(in_array('hot_inbox',$show_count_filed)) {
220 $where['folder_id'] = $this->getFolderId('收件箱'); 222 $where['folder_id'] = $this->getFolderId('收件箱');
221 $where['is_hots'] = 1; 223 $where['is_hots'] = 1;
222 - $sCount = db()->cache(600)->count($sql . dbWhere($where)); 224 + $sCount = db()->cache($this->cache)->count($sql . dbWhere($where));
223 } 225 }
224 226
225 if(in_array('send',$show_count_filed)) { 227 if(in_array('send',$show_count_filed)) {
226 $where['folder_id'] = $this->getFolderId('发件箱'); 228 $where['folder_id'] = $this->getFolderId('发件箱');
227 $where['is_hots'] = 0; 229 $where['is_hots'] = 0;
228 - $faCount = db()->cache(600)->count($sql . dbWhere($where)); 230 + $faCount = db()->cache($this->cache)->count($sql . dbWhere($where));
229 } 231 }
230 // 垃圾箱 232 // 垃圾箱
231 if(in_array('junk',$show_count_filed)) { 233 if(in_array('junk',$show_count_filed)) {
232 $where['folder_id'] = $this->getFolderId('垃圾箱'); 234 $where['folder_id'] = $this->getFolderId('垃圾箱');
233 $where['is_hots'] = 0; 235 $where['is_hots'] = 0;
234 - $lajiCount = db()->cache(600)->count($sql . dbWhere($where)); 236 + $lajiCount = db()->cache($this->cache)->count($sql . dbWhere($where));
235 } 237 }
236 // 收件箱 238 // 收件箱
237 if(in_array('inbox',$show_count_filed)) { 239 if(in_array('inbox',$show_count_filed)) {
238 $where['folder_id'] = $this->getFolderId('收件箱'); 240 $where['folder_id'] = $this->getFolderId('收件箱');
239 $where['is_hots'] = 0; 241 $where['is_hots'] = 0;
240 - $shouCount = db()->cache(600)->count($sql . dbWhere($where)); 242 + $shouCount = db()->cache($this->cache)->count($sql . dbWhere($where));
241 } 243 }
242 // 未读 244 // 未读
243 if(in_array('unseen',$show_count_filed)) { 245 if(in_array('unseen',$show_count_filed)) {
244 $where['seen'] = 0; 246 $where['seen'] = 0;
245 $where['is_hots'] = 0; 247 $where['is_hots'] = 0;
246 - $seenCount = db()->cache(600)->count($sql . dbWhere($where)); 248 + $seenCount = db()->cache($this->cache)->count($sql . dbWhere($where));
247 unset($where['seen']); 249 unset($where['seen']);
248 } 250 }
249 // 星标 251 // 星标
250 if(in_array('flagged',$show_count_filed)) { 252 if(in_array('flagged',$show_count_filed)) {
251 $where['flagged'] = 1; 253 $where['flagged'] = 1;
252 - $flaggedCount = db()->cache(600)->count($sql . dbWhere($where)); 254 + $flaggedCount = db()->cache($this->cache)->count($sql . dbWhere($where));
253 } 255 }
254 $data = []; 256 $data = [];
255 if(isset($shouCount)) $data['inbox'] = $shouCount; 257 if(isset($shouCount)) $data['inbox'] = $shouCount;