function makeviewday() { global $action2, $flag, $sql, $stime, $makeinterval, $db, $cache; $macpage = be("get", "page"); $num = be("get", "num"); if (isN($num)) { $num = 0; } else { $num = intval($num); } if ($flag == "art") { $where = " and STR_TO_DATE(a_time,'%Y-%m-%d')='" . date("Y-m-d") . "'"; } else { $where = " and STR_TO_DATE(d_time,'%Y-%m-%d')='" . date("Y-m-d") . "'"; } $sql = $sql . $where; $sql1 = "SELECT DISTINCT d_type FROM {pre}vod WHERE 1=1 " . $where; $nums = $db->getOne($sql1 . $where); $pcount = ceil($nums / 100); if (isN($macpage)) { $macpage = 1; } else { $macpage = intval($macpage); } if ($nums == 0) { echo "今天没有更新数据"; exit; } // $rs = $db->query($sql); while ($row = $db->fetch_array($rs)) { if ($flag == "art") { $id = $row["a_type"]; $typearr = getValueByArray($cache[1], "t_id", $row["a_type"]); } else { $id = $row["d_type"]; $typearr = getValueByArray($cache[0], "t_id", $row["d_type"]); } if (strpos($ids, "," . $id . ",") <= 0) { $ids = $ids . $id . ","; } makeviewbyrs($row, $typearr); } unset($rs); echo "ok恭喜今日数据搞定"; $idsarr = explode(",", $ids); for ($i = 0; $i < count($idsarr); $i++) { if (!isN($idsarr[$i])) { maketypebyid($idsarr[$i]); } } echo "ok恭喜今日分类搞定"; makeotherday(); }
function makeviewday() { global $action, $action2, $flag, $sql, $sql1, $stime, $makeinterval, $db, $cache; $macpage = be("get", "page"); $num = be("get", "num"); if (isN($num)) { $num = 0; } else { $num = intval($num); } if ($flag == "art") { $sql2 = "SELECT DISTINCT a_type FROM {pre}art WHERE 1=1 "; //$where = " and STR_TO_DATE(a_time,'%Y-%m-%d')='".date("Y-m-d")."'"; $where = " and to_days(a_time) = to_days(now())"; } else { $sql2 = "SELECT DISTINCT d_type FROM {pre}vod WHERE 1=1 "; //$where = " and STR_TO_DATE(d_time,'%Y-%m-%d')='".date("Y-m-d")."'"; $where = " and to_days(d_time) = to_days(now())"; } $sql = $sql . $where; $nums = $db->getOne($sql1 . $where); $pcount = ceil($nums / 100); if (isN($macpage)) { $macpage = 1; } else { $macpage = intval($macpage); } if ($nums == 0) { echo "<font color='red'>今天没有更新数据</font><br>"; return; } $sql = $sql . " limit " . 100 * ($macpage - 1) . ",100"; $rs = $db->query($sql); echo "正在开始生成<font color='red'>今日数据</font>的内容页,当前是第<font color='red'>" . $macpage . "</font>页,共<font color='red'>" . $pcount . "</font>页<br>"; while ($row = $db->fetch_array($rs)) { if ($flag == "art") { $typearr = getValueByArray($cache[1], "t_id", $row["a_type"]); } else { $typearr = getValueByArray($cache[0], "t_id", $row["d_type"]); } makeviewbyrs($row, $typearr); } unset($rs); if ($macpage == $pcount || $nums < 100) { echo "<font color='red'>恭喜今日数据搞定</font>"; maketypeday($sql2 . $where); return; } echo "页面生成时间: " . (execTime() - $stime) . "秒 <br>暂停" . $makeinterval . "秒后继续生成<script language=\"javascript\">setTimeout(\"makeNextPage();\"," . $makeinterval . "000);function makeNextPage(){location.href='?action=viewday&page=" . ($macpage + 1) . "&action2=" . $action2 . "&num=" . $num . "&flag=" . $flag . "';}</script>"; }