正在显示
1 个修改的文件
包含
28 行增加
和
17 行删除
| @@ -47,29 +47,40 @@ class HotMailArchive { | @@ -47,29 +47,40 @@ class HotMailArchive { | ||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | private function run($id):int { | 49 | private function run($id):int { | 
| 50 | + $floder = $this->db->first(\Model\folderSql::first(['id.>'=>$id])); | ||
| 50 | 51 | ||
| 51 | - $list = $this->db->all(\Model\listsSql::first(dbWhere(['id.>'=>$id,'is_hots'=>1])).'00'); | ||
| 52 | - if(!$list){ | 52 | + if($floder){ | 
| 53 | + $this->move($floder['id']); | ||
| 54 | + return $floder['id']; | ||
| 55 | + }else{ | ||
| 53 | return 0; | 56 | return 0; | 
| 54 | } | 57 | } | 
| 55 | - _echo('正在移动 '.$id); | ||
| 56 | - foreach ($list as $item){ | ||
| 57 | - try { | ||
| 58 | - $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
| 59 | - }catch (Throwable $e){ | ||
| 60 | - $this->db->delete('lists_hot',['id'=>$item['id']]); | ||
| 61 | - unset($item['updated_at']); | ||
| 62 | - $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
| 63 | - } | ||
| 64 | - if($ret){ | ||
| 65 | - $this->db->delete(listsSql::$table,['id'=>$item['id']]); | ||
| 66 | - } | ||
| 67 | - if($item['id'] > $id){ | ||
| 68 | - $id = $item['id']; | 58 | + | 
| 59 | + | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public function move($fid){ | ||
| 63 | + _echo('正在移动 '.$fid); | ||
| 64 | + $list = $this->db->all(\Model\listsSql::first(dbWhere(['folder_id'=>$fid,'is_hots'=>1])).'000'); | ||
| 65 | + if($list){ | ||
| 66 | + foreach ($list as $item){ | ||
| 67 | + try { | ||
| 68 | + $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
| 69 | + }catch (Throwable $e){ | ||
| 70 | + $this->db->delete('lists_hot',['id'=>$item['id']]); | ||
| 71 | + unset($item['updated_at']); | ||
| 72 | + $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
| 73 | + } | ||
| 74 | + if($ret){ | ||
| 75 | + $this->db->delete(listsSql::$table,['id'=>$item['id']]); | ||
| 76 | + } | ||
| 77 | + if($item['id'] > $id){ | ||
| 78 | + $id = $item['id']; | ||
| 79 | + } | ||
| 69 | } | 80 | } | 
| 81 | + $this->move($fid); | ||
| 70 | } | 82 | } | 
| 71 | 83 | ||
| 72 | - return $id; | ||
| 73 | 84 | ||
| 74 | } | 85 | } | 
| 75 | 86 | 
- 
请 注册 或 登录 后发表评论