作者 邓超

预热脚本移入

  1 +<?php
  2 +
  3 +include_once "../vendor/autoload.php";
  4 +
  5 +/**
  6 + * 把lists表的is_hots字段为1的记录插入到list_hot表中 并删除list表中的这些记录
  7 + */
  8 +
  9 +// 一个月以前的数据
  10 +$one_month_ago = strtotime(date('Y-m-d', strtotime('-1 month')));
  11 +
  12 +// 查询lists lists_hot
  13 +$id = 0;
  14 +while (true){
  15 + $data = db()->first("select * from lists where id > {$id} and `is_hots` = 1 and `udate` < {$one_month_ago}");
  16 + if($data){
  17 + $id = $data['id'];
  18 + db()->insert('list_hot', $data);
  19 + db()->delete('lists', ['id' => $data['id']]);
  20 + echo $id . " ok \n";
  21 + break;
  22 + }else{
  23 + sleep(5);
  24 + }
  25 +}
  26 +
  27 +
  28 +
  29 +
  30 +