...
|
...
|
@@ -40,12 +40,29 @@ function start(){ |
|
|
$email = db()->cache(3600)->first(\Model\emailSql::first($id));
|
|
|
if($email){
|
|
|
$sync = new \Service\SyncMail($email);
|
|
|
$search = new \Lib\Imap\ImapSearch();
|
|
|
// 第一次同步 只同步当天的
|
|
|
if(!db()->cache(600)->count(\Model\listsSql::first('`id` > 0'))){
|
|
|
$sync->search($search->dateGt($email['created_at']));
|
|
|
}else{
|
|
|
// 是否是ai邮箱
|
|
|
if(db()->count("select count(*) from `hot_mail` where `email` = '{$email['email']}'")){
|
|
|
// ai邮件只同步2天内的
|
|
|
if(strtotime("-2 day") > strtotime($email['created_at'])){
|
|
|
$sync->search(
|
|
|
(new \Lib\Imap\ImapSearch())
|
|
|
->dateGt(date('Y-m-d',strtotime("-2 day")))
|
|
|
$search->dateGt(
|
|
|
date('Y-m-d',
|
|
|
strtotime("-2 day")
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
}else{
|
|
|
$sync->search(
|
|
|
$search->dateGt($email['created_at'])
|
|
|
);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$sync->sync();
|
...
|
...
|
|