|
|
|
<?php
|
|
|
|
|
|
|
|
include_once "../vendor/autoload.php";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 把lists表的is_hots字段为1的记录插入到list_hot表中 并删除list表中的这些记录
|
|
|
|
*/
|
|
|
|
|
|
|
|
// 一个月以前的数据
|
|
|
|
$one_month_ago = strtotime(date('Y-m-d', strtotime('-1 month')));
|
|
|
|
|
|
|
|
// 查询lists lists_hot
|
|
|
|
$id = 0;
|
|
|
|
while (true){
|
|
|
|
$data = db()->first("select * from lists where id > {$id} and `is_hots` = 1 and `udate` < {$one_month_ago}");
|
|
|
|
if($data){
|
|
|
|
$id = $data['id'];
|
|
|
|
db()->insert('list_hot', $data);
|
|
|
|
db()->delete('lists', ['id' => $data['id']]);
|
|
|
|
echo $id . " ok \n";
|
|
|
|
break;
|
|
|
|
}else{
|
|
|
|
sleep(5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|