作者 邓超

email

... ... @@ -146,6 +146,14 @@ class Home extends Base {
// 通过时间来搜索uid
$uids = $mail->client->search(['SINCE'=>date('d-M-Y',$udate)],true);
if ($uids){
$us = [];
foreach ($uids as $k=>$uid){
if(!isset($us[intval($k/100)])) $us[intval($k/100)] = [];
$us[intval($k/100)][] = $uid;
}
foreach ($us as $u){
// 已有的uid
$useuids = db()->all(
sprintf(
... ... @@ -153,26 +161,21 @@ class Home extends Base {
listsSql::$table,
$email['id'],
$folder['id'],
implode(',',$uids)
implode(',',$u)
)
);
$useuids = $useuids ? array_column($useuids,'uid') : [];
if($useuids){
// 删除多余的
foreach ($uids as $k=>$uid){
if(in_array($uid,$useuids)){
unset($uids[$k]);
foreach ($u as $k=>$ui){
if(in_array($ui,$useuids)){
unset($u[$k]);
}
}
}
if($uids){
$us = [];
foreach ($uids as $k=>$uid){
if(!isset($us[intval($k/100)])) $us[intval($k/100)] = [];
$us[intval($k/100)][] = $uid;
}
foreach ($us as $u){
if($u){
// 进行同步
$mail->syncUidEmail(
array_values($u),
... ... @@ -185,8 +188,11 @@ class Home extends Base {
);
}
}
}
}
... ...