正在显示
1 个修改的文件
包含
8 行增加
和
4 行删除
| @@ -10,15 +10,19 @@ include_once "../vendor/autoload.php"; | @@ -10,15 +10,19 @@ include_once "../vendor/autoload.php"; | ||
| 10 | $one_month_ago = strtotime(date('Y-m-d', strtotime('-1 month'))); | 10 | $one_month_ago = strtotime(date('Y-m-d', strtotime('-1 month'))); |
| 11 | 11 | ||
| 12 | // 查询lists lists_hot | 12 | // 查询lists lists_hot |
| 13 | -$id = 0; | 13 | +$id = 389884523; |
| 14 | while (true){ | 14 | while (true){ |
| 15 | - $data = db()->first("select * from lists where id > {$id} and `is_hots` = 1 and `udate` < {$one_month_ago}"); | 15 | + $data = db()->first("select * from lists where id > {$id} and `is_hots` = 1 and `udate` < {$one_month_ago} limit 1;"); |
| 16 | if($data){ | 16 | if($data){ |
| 17 | $id = $data['id']; | 17 | $id = $data['id']; |
| 18 | - db()->insert('list_hot', $data); | 18 | + try { |
| 19 | + db()->throw()->insert('lists_hot', $data); | ||
| 20 | + } catch (\Exception $e) { | ||
| 21 | + @file_put_contents('lists_to_lists_hot.data.error.log', json_encode($data)."\n", FILE_APPEND); | ||
| 22 | + } | ||
| 19 | db()->delete('lists', ['id' => $data['id']]); | 23 | db()->delete('lists', ['id' => $data['id']]); |
| 20 | echo $id . " ok \n"; | 24 | echo $id . " ok \n"; |
| 21 | - break; | 25 | +// break; |
| 22 | }else{ | 26 | }else{ |
| 23 | sleep(5); | 27 | sleep(5); |
| 24 | } | 28 | } |
-
请 注册 或 登录 后发表评论