当前位置: 首页>>代码示例>>PHP>>正文


PHP build_uri函数代码示例

本文整理汇总了PHP中build_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP build_uri函数的具体用法?PHP build_uri怎么用?PHP build_uri使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了build_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: brand_get_goodsex

function brand_get_goodsex($brand_id, $cate, $size, $page, $sort, $order)
{
    $cate_where = $cate > 0 ? 'AND ' . get_children($cate) : '';
    /* 获得商品列表 */
    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_sn, g.market_price, g.shop_price AS org_price, g.is_new,' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . '(select AVG(r.comment_rank) from ' . $GLOBALS['ecs']->table('comment') . ' as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, ' . '(select IFNULL(sum(og.goods_number), 0) from ' . $GLOBALS['ecs']->table('order_goods') . ' as og where og.goods_id = g.goods_id) AS sell_number, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '{$brand_id}' {$cate_where}" . "ORDER BY {$sort} {$order}";
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
        if ($GLOBALS['display'] == 'grid') {
            $arr[$row['goods_id']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        }
        $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
        $arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];
        $arr[$row['goods_id']]['comment_rank'] = $row['comment_rank'];
        $arr[$row['goods_id']]['sell_number'] = $row['sell_number'];
        $arr[$row['goods_id']]['is_new'] = $row['is_new'];
        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
        $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
        $arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
        $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
    }
    return $arr;
}
开发者ID:qgz,项目名称:ecshop,代码行数:32,代码来源:brand.php

示例2: setSomeGoodsValue

function setSomeGoodsValue(&$goods, $dsct)
{
    $dsct['discountVal'] = floatval($dsct['discountVal']);
    if ($dsct['discountType'] == 2) {
        if ($dsct['discountVal'] > 100 || $dsct['discountVal'] < 0) {
            $dsct['discountVal'] = 100;
        }
    }
    foreach ($goods as $k => $v) {
        $goods[$k]['url'] = build_uri('goods', array('gid' => $goods[$k]['goods_id']), $goods[$k]['goods_name']);
        switch ($dsct['discountType']) {
            case 1:
                //现金减免
                $goods[$k]['discountPrice'] = $goods[$k]['market_price'] - $dsct['discountVal'] > 0 ? $goods[$k]['market_price'] - $dsct['discountVal'] : 0;
                break;
            case 2:
                //打折
                $goods[$k]['discountPrice'] = $goods[$k]['market_price'] * $dsct['discountVal'] / 100.0;
                break;
        }
        $goods[$k]['shop_price'] = price_format($goods[$k]['shop_price']);
        $goods[$k]['market_price'] = price_format($goods[$k]['market_price']);
        $goods[$k]['discountPrice'] = price_format($goods[$k]['discountPrice']);
    }
}
开发者ID:norain2050,项目名称:benhu,代码行数:25,代码来源:newyear.php

示例3: brand_get_goodsex

function brand_get_goodsex($brand_id, $cate, $size, $page, $sort, $order)
{
    $cate_where = 0 < $cate ? "AND " . get_children($cate) : "";
    $sql = "SELECT g.goods_id, g.goods_name, g.goods_sn, g.market_price, g.shop_price AS org_price,g.is_promote, g.is_new, g.is_best, g.is_hot," . ("IFNULL(mp.user_price, g.shop_price * '" . $_SESSION['discount'] . "') AS shop_price, g.promote_price, ") . "(select AVG(r.comment_rank) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, (select IFNULL(sum(r.id_value), 0) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_count, (select IFNULL(sum(og.goods_number), 0) from " . $GLOBALS['ecs']->table("order_goods") . " as og where og.goods_id = g.goods_id) AS sell_number, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img FROM " . $GLOBALS['ecs']->table("goods") . " AS g LEFT JOIN " . $GLOBALS['ecs']->table("member_price") . " AS mp " . ("ON mp.goods_id = g.goods_id AND mp.user_rank = '" . $_SESSION['user_rank'] . "' ") . ("WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '" . $brand_id . "' {$cate_where}") . ("ORDER BY " . $sort . " {$order}");
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        if (0 < $row['promote_price']) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
        if ($GLOBALS['display'] == "grid") {
            $arr[$row['goods_id']]['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        }
        $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
        $arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];
        $arr[$row['goods_id']]['comment_count'] = $row['comment_count'];
        $arr[$row['goods_id']]['comment_rank'] = $row['comment_rank'];
        $arr[$row['goods_id']]['sell_number'] = $row['sell_number'];
        $arr[$row['goods_id']]['is_promote'] = $row['is_promote'];
        $arr[$row['goods_id']]['is_new'] = $row['is_new'];
        $arr[$row['goods_id']]['is_best'] = $row['is_best'];
        $arr[$row['goods_id']]['is_hot'] = $row['is_hot'];
        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
        $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
        $arr[$row['goods_id']]['promote_price'] = 0 < $promote_price ? price_format($promote_price) : "";
        $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
        $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], TRUE);
        $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $arr[$row['goods_id']]['url'] = build_uri("goods", array("gid" => $row['goods_id']), $row['goods_name']);
    }
    return $arr;
}
开发者ID:firsteam,项目名称:falcons,代码行数:35,代码来源:brand.php

示例4: get_cat_articles

/**
 * 获得文章分类下的文章列表
 *
 * @access  public
 * @param   integer     $cat_id
 * @param   integer     $page
 * @param   integer     $size
 *
 * @return  array
 */
function get_cat_articles($cat_id, $page = 1, $size = 20, $requirement = '')
{
    //取出所有非0的文章
    if ($cat_id == '-1') {
        $cat_str = 'cat_id > 0';
    } else {
        $cat_str = get_article_children($cat_id);
    }
    //增加搜索条件,如果有搜索内容就进行搜索
    if ($requirement != '') {
        $sql = 'SELECT article_id, title, author, add_time, file_url, open_type' . ' FROM ' . $GLOBALS['ecs']->table('ecsmart_article') . ' WHERE is_open = 1 AND title like \'%' . $requirement . '%\' ' . ' ORDER BY article_type DESC, article_id DESC';
    } else {
        $sql = 'SELECT article_id, title, author, add_time, file_url, open_type' . ' FROM ' . $GLOBALS['ecs']->table('ecsmart_article') . ' WHERE is_open = 1 AND ' . $cat_str . ' ORDER BY article_type DESC, article_id DESC';
    }
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    if ($res) {
        while ($row = $GLOBALS['db']->fetchRow($res)) {
            $article_id = $row['article_id'];
            $arr[$article_id]['id'] = $article_id;
            $arr[$article_id]['title'] = $row['title'];
            $arr[$article_id]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
            $arr[$article_id]['author'] = empty($row['author']) || $row['author'] == '_SHOPHELP' ? $GLOBALS['_CFG']['shop_name'] : $row['author'];
            $arr[$article_id]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $article_id), $row['title']) : trim($row['file_url']);
            $arr[$article_id]['add_time'] = date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        }
    }
    return $arr;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:39,代码来源:lib_article.php

示例5: get_index_best

/**
 * 获得推荐商品
 *
 * @access  public
 * @param   string      $type       推荐类型,可以是 best, new, hot
 * @return  array
 */
function get_index_best($limit = '')
{
    $time = gmtime();
    //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
    $sql = 'SELECT g.goods_id, g.goods_name,g.click_count, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' ";
    $sql .= ' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = "best" ';
    $sql .= ' ORDER BY g.sort_order, g.last_update DESC';
    $sql .= " {$limit}";
    $result = $GLOBALS['db']->getAll($sql);
    foreach ($result as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['thumb'] = '../' . get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = '../' . get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $goods[$idx]['sell_count'] = selled_count($row['goods_id']);
        $goods[$idx]['pinglun'] = get_evaluation_sum($row['goods_id']);
        $goods[$idx]['count'] = selled_count($row['goods_id']);
        $goods[$idx]['click_count'] = $row['click_count'];
    }
    return $goods;
}
开发者ID:firsteam,项目名称:falcons,代码行数:42,代码来源:index_bestgoods.php

示例6: insert_cart_info

/**
 * 调用购物车信息
 *
 * @access  public
 * @return  string
 */
function insert_cart_info()
{
    $sql = 'SELECT c.*,g.goods_name,g.goods_thumb,g.goods_id,c.goods_number,c.goods_price' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " AS c " . " LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.goods_id=c.goods_id " . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
    $row = $GLOBALS['db']->GetAll($sql);
    $arr = array();
    foreach ($row as $k => $v) {
        $arr[$k]['goods_thumb'] = get_image_path($v['goods_id'], $v['goods_thumb'], true);
        $arr[$k]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($v['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $v['goods_name'];
        $arr[$k]['url'] = build_uri('goods', array('gid' => $v['goods_id']), $v['goods_name']);
        $arr[$k]['goods_number'] = $v['goods_number'];
        $arr[$k]['goods_name'] = $v['goods_name'];
        $arr[$k]['goods_price'] = price_format($v['goods_price']);
        $arr[$k]['rec_id'] = $v['rec_id'];
    }
    $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
    $row = $GLOBALS['db']->GetRow($sql);
    if ($row) {
        $number = intval($row['number']);
        $amount = floatval($row['amount']);
    } else {
        $number = 0;
        $amount = 0;
    }
    $GLOBALS['smarty']->assign('str', sprintf($GLOBALS['_LANG']['cart_info'], $number, price_format($amount, false)));
    $GLOBALS['smarty']->assign('goods', $arr);
    $output = $GLOBALS['smarty']->fetch('library/cart_info.lbi');
    return $output;
}
开发者ID:a494008974,项目名称:bzbshop,代码行数:34,代码来源:lib_insert.php

示例7: get_snatch

 /**
  * 取得当前活动信息
  *
  * @access  public
  *
  * @return 活动名称
  */
 function get_snatch($id)
 {
     $sql = "SELECT g.goods_id, g.goods_sn, g.is_real, g.goods_name, g.extension_code, g.market_price, g.shop_price AS org_price, product_id, " . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb,g.goods_img, " . "ga.act_name AS snatch_name, ga.start_time, ga.end_time, ga.ext_info, ga.act_desc AS `desc` " . "FROM " . $this->pre . "goods_activity AS ga " . "LEFT JOIN " . $this->pre . "goods AS g " . "ON g.goods_id = ga.goods_id " . "LEFT JOIN " . $this->pre . "member_price AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE ga.act_id = '{$id}' AND g.is_delete = 0";
     $goods = $this->row($sql);
     if ($goods) {
         $promote_price = bargain_price($goods['promote_price'], $goods['promote_start_date'], $goods['promote_end_date']);
         $goods['formated_market_price'] = price_format($goods['market_price']);
         $goods['formated_shop_price'] = price_format($goods['shop_price']);
         $goods['formated_promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
         $goods['goods_thumb'] = get_image_path($goods['goods_id'], $goods['goods_thumb'], true);
         $goods['goods_img'] = get_image_path($goods['goods_id'], $goods['goods_img'], true);
         $goods['url'] = build_uri('goods', array('gid' => $goods['goods_id']), $goods['goods_name']);
         $goods['start_time'] = local_date(C('time_format'), $goods['start_time']);
         $info = unserialize($goods['ext_info']);
         if ($info) {
             foreach ($info as $key => $val) {
                 $goods[$key] = $val;
             }
             $goods['is_end'] = gmtime() > $goods['end_time'];
             $goods['formated_start_price'] = price_format($goods['start_price']);
             $goods['formated_end_price'] = price_format($goods['end_price']);
             $goods['formated_max_price'] = price_format($goods['max_price']);
         }
         /* 将结束日期格式化为格林威治标准时间时间戳 */
         $goods['gmt_end_time'] = $goods['end_time'];
         $goods['end_time'] = local_date(C('time_format'), $goods['end_time']);
         $goods['snatch_time'] = sprintf(L('snatch_start_time'), $goods['start_time'], $goods['end_time']);
         return $goods;
     } else {
         return false;
     }
 }
开发者ID:m7720647,项目名称:demo,代码行数:39,代码来源:SnatchModel.class.php

示例8: insert_history

/**
 * 调用浏览历史
 *
 * @access  public
 * @return  string
 */
function insert_history()
{
    $time = gmtime();
    $str = '';
    if (!empty($_COOKIE['ECS']['history'])) {
        $where = db_create_in($_COOKIE['ECS']['history'], 'goods_id');
        $sql = 'SELECT goods_id, goods_name, goods_thumb, shop_price ,promote_price,promote_start_date,promote_end_date,is_promote FROM ' . $GLOBALS['ecs']->table('goods') . " WHERE {$where} AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0";
        $query = $GLOBALS['db']->query($sql);
        $res = array();
        while ($row = $GLOBALS['db']->fetch_array($query)) {
            $goods['goods_id'] = $row['goods_id'];
            $goods['goods_name'] = $row['goods_name'];
            $goods['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
            $goods['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
            if ($row['is_promote'] == 1 && $time > $row['promote_start_date'] && $time < $row['promote_end_date']) {
                $goods['shop_price'] = price_format($row['promote_price']);
            } else {
                $goods['shop_price'] = price_format($row['shop_price']);
            }
            $goods['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
            $str .= '<ul class="clearfix"><li class="goodsimg"><a href="' . $goods['url'] . '" target="_blank"><img src="' . $goods['goods_thumb'] . '" alt="' . $goods['goods_name'] . '" class="B_blue" /></a></li><li><a href="' . $goods['url'] . '" target="_blank" title="' . $goods['goods_name'] . '">' . $goods['short_name'] . '</a><br />' . $GLOBALS['_LANG']['shop_price'] . '<font class="f1">' . $goods['shop_price'] . '</font><br /></li></ul>';
        }
        $str .= '<ul id="clear_history"><a onclick="clear_history()">' . $GLOBALS['_LANG']['clear_history'] . '</a></ul>';
    }
    return $str;
}
开发者ID:hackjiyi,项目名称:maozishifa,代码行数:32,代码来源:lib_insert.php

示例9: get_child

function get_child($cat_id)
{
    $sql = 'SELECT cat_id,cat_name ,parent_id ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$cat_id}' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC";
    $res = $GLOBALS['db']->getAll($sql);
    foreach ($res as $idx => $row) {
        $array[$idx]['id'] = $row['cat_id'];
        $array[$idx]['name'] = $row['cat_name'];
        $array[$idx]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
    }
    return $array;
}
开发者ID:muqidi,项目名称:PHP,代码行数:11,代码来源:get.php

示例10: get_shop_help

 /**
  * 分配帮助信息
  *
  * @access  public
  * @return  array
  */
 function get_shop_help()
 {
     $sql = 'SELECT c.cat_id, c.cat_name, c.sort_order, a.article_id, a.title, a.file_url, a.open_type ' . 'FROM ' . $this->pre . 'article AS a ' . 'LEFT JOIN ' . $this->pre . 'article_cat AS c ' . 'ON a.cat_id = c.cat_id WHERE c.cat_type = 5 AND a.is_open = 1 ' . 'ORDER BY c.sort_order ASC, a.article_id';
     $res = $this->query($sql);
     $arr = array();
     foreach ($res as $key => $row) {
         $arr[$row['cat_id']]['cat_id'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']);
         $arr[$row['cat_id']]['cat_name'] = $row['cat_name'];
         $arr[$row['cat_id']]['article'][$key]['article_id'] = $row['article_id'];
         $arr[$row['cat_id']]['article'][$key]['title'] = $row['title'];
         $arr[$row['cat_id']]['article'][$key]['short_title'] = C('article_title_length') > 0 ? sub_str($row['title'], C('article_title_length')) : $row['title'];
         $arr[$row['cat_id']]['article'][$key]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']);
     }
     return $arr;
 }
开发者ID:m7720647,项目名称:demo,代码行数:21,代码来源:ArticleModel.class.php

示例11: get_clild_list

function get_clild_list($pid)
{
    //开始获取子分类
    $sql_sub = "select * from " . $GLOBALS['ecs']->table('category') . " where parent_id=" . $pid . " and is_show=1";
    $subres = $GLOBALS['db']->getAll($sql_sub);
    if ($subres) {
        foreach ($subres as $sidx => $subrow) {
            $children[$sidx]['id'] = $subrow['cat_id'];
            $children[$sidx]['name'] = $subrow['cat_name'];
            $children[$sidx]['url'] = build_uri('category', array('cid' => $subrow['cat_id']), $subrow['cat_name']);
        }
    } else {
        $children = null;
    }
    return $children;
}
开发者ID:a494008974,项目名称:bzbshop,代码行数:16,代码来源:util.php

示例12: get_user_info

 /**
  * 获取用户信息
  */
 public function get_user_info()
 {
     $callback = $this->input->get('callback');
     if (!is_login()) {
         exit($callback . "(" . json_encode(array('is_login' => 0)) . ")");
     } else {
         $data = current_user();
         $info['user_id'] = $data['uid'];
         $info['nickname'] = $data['username'];
         $info['img_url'] = $this->config->item('img3_url') . avatar($data['uid']);
         $info['profile_url'] = $this->config->item('q_url') . build_uri('u', array('id' => $data['uid']));
         $str = 'img_url=' . $info['img_url'] . '&nickname=' . $info['nickname'] . '&profile_url=' . $info['profile_url'] . '&user_id=' . $info['user_id'];
         $info['user']['sign'] = $this->get_signature($str, '4f7b47c758a7e071f0225035c44cd5a4');
         exit($callback . "(" . json_encode(array('is_login' => 1, 'user' => $info)) . ")");
     }
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:19,代码来源:cy.php

示例13: get_flash_sale_goods

/**
 * 获得促销商品
 *
 * @access  public
 * @return  array
 */
function get_flash_sale_goods($cats = '')
{
    $time = gmtime();
    $order_type = $GLOBALS['_CFG']['recommend_order'];
    /* 取得促销lbi的数量限制 */
    $num = get_library_number("recommend_promotion");
    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' . " AND g.is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' ";
    $sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY rnd';
    $result = $GLOBALS['db']->getAll($sql);
    $goods = array();
    foreach ($result as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? $promote_price : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $sql = 'SELECT sum(goods_number) AS goods_number FROM ' . $GLOBALS['ecs']->table('order_goods') . ' WHERE goods_id =' . $row['goods_id'] . ' GROUP BY goods_id';
        $goods_number = $GLOBALS['db']->getOne($sql);
        if (empty($goods_number)) {
            $goods_number = 0;
        }
        if (!empty($row['promote_end_date'])) {
            $goods[$idx]['end_date'] = $row['promote_end_date'];
        }
        $goods[$idx]['soldnum'] = get_soldnum($row['goods_id']);
        $goods[$idx]['jiesheng'] = $row['market_price'] - $row['promote_price'];
        $goods[$idx]['zhekou'] = sprintf("%1\$.1f", $row['promote_price'] / $row['shop_price'] * 10);
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['number'] = $goods_number;
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = $row['brand_name'];
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = $row['market_price'];
        $goods[$idx]['shop_price'] = $row['shop_price'];
        $goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $properties = get_goods_properties($row['goods_id']);
        // 获得商品的规格和属性
        $goods[$idx]['pro'] = $properties['pro']['商品属性'];
    }
    return $goods;
}
开发者ID:muqidi,项目名称:PHP,代码行数:53,代码来源:flash_sale.php

示例14: wholesale_list

 /**
  * 取得某页的批发商品
  * @param   int $size 每页记录数
  * @param   int $page 当前页
  * @param   string $where 查询条件
  * @return  array
  */
 function wholesale_list($size, $page, $where)
 {
     $list = array();
     $sql = "SELECT w.*, g.goods_thumb, g.goods_name as goods_name, g.shop_price, g.market_price " . "FROM " . $this->pre . "wholesale AS w, " . $this->pre . "goods AS g " . $where . " AND w.goods_id = g.goods_id limit " . ($page - 1) * $size . ',' . $size;
     $res = $this->query($sql);
     foreach ($res as $row) {
         $row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
         $row['goods_url'] = build_uri('info', array('id' => $row['goods_id']), $row['goods_name']);
         $properties = model('Goods')->get_goods_properties($row['goods_id']);
         $row['goods_attr'] = $properties['pro'];
         $price_ladder = $this->get_price_ladder($row['goods_id']);
         $row['price_ladder'] = $price_ladder;
         $row['low_price'] = empty($price_ladder) ? price_format($row['shop_price']) : price_format($this->get_low_price($price_ladder));
         $list[] = $row;
     }
     return $list;
 }
开发者ID:m7720647,项目名称:demo,代码行数:24,代码来源:WholesaleModel.class.php

示例15: queryListByCatId

function queryListByCatId($cat_id)
{
    $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name, a.content ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . " WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_id = {$cat_id}" . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT 2';
    $res = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($res as $idx => $row) {
        $arr[$idx]['id'] = $row['article_id'];
        $arr[$idx]['title'] = $row['title'];
        $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
        $arr[$idx]['cat_name'] = $row['cat_name'];
        $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']);
        $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']);
        $arr[$idx]['content'] = strip_tags($row['content']);
        $arr[$idx]['file_url'] = $row['file_url'];
    }
    return $arr;
}
开发者ID:flyindance,项目名称:jiayinobs,代码行数:18,代码来源:our.php


注:本文中的build_uri函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。