作者 邓超

预热邮件

@@ -48,22 +48,28 @@ class HotMailArchive { @@ -48,22 +48,28 @@ class HotMailArchive {
48 48
49 private function run($id):int { 49 private function run($id):int {
50 50
51 - $list = $this->db->first(\Model\listsSql::first(dbWhere(['id.>'=>$id,'is_hots'=>1]))); 51 + $list = $this->db->all(\Model\listsSql::first(dbWhere(['id.>'=>$id,'is_hots'=>1])).'00');
52 if(!$list){ 52 if(!$list){
53 return 0; 53 return 0;
54 } 54 }
55 - _echo('正在移动 '.$list['id']); 55 + _echo('正在移动 '.$id);
  56 + foreach ($list as $item){
56 try { 57 try {
57 - $ret = $this->db->throw()->insert('lists_hot',$list,false); 58 + $ret = $this->db->throw()->insert('lists_hot',$item,false);
58 }catch (Throwable $e){ 59 }catch (Throwable $e){
59 - $this->db->delete('lists_hot',['id'=>$list['id']]);  
60 -  
61 - $ret = $this->db->throw()->insert('lists_hot',$list,false); 60 + $this->db->delete('lists_hot',['id'=>$item['id']]);
  61 + unset($item['updated_at']);
  62 + $ret = $this->db->throw()->insert('lists_hot',$item,false);
62 } 63 }
63 if($ret){ 64 if($ret){
64 - $this->db->delete(listsSql::$table,['id'=>$list['id']]); 65 + $this->db->delete(listsSql::$table,['id'=>$item['id']]);
  66 + }
  67 + if($item['id'] > $id){
  68 + $id = $item['id'];
65 } 69 }
66 - return $list['id']; 70 + }
  71 +
  72 + return $id;
67 73
68 } 74 }
69 75