作者 邓超

优化 同步

... ... @@ -267,7 +267,6 @@ class Mail {
$data = [
'msgno' => $key,
'uid' => $result['UID'],
'subject' => $header['Subject']??'',
'cc' => $cc,
... ... @@ -287,7 +286,6 @@ class Mail {
'answered' => in_array('answered',$result['FLAGS']) ? 1 : 0,
'folder_id' => $folder_id,
'email_id' => $email_id,
'uuid' => md5($email_id.$folder_id.$result['UID']),
'is_file' => MailFun::isFile($result['BODYSTRUCTURE']??'') ? 1: 0 //是否附件
];
$data['date'] = $data['date'] ? : 0;
... ... @@ -340,15 +338,14 @@ class Mail {
/**
* 同步 邮件 内容 body
* @param $id
* @param $msgno
* @param $email_id
* @param $folder_name
* @param $email
* @param $uid
* @param $id
* @param null $db
* @return bool
* @throws \Exception
* @author:dc
* @time 2023/2/9 10:29
* @time 2023/4/23 17:40
*/
public function syncBody($folder_name, $uid , $id, $db=null):bool {
if(empty($folder_name)){
... ...
... ... @@ -29,7 +29,7 @@ class listsSql {
*/
public static function lists(string $where, int $p, int $size){
$filed = '`id`,`uid`,`msgno`,`subject`,`from`,`from_name`,`to`,`date`,`size`,`recent`,`flagged`,`answered`,`deleted`,`seen`,`draft`,`udate`,`folder_id`,`is_file`,`cc`,`bcc`,`description`,`email_id`';
$filed = '`id`,`uid`,`subject`,`from`,`from_name`,`to`,`date`,`size`,`recent`,`flagged`,`answered`,`deleted`,`seen`,`draft`,`udate`,`folder_id`,`is_file`,`cc`,`bcc`,`description`,`email_id`';
return "select {$filed} from `".static::$table."` where ".$where." order by `udate` desc limit {$size} offset ".(($p-1)*$size);
... ... @@ -47,17 +47,6 @@ class listsSql {
return "select count(*) from `".static::$table."` where ".$where;
}
/**
* 获取最后一条更新的msgno
* @param $email_id
* @param $folder_id
* @return string
* @author:dc
* @time 2023/2/18 10:01
*/
public static function lastMsgno($email_id,$folder_id):string{
return "select max(`msgno`) from `".self::$table."` where ".dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id])." limit 1";
}
/**
* 获取已有的uid
... ... @@ -72,22 +61,6 @@ class listsSql {
return "select `uid` from `".static::$table."` where ".dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uids]);
}
/**
* 获取已存在的id
* @param $email_id
* @param $folder_id
* @param $msgno
* @return string
* @author:dc
* @time 2023/2/18 10:08
*/
public static function getIds($email_id,$folder_id,$msgno):string {
return "select `id`,`msgno` from `".static::$table."` where ".dbWhere([
'email_id' => $email_id,
'folder_id' => $folder_id,
'msgno' => $msgno,
]);
}
/**
* 通过uuid查询id和email_id
... ...