public function load($param)
 {
     $param = array("cate_id" => $param['cate_id']);
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $ids = $GLOBALS['cache']->get($key);
     if ($ids === false) {
         $param['cate_id'] = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal_cate where id = " . intval($param['cate_id'])));
         $key = $this->build_key(__CLASS__, $param);
         $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $ids = $GLOBALS['cache']->get($key);
         if ($ids !== false) {
             return $ids;
         }
         $cate_id = $param['cate_id'];
         $ids_util = new ChildIds("deal_cate");
         $ids = $ids_util->getChildIds($cate_id);
         $ids[] = $cate_id;
         //开始取出父分类ID
         $r_cate_id = $cate_id;
         while ($r_cate_id != 0) {
             $r_cate_id = $GLOBALS['db']->getOne("select pid from " . DB_PREFIX . "deal_cate where id = " . $r_cate_id);
             if ($r_cate_id != 0) {
                 $ids[] = $r_cate_id;
             }
         }
         $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['cache']->set($key, $ids);
     }
     return $ids;
 }
 public function load($param)
 {
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $ids = $GLOBALS['fcache']->get($key);
     if ($ids === false) {
         $cate_id = intval($param['cate_id']);
         $ids_util = new ChildIds("deal_cate");
         $ids = $ids_util->getChildIds($cate_id);
         $ids[] = $cate_id;
         $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['fcache']->set($key, $ids);
     }
     return $ids;
 }
Пример #3
0
 public function load($param)
 {
     $param = array();
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $help_list = $GLOBALS['cache']->get($key);
     if ($help_list === false) {
         $ids_util = new ChildIds("article_cate");
         $help_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "article_cate where type_id = 1 and is_delete = 0 and pid=0 order by sort desc limit " . intval(app_conf("HELP_CATE_LIMIT")));
         foreach ($help_list as $k => $v) {
             $ids = $GLOBALS['cache']->get("CACHE_HELP_ARTICLE_CATE_" . $v['id']);
             if ($ids === false) {
                 $ids = $ids_util->getChildIds($v['id']);
                 $ids[] = $v['id'];
                 $GLOBALS['cache']->set("CACHE_HELP_ARTICLE_CATE_" . $v['id'], $ids);
             }
             $help_cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "article where cate_id in (" . implode(",", $ids) . ") and is_delete = 0 order by sort desc limit " . intval(app_conf("HELP_ITEM_LIMIT")));
             foreach ($help_cate_list as $kk => $vv) {
                 if ($vv['rel_url'] != '') {
                     if (!preg_match("/http:\\/\\//i", $vv['rel_url'])) {
                         if (substr($vv['rel_url'], 0, 2) == 'u:') {
                             $help_cate_list[$kk]['url'] = parse_url_tag($vv['rel_url']);
                         } else {
                             $help_cate_list[$kk]['url'] = APP_ROOT . "/" . $vv['rel_url'];
                         }
                     } else {
                         $help_cate_list[$kk]['url'] = $vv['rel_url'];
                     }
                     $help_cate_list[$kk]['new'] = 1;
                 } else {
                     if ($vv['uname'] != '') {
                         $hurl = url("index", "help#" . $vv['uname']);
                     } else {
                         $hurl = url("index", "help#" . $vv['id']);
                     }
                     $help_cate_list[$kk]['url'] = $hurl;
                 }
             }
             $help_list[$k]['help_list'] = $help_cate_list;
         }
         $GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['cache']->set($key, $help_list);
     }
     return $help_list;
 }
Пример #4
0
     if ($promote_msg['type'] == 1) {
         //邮件
         $sql = "select u.id,u.email from " . DB_PREFIX . "user as u where u.email <> '' ";
         if ($group_id > 0) {
             $sql .= " and u.group_id = " . $group_id;
         }
         $sql .= " and u.id > " . $last_id . " order by u.id asc";
         $res = $GLOBALS['db']->getRow($sql);
         $dest = $res['email'];
         $last_id = $res['id'];
     }
     break;
 case 1:
     //订阅
     $city_id = intval($promote_msg['send_type_id']);
     $ids_util = new ChildIds("deal_city");
     $ids = $ids_util->getChildIds($city_id);
     $ids[] = $city_id;
     $ids_str = implode(",", $ids);
     if ($promote_msg['type'] == 0) {
         //短信
         $sql = "select id,mobile from " . DB_PREFIX . "mobile_list where mobile <> '' and is_effect = 1 ";
         if ($city_id > 0) {
             $sql .= " and city_id in(" . $ids_str . ") ";
         }
         $sql .= " and id > " . $last_id . " order by id asc";
         $res = $GLOBALS['db']->getRow($sql);
         $dest = $res['mobile'];
         $last_id = $res['id'];
     }
     if ($promote_msg['type'] == 1) {
Пример #5
0
function insert_load_sale_list($para)
{
    require_once APP_ROOT_PATH . "app/Lib/shop_init.php";
    $cate_id = intval($para['cate_id']);
    //输出销售排行
    //$sale_list = get_goods_list(intval(app_conf("SALE_LIST")),$cate_id,' buy_type <> 1 and is_shop = 1',' buy_count desc ',false);
    //=================
    $limit = intval(app_conf("SALE_LIST"));
    $where = " buy_type<>1 and is_shop = 1 ";
    $orderby = "buy_count desc";
    $time = get_gmtime();
    $time_condition = '  and (is_shop=1  or shop_cate_id <> 0 ) ';
    $sql = "select * from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 " . $time_condition;
    if ($cate_id > 0) {
        $ids = $GLOBALS['cache']->get("DEAL_SHOP_CATE_BELONE_IDS_" . $cate_id);
        if ($ids === false) {
            $ids_util = new ChildIds("shop_cate");
            $ids = $ids_util->getChildIds($cate_id);
            $ids[] = $cate_id;
            $GLOBALS['cache']->set("DEAL_SHOP_CATE_BELONE_IDS_" . $cate_id, $ids);
        }
        $sql .= " and shop_cate_id in (" . implode(",", $ids) . ")";
    }
    $city_id = intval($GLOBALS['deal_city']['id']);
    if ($city_id > 0) {
        $ids = $GLOBALS['cache']->get("DEAL_CITY_BELONE_IDS_" . $city_id);
        if ($ids === false) {
            $ids_util = new ChildIds("deal_city");
            $ids = $ids_util->getChildIds($city_id);
            $ids[] = $city_id;
            //开始取出父地区ID
            $r_city_id = $city_id;
            while ($r_city_id != 0) {
                $r_city_id = $GLOBALS['db']->getOne("select pid from " . DB_PREFIX . "deal_city where id = " . $r_city_id);
                if ($r_city_id != 0) {
                    $ids[] = $r_city_id;
                }
            }
            $GLOBALS['cache']->set("DEAL_CITY_BELONE_IDS_" . $city_id, $ids);
        }
        $sql .= " and city_id in (" . implode(",", $ids) . ")";
    }
    if ($where != '') {
        $sql .= " and " . $where;
    }
    if ($orderby == '') {
        $sql .= " order by sort desc limit " . $limit;
    } else {
        $sql .= " order by " . $orderby . " limit " . $limit;
    }
    $deals = $GLOBALS['db']->getAll($sql);
    if ($deals) {
        foreach ($deals as $k => $deal) {
            if ($deal['buy_type'] == 1) {
                $module = "exchange";
            } else {
                $module = "goods";
            }
            if ($deal['uname'] != '') {
                $durl = url("shop", $module, array("id" => $deal['uname']));
            } else {
                $durl = url("shop", $module, array("id" => $deal['id']));
            }
            $deal['url'] = $durl;
            $deals[$k] = $deal;
        }
    }
    $sale_list['list'] = $deals;
    //==============
    $GLOBALS['tmpl']->assign("sale_list", array('title' => $GLOBALS['lang']['SALE_LIST'], 'list' => $sale_list['list'], 'url' => url("shop", 'rec#rsale')));
    return $GLOBALS['tmpl']->fetch("inc/insert/load_sale_list.html");
}