作者 邓超

优化同步

... ... @@ -49,7 +49,7 @@ class SyncMail {
$this->db = db();
if(!is_array($email)){
$email = $this->db->first(emailSql::first($email));
$email = $this->db->cache(3600)->first(emailSql::first($email));
if(!$email){
abort('未查询到邮箱');
}
... ... @@ -183,26 +183,26 @@ class SyncMail {
}
// 更新数量
$this->db->update(folderSql::$table,[
'exsts' => $this->db->count(listsSql::listCount(
dbWhere(
[
'folder_id'=>$this->getFolderId($folder->getName()),
'deleted' => 0,
]
)
)),
'unseen' => $this->db->count(listsSql::listCount(
dbWhere(
[
'folder_id'=>$this->getFolderId($folder->getName()),
'seen' => 0,
'deleted' => 0,
]
)
)),
'last_sync_time' => time()
],dbWhere(['email_id'=>$this->emailId(),'uuid'=>md5($this->emailId().$folder->getName())]),false);
// $this->db->update(folderSql::$table,[
// 'exsts' => $this->db->count(listsSql::listCount(
// dbWhere(
// [
// 'folder_id'=>$this->getFolderId($folder->getName()),
// 'deleted' => 0,
// ]
// )
// )),
// 'unseen' => $this->db->count(listsSql::listCount(
// dbWhere(
// [
// 'folder_id'=>$this->getFolderId($folder->getName()),
// 'seen' => 0,
// 'deleted' => 0,
// ]
// )
// )),
// 'last_sync_time' => time()
// ],dbWhere(['email_id'=>$this->emailId(),'uuid'=>md5($this->emailId().$folder->getName())]),false);
}
}
... ...