正在显示
1 个修改的文件
包含
14 行增加
和
11 行删除
@@ -63,18 +63,21 @@ class HotMailArchive { | @@ -63,18 +63,21 @@ class HotMailArchive { | ||
63 | _echo('正在移动 '.$fid); | 63 | _echo('正在移动 '.$fid); |
64 | $list = $this->db->all(\Model\listsSql::first(dbWhere(['folder_id'=>$fid,'is_hots'=>1])).'000'); | 64 | $list = $this->db->all(\Model\listsSql::first(dbWhere(['folder_id'=>$fid,'is_hots'=>1])).'000'); |
65 | if($list){ | 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); | 66 | + $this->db->transaction(function () use ($list){ |
67 | + foreach ($list as $item){ | ||
68 | + try { | ||
69 | + $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
70 | + }catch (Throwable $e){ | ||
71 | + $this->db->delete('lists_hot',['id'=>$item['id']]); | ||
72 | + unset($item['updated_at']); | ||
73 | + $ret = $this->db->throw()->insert('lists_hot',$item,false); | ||
74 | + } | ||
75 | + if($ret){ | ||
76 | + $this->db->delete(listsSql::$table,['id'=>$item['id']]); | ||
77 | + } | ||
73 | } | 78 | } |
74 | - if($ret){ | ||
75 | - $this->db->delete(listsSql::$table,['id'=>$item['id']]); | ||
76 | - } | ||
77 | - } | 79 | + }); |
80 | + | ||
78 | $this->move($fid); | 81 | $this->move($fid); |
79 | } | 82 | } |
80 | 83 |
-
请 注册 或 登录 后发表评论