Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
function maketypeall()
{
    global $flag, $makeinterval, $psize, $cache;
    $num = be("get", "num");
    if ($flag == "art") {
        $typearr = $cache[1];
    } else {
        $typearr = $cache[0];
    }
    $typearrconunt = count($typearr);
    if (isN($num)) {
        $num = 0;
    } else {
        if (intval($num) >= intval($typearrconunt)) {
            alertUrl("所有分类生成完毕", "admin_makehtml.php");
        }
    }
    $typeid = trim($typearr[$num]["t_id"]);
    maketypebyid($typeid);
    echo "<br>暂停" . $makeinterval . "秒后继续生成<script language=\"javascript\">setTimeout(\"makeNexttype();\"," . $makeinterval . "000);function makeNexttype(){location.href='?action=typeall&flag=" . $flag . "&num=" . ($num + 1) . "&psize=" . $psize . "';}</script>";
}