作者 邓超

email

@@ -146,6 +146,14 @@ class Home extends Base { @@ -146,6 +146,14 @@ class Home extends Base {
146 // 通过时间来搜索uid 146 // 通过时间来搜索uid
147 $uids = $mail->client->search(['SINCE'=>date('d-M-Y',$udate)],true); 147 $uids = $mail->client->search(['SINCE'=>date('d-M-Y',$udate)],true);
148 if ($uids){ 148 if ($uids){
  149 +
  150 + $us = [];
  151 + foreach ($uids as $k=>$uid){
  152 + if(!isset($us[intval($k/100)])) $us[intval($k/100)] = [];
  153 + $us[intval($k/100)][] = $uid;
  154 + }
  155 +
  156 + foreach ($us as $u){
149 // 已有的uid 157 // 已有的uid
150 $useuids = db()->all( 158 $useuids = db()->all(
151 sprintf( 159 sprintf(
@@ -153,26 +161,21 @@ class Home extends Base { @@ -153,26 +161,21 @@ class Home extends Base {
153 listsSql::$table, 161 listsSql::$table,
154 $email['id'], 162 $email['id'],
155 $folder['id'], 163 $folder['id'],
156 - implode(',',$uids) 164 + implode(',',$u)
157 ) 165 )
158 ); 166 );
159 $useuids = $useuids ? array_column($useuids,'uid') : []; 167 $useuids = $useuids ? array_column($useuids,'uid') : [];
160 if($useuids){ 168 if($useuids){
161 // 删除多余的 169 // 删除多余的
162 - foreach ($uids as $k=>$uid){  
163 - if(in_array($uid,$useuids)){  
164 - unset($uids[$k]); 170 + foreach ($u as $k=>$ui){
  171 + if(in_array($ui,$useuids)){
  172 + unset($u[$k]);
165 } 173 }
166 } 174 }
167 } 175 }
168 - if($uids){  
169 - $us = [];  
170 - foreach ($uids as $k=>$uid){  
171 - if(!isset($us[intval($k/100)])) $us[intval($k/100)] = [];  
172 - $us[intval($k/100)][] = $uid;  
173 - }  
174 176
175 - foreach ($us as $u){ 177 +
  178 + if($u){
176 // 进行同步 179 // 进行同步
177 $mail->syncUidEmail( 180 $mail->syncUidEmail(
178 array_values($u), 181 array_values($u),
@@ -185,8 +188,11 @@ class Home extends Base { @@ -185,8 +188,11 @@ class Home extends Base {
185 ); 188 );
186 } 189 }
187 190
  191 +
188 } 192 }
189 193
  194 +
  195 +
190 } 196 }
191 197
192 } 198 }