作者 邓超

fob

... ... @@ -72,9 +72,9 @@ class HotMail {
foreach ($folders as $f){
if(folderAlias($f['folder']) == $folder){
// 最后记录的id
$last_id = db()->value('select max(`lists_id`) from `fob_hot_mail` where `email_id` = '.$email_id.' and `folder` = "'.$type.'" limit 1');
$last_id = $last_id?$last_id:0;
$this->findList(new Data($email_id,$f['id'],$type,$last_id));
// $last_id = db()->value('select max(`lists_id`) from `fob_hot_mail` where `email_id` = '.$email_id.' and `folder` = "'.$type.'" limit 1');
// $last_id = $last_id?$last_id:0;
$this->findList(new Data($email_id,$f['id'],$type,0));
}
}
return true;
... ... @@ -88,9 +88,8 @@ class HotMail {
private function findList(Data $data, int $p = 1){
$lists = db()->all(
sprintf(
"select `id`,`folder_id`,`email_id`,`%s` from `lists` where `id` > %d and `email_id` = %d and `folder_id` = %d and (select count(*) from `fob_hot_mail` where `lists`.`id` = `fob_hot_mail`.`lists_id`) = 0 order by `id` asc limit 1000 offset ".(($p-1)*1000),
"select `id`,`folder_id`,`email_id`,`%s` from `lists` left join `fob_hot_mail` on `fob_hot_mail`.`lists_id` = `lists`.`id` where `email_id` = %d and `folder_id` = %d and `fob_hot_mail`.`lists_id` is null order by `id` asc limit 1000 offset ".(($p-1)*1000),
$data->type=='s' ? 'from':'to_name', // 收件箱查询 from字段 发件箱 查询 to_name字段
$data->last_id,
$data->email_id,
$data->folder_id
)
... ...