作者 邓超

预热邮件

... ... @@ -47,29 +47,40 @@ class HotMailArchive {
private function run($id):int {
$floder = $this->db->first(\Model\folderSql::first(['id.>'=>$id]));
$list = $this->db->all(\Model\listsSql::first(dbWhere(['id.>'=>$id,'is_hots'=>1])).'00');
if(!$list){
if($floder){
$this->move($floder['id']);
return $floder['id'];
}else{
return 0;
}
_echo('正在移动 '.$id);
foreach ($list as $item){
try {
$ret = $this->db->throw()->insert('lists_hot',$item,false);
}catch (Throwable $e){
$this->db->delete('lists_hot',['id'=>$item['id']]);
unset($item['updated_at']);
$ret = $this->db->throw()->insert('lists_hot',$item,false);
}
if($ret){
$this->db->delete(listsSql::$table,['id'=>$item['id']]);
}
if($item['id'] > $id){
$id = $item['id'];
}
public function move($fid){
_echo('正在移动 '.$fid);
$list = $this->db->all(\Model\listsSql::first(dbWhere(['folder_id'=>$fid,'is_hots'=>1])).'000');
if($list){
foreach ($list as $item){
try {
$ret = $this->db->throw()->insert('lists_hot',$item,false);
}catch (Throwable $e){
$this->db->delete('lists_hot',['id'=>$item['id']]);
unset($item['updated_at']);
$ret = $this->db->throw()->insert('lists_hot',$item,false);
}
if($ret){
$this->db->delete(listsSql::$table,['id'=>$item['id']]);
}
if($item['id'] > $id){
$id = $item['id'];
}
}
$this->move($fid);
}
return $id;
}
... ...