本文整理汇总了PHP中get_image_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_image_path函数的具体用法?PHP get_image_path怎么用?PHP get_image_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_image_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show
/**
* 获取数据
*/
public function show($fromusername, $info)
{
$articles = array();
$data = model('base')->model->table('goods')->field('goods_id, goods_name, goods_img')->where('is_on_sale = 1 and is_delete = 0 and goods_name like "%' . $info['user_keywords'] . '%"')->order('last_update desc')->limit(4)->select();
if (!empty($data)) {
$articles['type'] = 'news';
foreach ($data as $key => $val) {
// 不是远程图片
if (!preg_match('/(http:|https:)/is', $val['goods_img'])) {
$articles['content'][$key]['PicUrl'] = get_image_path('', $val['goods_img']);
} else {
$articles['content'][$key]['PicUrl'] = $val['goods_img'];
}
$articles['content'][$key]['Title'] = $val['goods_name'];
$articles['content'][$key]['Url'] = __HOST__ . url('goods/index', array('id' => $val['goods_id']));
}
} else {
$goods = model('Base')->model->table('goods')->field('goods_id, goods_name')->where('is_best = 1 and is_on_sale = 1 and is_delete = 0')->order('RAND()')->find();
$goods_url = __HOST__ . url('goods/index', array('id' => $goods['goods_id']));
$articles['type'] = 'text';
$articles['content'] = '没有搜索到相关商品,我们为您推荐:<a href="' . $goods_url . '" >' . $goods['goods_name'] . '</a>';
}
// 积分赠送
$this->give_point($fromusername, $info);
return $articles;
}
开发者ID:noikiy,项目名称:shop-3,代码行数:29,代码来源:recommend.class.php
示例2: get_collection_goods
/**
* 获取指定用户的收藏商品列表
* @access public
* @param int $user_id 用户ID
* @param int $num 列表最大数量
* @param int $start 列表其实位置
* @return array $arr
*/
public function get_collection_goods($user_id, $num = 10, $start = 0)
{
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'g.promote_price, g.promote_start_date,g.promote_end_date, c.rec_id, c.is_attention' . ' FROM ' . $this->pre . 'collect_goods AS c' . ' LEFT JOIN ' . $this->pre . 'goods AS g ' . 'ON g.goods_id = c.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 c.user_id = '{$user_id}' ORDER BY c.rec_id DESC limit {$start}, {$num}";
$res = $this->query($sql);
$goods_list = array();
if (is_array($res)) {
foreach ($res as $row) {
if ($row['promote_price'] > 0) {
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
} else {
$promote_price = 0;
}
$goods_list[$row['goods_id']]['rec_id'] = $row['rec_id'];
$goods_list[$row['goods_id']]['is_attention'] = $row['is_attention'];
$goods_list[$row['goods_id']]['goods_id'] = $row['goods_id'];
$goods_list[$row['goods_id']]['goods_name'] = $row['goods_name'];
$goods_list[$row['goods_id']]['goods_thumb'] = get_image_path(0, $row['goods_thumb']);
$goods_list[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$goods_list[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$goods_list[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
$goods_list[$row['goods_id']]['url'] = url('goods/index', array('id' => $row['goods_id']));
}
}
return $goods_list;
}
开发者ID:ChanHarold,项目名称:ecshop,代码行数:33,代码来源:ClipsBaseModel.class.php
示例3: get_goodslist
function get_goodslist($cat_id = 0)
{
$where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_team=1 ";
if ($cat_id > 0) {
$where .= "AND g.cat_id = " . $cat_id;
}
$sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.goods_name_style, g.little_img, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img,g.little_img ' . ' ,g.team_num,g.team_price ' . 'FROM ' . $GLOBALS['hhs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['hhs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE {$where} ORDER BY g.sort_order, g.goods_id";
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res as $idx => $row) {
$arr[$idx]['goods_name'] = $row['goods_name'];
$arr[$idx]['goods_brief'] = $row['goods_brief'];
$arr[$idx]['goods_number'] = $row['goods_number'];
$arr[$idx]['market_price'] = price_format($row['market_price'], false);
$arr[$idx]['shop_price'] = price_format($row['shop_price'], false);
$arr[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$idx]['little_img'] = get_image_path($row['goods_id'], $row['little_img'], true);
$arr[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$idx]['url'] = "tgoods.php?id=" . $row['goods_id'];
//build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
$arr[$idx]['team_num'] = $row['team_num'];
$arr[$idx]['team_price'] = price_format($row['team_price'], false);
//echo $arr[$idx]['url'];exit();
$arr[$idx]['team_discount'] = number_format($row['team_price'] / $row['shop_price'] * 10, 1);
}
return $arr;
}
开发者ID:shiruolin,项目名称:hzzshop,代码行数:27,代码来源:group.php
示例4: get_collection_goods
/**
* 获取指定用户的收藏商品列表
*
* @access public
* @param int $user_id 用户ID
* @param int $num 列表最大数量
* @param int $start 列表其实位置
*
* @return array $arr
*/
function get_collection_goods($user_id, $num = 10, $start = 0)
{
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'g.promote_price, g.promote_start_date,g.promote_end_date, c.rec_id, c.is_attention' . ' FROM ' . $GLOBALS['ecs']->table('collect_goods') . ' AS c' . " LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g " . "ON g.goods_id = c.goods_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 c.user_id = '{$user_id}' ORDER BY c.rec_id DESC";
$res = $GLOBALS['db']->selectLimit($sql, $num, $start);
$goods_list = 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;
}
/* 判断是否为正在预售的商品 */
// $pre_sale_id = is_pre_sale_goods($row['goods_id']);
// if($pre_sale_id != null)
// {
// $goods_list[$row['goods_id']]['is_pre_sale'] = 1;
// $goods_list[$row['goods_id']]['pre_sale_id'] = $pre_sale_id;
// }
// else
// {
// $goods_list[$row['goods_id']]['is_pre_sale'] = 0;
// }
$goods_list[$row['goods_id']]['rec_id'] = $row['rec_id'];
$goods_list[$row['goods_id']]['is_attention'] = $row['is_attention'];
$goods_list[$row['goods_id']]['goods_id'] = $row['goods_id'];
$goods_list[$row['goods_id']]['goods_name'] = $row['goods_name'];
$goods_list[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$goods_list[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$goods_list[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
$goods_list[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods_list[$row['goods_id']]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
}
return $goods_list;
}
开发者ID:firsteam,项目名称:falcons,代码行数:44,代码来源:lib_clips.php
示例5: 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
示例6: 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
示例7: 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
示例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: 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
示例10: fetch
function fetch($fetch_type = 'complete', $type = 1)
{
$user = $this->auth->get_user();
$this->_data['data']['user_id'] = $user['id'];
$sql = '
SELECT
n.*,
CONCAT(uc.first_name, " ", uc.last_name) created_fullname
FROM notification n
JOIN user uc ON n.created_by = uc.id
WHERE n.user_id = ? AND n.`type` = ? AND n.read_time IS NULL
ORDER BY n.id DESC
LIMIT 1
';
$this->_data['data']['new_row'] = $this->db->query($sql, array($user['id'], $type))->row_array();
if (empty($this->_data['data']['new_row'])) {
$this->_data['data']['new_row'] = null;
} else {
$this->load->helper('text');
$this->_data['data']['new_row']['message'] = word_limiter($this->_data['data']['new_row']['message'], 25);
}
if (!empty($this->_data['data']['new_row'])) {
$sql = '
SELECT COUNT(*) count FROM notification
WHERE user_id = ? AND `type` = ? AND read_time IS NULL
';
$this->_data['data']['row_count'] = $this->db->query($sql, array($user['id'], $type))->row()->count;
}
if ($fetch_type == 'rows' || $fetch_type == 'complete') {
$this->load->helper('gravatar');
$sql = '
SELECT n.*, uc.email, uc.image, CONCAT(uc.first_name, " ", uc.last_name) created_fullname
FROM notification n
JOIN user u ON n.user_id = u.id
JOIN user uc ON n.created_by = uc.id
WHERE user_id = ? AND `type` = ?
ORDER BY id DESC
LIMIT 5
';
$rows = $this->db->query($sql, array($user['id'], $type))->result_array();
foreach ($rows as &$row) {
if (!empty($row['icon']) && strpos($row['icon'], '://') === FALSE) {
$row['icon'] = site_url($row['icon']);
}
if (!empty($row['url']) && strpos($row['url'], '://') === FALSE) {
$row['url'] = site_url(str_replace('/edit/', '/detail/', $row['url']));
}
$row['icon'] = get_image_path($row['image']);
}
$this->db->set('read_time', date('Y-m-d H:i:s'))->where('read_time IS NULL', null, false)->where('user_id', $user['id'])->where('type', $type)->update('notification');
$this->_data['data']['rows'] = $rows;
}
}
开发者ID:rip-projects,项目名称:ark-php,代码行数:53,代码来源:notification.php
示例11: brand_get_goods
/**
* 获得品牌下的商品
*
* @access private
* @param integer $brand_id
* @return array
*/
function brand_get_goods($brand_id, $cate, $sort, $order, $size, $page) {
$cate_where = ($cate > 0) ? 'AND ' . get_children($cate) : '';
$start = ($page - 1) * $size;
/* 获得商品列表 */
$sort = $sort =='sales_volume'? 'xl.sales_volume': $sort;
$sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.market_price, g.shop_price AS org_price, ' . "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 ' . 'FROM ' . $this->pre . 'goods AS g ' . 'LEFT JOIN ' . $this->pre . 'touch_goods AS xl ' . "ON g.goods_id=xl.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 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 LIMIT $start , $size";
$res = $this->query($sql);
$arr = array();
foreach ($res as $row) {
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']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
} else {
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
}
$arr[$row['goods_id']]['discount'] = $row['market_price'] > 0 ? (round((($promote_price > 0 ? $promote_price : $row['shop_price']) / $row['market_price']) * 10)) : 0;
$arr[$row['goods_id']]['goods_number'] = $row['goods_number'];
$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/index', array(
'id' => $row['goods_id']
), $row['goods_name']);
$arr[$row['goods_id']]['sales_count'] = model('GoodsBase')->get_sales_count($row['goods_id']);
$arr[$row['goods_id']]['sc'] = model('GoodsBase')->get_goods_collect($row['goods_id']);
$arr[$row['goods_id']]['promotion'] = model('GoodsBase')->get_promotion_show($row['goods_id']);
$arr[$row['goods_id']]['mysc'] = 0;
// 检查是否已经存在于用户的收藏夹
if ($_SESSION['user_id']) {
unset($where);
// 用户自己有没有收藏过
$where['goods_id'] = $row['goods_id'];
$where['user_id'] = $_SESSION['user_id'];
$rs = $this->model->table('collect_goods')
->where($where)
->count();
$arr[$row['goods_id']]['mysc'] = $rs;
}
}
return $arr;
}
开发者ID:sayi21cn,项目名称:ecshopAndEctouch,代码行数:59,代码来源:BrandModel.class.php
示例12: print_ext_tree
function print_ext_tree($object)
{
global $gbl, $sgbl, $login, $ghtml;
$icondir = get_image_path('/button/');
$icon = "{$icondir}/{$object->getClass()}_list.gif";
?>
<script>
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel('tree-div', {
animate:true,
loader: new Tree.TreeLoader({
//dataUrl:'get-nodes.php'
dataUrl:'/ajax.php?frm_action=tree'
}),
enableDD:true,
containerScroll: true
});
// set the root node
var root = new Tree.AsyncTreeNode({
text: '<?php
echo $object->getId();
?>
',
href: '<?php
echo $ghtml->getFullUrl('a=show');
?>
',
hrefTarget: 'mainframe',
icon: '<?php
echo $icon;
?>
',
draggable:false,
id:'/'
});
tree.setRootNode(root);
// render the tree
tree.render();
root.expand();
});
</script>
<?php
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:51,代码来源:lpanel.php
示例13: get_package_info
/**
* 获取指定id package 的信息
*
* @access public
* @param int $id package_id
*
* @return array array(package_id, package_name, goods_id,start_time, end_time, min_price, integral)
*/
function get_package_info($id)
{
global $ecs, $db, $_CFG;
$id = is_numeric($id) ? intval($id) : 0;
$now = gmtime();
$sql = "SELECT act_id AS id, act_name AS package_name, goods_id , goods_name, start_time, end_time, act_desc, ext_info" . " FROM " . $this->pre . "goods_activity WHERE act_id='{$id}' AND act_type = " . GAT_PACKAGE;
$package = $this->row($sql);
/* 将时间转成可阅读格式 */
if ($package['start_time'] <= $now && $package['end_time'] >= $now) {
$package['is_on_sale'] = "1";
} else {
$package['is_on_sale'] = "0";
}
$package['start_time'] = local_date('Y-m-d H:i', $package['start_time']);
$package['end_time'] = local_date('Y-m-d H:i', $package['end_time']);
$row = unserialize($package['ext_info']);
unset($package['ext_info']);
if ($row) {
foreach ($row as $key => $val) {
$package[$key] = $val;
}
}
$sql = "SELECT pg.package_id, pg.goods_id, pg.goods_number, pg.admin_id, " . " g.goods_sn, g.goods_name, g.market_price, g.goods_thumb, g.is_real, " . " IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS rank_price " . " FROM " . $this->pre . "package_goods AS pg " . " LEFT JOIN " . $this->pre . "goods AS g " . " ON g.goods_id = pg.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 pg.package_id = " . $id . " " . " ORDER BY pg.package_id, pg.goods_id";
$goods_res = $this->query($sql);
$market_price = 0;
$real_goods_count = 0;
$virtual_goods_count = 0;
foreach ($goods_res as $key => $val) {
$goods_res[$key]['goods_thumb'] = get_image_path($val['goods_id'], $val['goods_thumb'], true);
$goods_res[$key]['market_price_format'] = price_format($val['market_price']);
$goods_res[$key]['rank_price_format'] = price_format($val['rank_price']);
$market_price += $val['market_price'] * $val['goods_number'];
/* 统计实体商品和虚拟商品的个数 */
if ($val['is_real']) {
$real_goods_count++;
} else {
$virtual_goods_count++;
}
}
if ($real_goods_count > 0) {
$package['is_real'] = 1;
} else {
$package['is_real'] = 0;
}
$package['goods_list'] = $goods_res;
$package['market_package'] = $market_price;
$package['market_package_format'] = price_format($market_price);
$package['package_price_format'] = price_format($package['package_price']);
return $package;
}
开发者ID:m7720647,项目名称:demo,代码行数:58,代码来源:PackageBaseModel.class.php
示例14: display
function display($var)
{
global $gbl, $sgbl, $login, $ghtml;
if ($var === 'description') {
if (isset($this->{$var}) && $this->{$var}) {
return $this->{$var};
}
$url = base64_decode($this->nname);
$buttonpath = get_image_path() . "/button/";
$description = $ghtml->getActionDetails($url, null, $buttonpath, $path, $post, $file, $name, $image, $__t_identity);
return "{$description['2']} for {$__t_identity}";
}
return parent::display($var);
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:14,代码来源:olddskshortcut.php
示例15: display
function display($var)
{
global $gbl, $sgbl, $login, $ghtml;
if ($var === 'portdescription') {
$dir = get_image_path() . "/button";
$text = null;
$list = $this->getList("monitorport");
foreach ($list as $p) {
$ig = "_lximg:{$dir}/{$p->portstatus}.gif:10:10:";
$text .= "{$p->portname}: {$ig} ";
}
return $text;
}
return $this->{$var};
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:15,代码来源:monitorserverlib.php
示例16: 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
示例17: auction_list
/**
* 取得某页的拍卖活动
* @param int $size 每页记录数
* @param int $page 当前页
* @param str $sort 分类
* @param str $order 排序
* @return array
*/
function auction_list($size, $page, $sort, $order)
{
$auction_list = array();
$auction_list['finished'] = $auction_list['finished'] = array();
$now = gmtime();
$start = ($page - 1) * $size;
$sort = $sort != 'goods_id' ? 't.' . $sort : $sort;
$sql = "SELECT a.*,t.act_banner ,t.sales_count ,t.click_num , IFNULL(g.goods_thumb, '') AS goods_thumb " . "FROM " . $this->pre . "goods_activity AS a " . "LEFT JOIN " . $this->pre . "goods AS g ON a.goods_id = g.goods_id " . "LEFT JOIN " . $this->pre . "touch_goods_activity AS t ON a.act_id = t.act_id " . "LEFT JOIN " . $this->pre . "touch_goods as tg ON g.goods_id = tg.goods_id " . "WHERE a.act_type = '" . GAT_AUCTION . "' " . "AND a.start_time <= '{$now}' AND a.end_time >= '{$now}' AND a.is_finished < 2 ORDER BY {$sort} {$order} LIMIT {$start} ,{$size} ";
$res = $this->query($sql);
foreach ($res as $row) {
$ext_info = unserialize($row['ext_info']);
$auction = array_merge($row, $ext_info);
$auction['status_no'] = auction_status($auction);
$auction['start_time'] = local_date(C('time_format'), $auction['start_time']);
$auction['end_time'] = local_date(C('time_format'), $auction['end_time']);
$auction['formated_start_price'] = price_format($auction['start_price']);
$auction['formated_end_price'] = price_format($auction['end_price']);
$auction['formated_deposit'] = price_format($auction['deposit']);
$auction['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$auction['act_banner'] = $row['act_banner'] ? $row['act_banner'] : $auction['goods_thumb'];
$auction['url'] = build_uri('info', array('id' => $auction['act_id']));
if ($auction['status_no'] < 2) {
$auction_list['under_way'][] = $auction;
} else {
$auction_list['finished'][] = $auction;
}
//增加扩展表判断
$sql = 'SELECT count(*) as count FROM ' . $this->pre . "touch_goods_activity WHERE `act_id` = '" . $auction['act_id'] . "'";
$res = $this->row($sql);
if ($res['count']) {
$this->table = 'touch_goods_activity';
$data['cur_price'] = $auction['start_price'];
$condition['act_id'] = $auction['act_id'];
$this->update($condition, $data);
} else {
$this->table = 'touch_goods_activity';
$data1['act_id'] = $auction['act_id'];
$data1['cur_price'] = $auction['start_price'];
$this->insert($data1);
}
}
$auction_list = @array_merge($auction_list['under_way'], $auction_list['finished']);
return $auction_list;
}
开发者ID:m7720647,项目名称:demo,代码行数:52,代码来源:AuctionModel.cl |
请发表评论