作者 邓超

v2 调整

@@ -135,17 +135,39 @@ class Home extends Base { @@ -135,17 +135,39 @@ class Home extends Base {
135 135
136 // 通过时间来搜索uid 136 // 通过时间来搜索uid
137 $uids = $mail->client->search(['SINCE'=>date('d-M-Y',$udate)],true); 137 $uids = $mail->client->search(['SINCE'=>date('d-M-Y',$udate)],true);
  138 + if ($uids){
  139 + // 已有的uid
  140 + $useuids = db()->all(
  141 + sprintf(
  142 + "select `uid` from `%s` where `email_id` = %d and `folder_id` = %d and `uid` in (%s)",
  143 + listsSql::$table,
  144 + $email['id'],
  145 + $folder['id'],
  146 + implode(',',$uids)
  147 + )
  148 + );
  149 + $useuids = $useuids ? array_column($useuids,'uid') : [];
  150 + if($useuids){
  151 + // 删除多余的
  152 + foreach ($uids as $k=>$uid){
  153 + if(in_array($uid,$useuids)){
  154 + unset($uids[$k]);
  155 + }
  156 + }
  157 + }
  158 +
  159 + // 进行同步
  160 + $mail->syncUidEmail(
  161 + $uids,
  162 + $email['id'],
  163 + $folder['origin_folder'],
  164 + $folder['id'],
  165 + [],
  166 + [],
  167 + db()
  168 + );
  169 + }
138 170
139 - // 进行同步  
140 - $mail->syncUidEmail(  
141 - $uids,  
142 - $email['id'],  
143 - $folder['origin_folder'],  
144 - $folder['id'],  
145 - [],  
146 - [],  
147 - db()  
148 - );  
149 } 171 }
150 } 172 }
151 173