作者 邓超

x

@@ -37,7 +37,10 @@ function start(){ @@ -37,7 +37,10 @@ function start(){
37 $goNum++; 37 $goNum++;
38 try{ 38 try{
39 // 开始同步 39 // 开始同步
40 - (new \Service\SyncMail($id))->sync(); 40 + (new \Service\SyncMail($id))->search(
  41 + (new \Lib\Imap\ImapSearch())
  42 + ->date(date('Y-m-d',strtotime("-3 day")))
  43 + )->sync();
41 }catch (Throwable $e){ 44 }catch (Throwable $e){
42 logs('sync : '.$e->getMessage()); 45 logs('sync : '.$e->getMessage());
43 } 46 }
@@ -310,13 +310,13 @@ class SyncMail { @@ -310,13 +310,13 @@ class SyncMail {
310 310
311 foreach ($uids as $k=>$uid){ 311 foreach ($uids as $k=>$uid){
312 312
313 -// $has = redis()->get('h_'.$folder_id.'_'.$uid,function () use ($folder_id,$uid){ 313 + $num = redis()->get('h_'.$folder_id.'_'.$uid,function () use ($folder_id,$uid){
314 $num = $this->db->value(listsSql::first(dbWhere(['email_id'=>$this->emailId(),'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c')); 314 $num = $this->db->value(listsSql::first(dbWhere(['email_id'=>$this->emailId(),'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'));
315 -// if($num){  
316 -// redis()->set('h_'.$folder_id.'_'.$uid,1,86400);  
317 -// }  
318 -// return $num;  
319 -// }); 315 + if($num){
  316 + redis()->set('h_'.$folder_id.'_'.$uid,1,86400);
  317 + }
  318 + return $num;
  319 + });
320 320
321 if($num){ 321 if($num){
322 unset($uids[$k]); 322 unset($uids[$k]);