作者 邓超

优化 同步

@@ -267,7 +267,6 @@ class Mail { @@ -267,7 +267,6 @@ class Mail {
267 267
268 268
269 $data = [ 269 $data = [
270 - 'msgno' => $key,  
271 'uid' => $result['UID'], 270 'uid' => $result['UID'],
272 'subject' => $header['Subject']??'', 271 'subject' => $header['Subject']??'',
273 'cc' => $cc, 272 'cc' => $cc,
@@ -287,7 +286,6 @@ class Mail { @@ -287,7 +286,6 @@ class Mail {
287 'answered' => in_array('answered',$result['FLAGS']) ? 1 : 0, 286 'answered' => in_array('answered',$result['FLAGS']) ? 1 : 0,
288 'folder_id' => $folder_id, 287 'folder_id' => $folder_id,
289 'email_id' => $email_id, 288 'email_id' => $email_id,
290 - 'uuid' => md5($email_id.$folder_id.$result['UID']),  
291 'is_file' => MailFun::isFile($result['BODYSTRUCTURE']??'') ? 1: 0 //是否附件 289 'is_file' => MailFun::isFile($result['BODYSTRUCTURE']??'') ? 1: 0 //是否附件
292 ]; 290 ];
293 $data['date'] = $data['date'] ? : 0; 291 $data['date'] = $data['date'] ? : 0;
@@ -340,15 +338,14 @@ class Mail { @@ -340,15 +338,14 @@ class Mail {
340 338
341 /** 339 /**
342 * 同步 邮件 内容 body 340 * 同步 邮件 内容 body
343 - * @param $id  
344 - * @param $msgno  
345 - * @param $email_id  
346 * @param $folder_name 341 * @param $folder_name
347 - * @param $email 342 + * @param $uid
  343 + * @param $id
  344 + * @param null $db
348 * @return bool 345 * @return bool
349 * @throws \Exception 346 * @throws \Exception
350 * @author:dc 347 * @author:dc
351 - * @time 2023/2/9 10:29 348 + * @time 2023/4/23 17:40
352 */ 349 */
353 public function syncBody($folder_name, $uid , $id, $db=null):bool { 350 public function syncBody($folder_name, $uid , $id, $db=null):bool {
354 if(empty($folder_name)){ 351 if(empty($folder_name)){
@@ -29,7 +29,7 @@ class listsSql { @@ -29,7 +29,7 @@ class listsSql {
29 */ 29 */
30 public static function lists(string $where, int $p, int $size){ 30 public static function lists(string $where, int $p, int $size){
31 31
32 - $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`'; 32 + $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`';
33 33
34 return "select {$filed} from `".static::$table."` where ".$where." order by `udate` desc limit {$size} offset ".(($p-1)*$size); 34 return "select {$filed} from `".static::$table."` where ".$where." order by `udate` desc limit {$size} offset ".(($p-1)*$size);
35 35
@@ -47,17 +47,6 @@ class listsSql { @@ -47,17 +47,6 @@ class listsSql {
47 return "select count(*) from `".static::$table."` where ".$where; 47 return "select count(*) from `".static::$table."` where ".$where;
48 } 48 }
49 49
50 - /**  
51 - * 获取最后一条更新的msgno  
52 - * @param $email_id  
53 - * @param $folder_id  
54 - * @return string  
55 - * @author:dc  
56 - * @time 2023/2/18 10:01  
57 - */  
58 - public static function lastMsgno($email_id,$folder_id):string{  
59 - return "select max(`msgno`) from `".self::$table."` where ".dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id])." limit 1";  
60 - }  
61 50
62 /** 51 /**
63 * 获取已有的uid 52 * 获取已有的uid
@@ -72,22 +61,6 @@ class listsSql { @@ -72,22 +61,6 @@ class listsSql {
72 return "select `uid` from `".static::$table."` where ".dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uids]); 61 return "select `uid` from `".static::$table."` where ".dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uids]);
73 } 62 }
74 63
75 - /**  
76 - * 获取已存在的id  
77 - * @param $email_id  
78 - * @param $folder_id  
79 - * @param $msgno  
80 - * @return string  
81 - * @author:dc  
82 - * @time 2023/2/18 10:08  
83 - */  
84 - public static function getIds($email_id,$folder_id,$msgno):string {  
85 - return "select `id`,`msgno` from `".static::$table."` where ".dbWhere([  
86 - 'email_id' => $email_id,  
87 - 'folder_id' => $folder_id,  
88 - 'msgno' => $msgno,  
89 - ]);  
90 - }  
91 64
92 /** 65 /**
93 * 通过uuid查询id和email_id 66 * 通过uuid查询id和email_id