作者 邓超

x

  1 +<?php
  2 +
  3 +
  4 +
  5 +include_once "../vendor/autoload.php";
  6 +
  7 +$fid = 1;
  8 +
  9 +while ($fid){
  10 + $fid = db()->value(\Model\folderSql::first([
  11 + 'id.>' => $fid
  12 + ],
  13 + '`id`'
  14 + ));
  15 + if(!$fid){
  16 + break;
  17 + }
  18 +
  19 + // 总数
  20 + $folder['exsts'] = db()->count(\Model\listsSql::listCount(
  21 + dbWhere(['folder_id'=> $fid, 'deleted' => 0])
  22 + ));
  23 + // 未读
  24 + $folder['unseen'] = db()->count(\Model\listsSql::listCount(
  25 + dbWhere(['folder_id'=> $fid, 'seen' => 0, 'deleted' => 0])
  26 + ));
  27 +
  28 + _echo('fid: '.$fid.' data: '.json_encode($folder));
  29 +
  30 + db()->update(\Model\folderSql::$table,$folder,'`id` = '.$fid,false);
  31 +
  32 +}
  33 +
@@ -233,28 +233,6 @@ class SyncMail { @@ -233,28 +233,6 @@ class SyncMail {
233 _echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num); 233 _echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num);
234 } 234 }
235 } 235 }
236 - $fid = $this->getFolderId($folder->getName());  
237 - // 更新数量  
238 - $this->db->update(folderSql::$table,[  
239 - 'exsts' => $this->db->count(listsSql::listCount(  
240 - dbWhere(  
241 - [  
242 - 'folder_id'=>$fid,  
243 - 'deleted' => 0,  
244 - ]  
245 - )  
246 - )),  
247 - 'unseen' => $this->db->count(listsSql::listCount(  
248 - dbWhere(  
249 - [  
250 - 'folder_id'=>$fid,  
251 - 'seen' => 0,  
252 - 'deleted' => 0,  
253 - ]  
254 - )  
255 - )),  
256 - 'last_sync_time' => time()  
257 - ],dbWhere(['email_id'=>$this->emailId(),'id'=>$fid]),false);  
258 236
259 } 237 }
260 } 238 }