예제 #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();
}
예제 #2
0
function maketype()
{
    global $action, $action2, $makeinterval, $psize, $flag;
    $typeids = be("arr", "mtype");
    $num = be("get", "num");
    if (isN($typeids)) {
        $typeids = be("get", "mtype");
    }
    if (isN($typeids) || $typeids == "0") {
        alertUrl("请选择分类...", "admin_makehtml.php");
    }
    $typearr = explode(",", $typeids);
    $typearrconunt = count($typearr);
    if (isN($num)) {
        $num = 0;
    } else {
        if (intval($num) >= intval($typearrconunt)) {
            if ($action2 == "day") {
                echo "<br>准备生成首页、地图页、XML数据,请稍候...<br>";
                makeotherday();
            } else {
                alertUrl("所选分类生成完毕", "admin_makehtml.php");
            }
        }
    }
    $typeid = trim($typearr[$num]);
    unset($typearr);
    maketypebyid($typeid);
    echo "<br>暂停" . $makeinterval . "秒后继续生成<script language=\"javascript\">setTimeout(\"makeNexttype();\"," . $makeinterval . "000);function makeNexttype(){location.href='?action=type&mtype=" . $typeids . "&flag=" . $flag . "&num=" . ($num + 1) . "&psize=" . $psize . "&action2=" . $action2 . "';}</script>";
}