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


PHP group_buy_status函数代码示例

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


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

示例1: group_buy_info

/**
 * 取得团购活动信息
 * @param   int     $group_buy_id   团购活动id
 * @param   int     $current_num    本次购买数量(计算当前价时要加上的数量)
 * @return  array
 *                  status          状态:
 */
function group_buy_info($group_buy_id, $current_num = 0)
{
    /* 取得团购活动信息 */
    $group_buy_id = intval($group_buy_id);
    $sql = "SELECT *, act_id AS group_buy_id, act_desc AS group_buy_desc, start_time AS start_date, end_time AS end_date " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_id = '{$group_buy_id}' " . "AND act_type = '" . GAT_GROUP_BUY . "'";
    $group_buy = $GLOBALS['db']->getRow($sql);
    /* 如果为空,返回空数组 */
    if (empty($group_buy)) {
        return array();
    }
    $ext_info = unserialize($group_buy['ext_info']);
    $group_buy = array_merge($group_buy, $ext_info);
    /* 格式化时间 */
    $group_buy['formated_start_date'] = local_date('Y-m-d H:i', $group_buy['start_time']);
    $group_buy['formated_end_date'] = local_date('Y-m-d H:i', $group_buy['end_time']);
    /* 格式化保证金 */
    $group_buy['formated_deposit'] = price_format($group_buy['deposit'], false);
    /* 处理价格阶梯 */
    $price_ladder = $group_buy['price_ladder'];
    if (!is_array($price_ladder) || empty($price_ladder)) {
        $price_ladder = array(array('amount' => 0, 'price' => 0));
    } else {
        foreach ($price_ladder as $key => $amount_price) {
            $price_ladder[$key]['formated_price'] = price_format($amount_price['price'], false);
        }
    }
    $group_buy['price_ladder'] = $price_ladder;
    /* 统计信息 */
    $stat = group_buy_stat($group_buy_id, $group_buy['deposit']);
    $group_buy = array_merge($group_buy, $stat);
    /* 计算当前价 */
    $cur_price = $price_ladder[0]['price'];
    // 初始化
    $cur_amount = $stat['valid_goods'] + $current_num;
    // 当前数量
    foreach ($price_ladder as $amount_price) {
        if ($cur_amount >= $amount_price['amount']) {
            $cur_price = $amount_price['price'];
        } else {
            break;
        }
    }
    $group_buy['cur_price'] = $cur_price;
    $group_buy['formated_cur_price'] = price_format($cur_price, false);
    /* 最终价 */
    $group_buy['trans_price'] = $group_buy['cur_price'];
    $group_buy['formated_trans_price'] = $group_buy['formated_cur_price'];
    $group_buy['trans_amount'] = $group_buy['valid_goods'];
    /* 状态 */
    $group_buy['status'] = group_buy_status($group_buy);
    if (isset($GLOBALS['_LANG']['gbs'][$group_buy['status']])) {
        $group_buy['status_desc'] = $GLOBALS['_LANG']['gbs'][$group_buy['status']];
    }
    $group_buy['start_time'] = $group_buy['formated_start_date'];
    $group_buy['end_time'] = $group_buy['formated_end_date'];
    return $group_buy;
}
开发者ID:shaoslu,项目名称:jumei,代码行数:64,代码来源:lib_goods.php

示例2: group_buy_list

function group_buy_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 过滤条件 */
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if ($_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = !empty($filter['keyword']) ? " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'" : '';
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        /* 查询 */
        $sql = "SELECT * " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' {$where} " . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ", {$filter['page_size']}";
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $res = $GLOBALS['db']->query($sql);
    $list = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ext_info = unserialize($row['ext_info']);
        $stat = group_buy_stat($row['act_id'], $ext_info['deposit']);
        $arr = array_merge($row, $stat, $ext_info);
        /* 处理价格阶梯 */
        $price_ladder = $arr['price_ladder'];
        if (!is_array($price_ladder) || empty($price_ladder)) {
            $price_ladder = array(array('amount' => 0, 'price' => 0));
        } else {
            foreach ($price_ladder as $key => $amount_price) {
                $price_ladder[$key]['formated_price'] = price_format($amount_price['price']);
            }
        }
        /* 计算当前价 */
        $cur_price = $price_ladder[0]['price'];
        // 初始化
        $cur_amount = $stat['valid_goods'];
        // 当前数量
        foreach ($price_ladder as $amount_price) {
            if ($cur_amount >= $amount_price['amount']) {
                $cur_price = $amount_price['price'];
            } else {
                break;
            }
        }
        $arr['cur_price'] = $cur_price;
        $status = group_buy_status($arr);
        $arr['start_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['start_time']);
        $arr['end_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['end_time']);
        $arr['cur_status'] = $GLOBALS['_LANG']['gbs'][$status];
        $list[] = $arr;
    }
    $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:61,代码来源:group_buy.php

示例3: group_buy_info

/**
 * 取得团购活动信息
 * @param   int     $group_buy_id   团购活动id
 * @param   int     $current_num    本次购买数量(计算当前价时要加上的数量)
 * @return  array
 *                  status          状态:
 */
function group_buy_info($group_buy_id, $current_num = 0)
{
    /* 取得团购活动信息 */
    $group_buy_id = intval($group_buy_id);
    //默认语句
    //        $sql = "SELECT *, act_id AS group_buy_id, act_desc AS group_buy_desc, start_time AS start_date, end_time AS end_date " .
    //            "FROM " . $GLOBALS['ecs']->table('goods_activity') .
    //            "WHERE act_id = '$group_buy_id' " .
    //            "AND act_type = '" . GAT_GROUP_BUY . "'";
    //自己修改
    $sql = "SELECT " . $GLOBALS['ecs']->table('goods_activity') . ".*, shop_price, act_id AS group_buy_id, act_desc AS group_buy_desc, start_time AS start_date, end_time AS end_date " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "," . $GLOBALS['ecs']->table('goods') . "WHERE act_id = '{$group_buy_id}' " . "AND act_type = '" . GAT_GROUP_BUY . "' AND " . $GLOBALS['ecs']->table('goods') . ".goods_id=" . $GLOBALS['ecs']->table('goods_activity') . ".goods_id";
    $group_buy = $GLOBALS['db']->getRow($sql);
    /* 如果为空,返回空数组 */
    if (empty($group_buy)) {
        return array();
    }
    $ext_info = unserialize($group_buy['ext_info']);
    $group_buy = array_merge($group_buy, $ext_info);
    /* 格式化时间 */
    $group_buy['formated_start_date'] = local_date('Y-m-d H:i', $group_buy['start_time']);
    $group_buy['formated_end_date'] = local_date('Y-m-d H:i', $group_buy['end_time']);
    /* 格式化保证金 */
    $group_buy['formated_deposit'] = price_format($group_buy['deposit'], false);
    /* 处理价格阶梯 */
    $price_ladder = $group_buy['price_ladder'];
    if (!is_array($price_ladder) || empty($price_ladder)) {
        $price_ladder = array(array('amount' => 0, 'price' => 0));
    } else {
        foreach ($price_ladder as $key => $amount_price) {
            $price_ladder[$key]['formated_price'] = price_format($amount_price['price'], false);
        }
    }
    $group_buy['price_ladder'] = $price_ladder;
    /*
    *    array(2) (
           [0] => array(3) (
             [amount] => (int) 10
             [price] => (float) 69
             [formated_price] => (string) ¥69.00元
           )
           [1] => array(3) (
             [amount] => (int) 20
             [price] => (float) 65
             [formated_price] => (string) ¥65.00元
           )
         )
    * 
    */
    /* 统计信息 */
    $stat = group_buy_stat($group_buy_id, $group_buy['deposit']);
    $group_buy = array_merge($group_buy, $stat);
    /* 计算当前价 */
    $cur_price = $price_ladder[0]['price'];
    // 初始化
    $cur_amount = $stat['valid_goods'] + $current_num;
    // 当前数量
    //循环,当数量大于某一个量值的时候,价格就更改为相应段的团购价,从低到高判断
    foreach ($price_ladder as $amount_price) {
        if ($cur_amount >= $amount_price['amount']) {
            $cur_price = $amount_price['price'];
        } else {
            break;
        }
    }
    $group_buy['cur_price'] = $cur_price;
    //转换为页面上显示的可读形式
    $group_buy['formated_cur_price'] = price_format($cur_price, false);
    /* 最终价 */
    $group_buy['trans_price'] = $group_buy['cur_price'];
    $group_buy['formated_trans_price'] = $group_buy['formated_cur_price'];
    $group_buy['trans_amount'] = $group_buy['valid_goods'];
    /* 状态 */
    $group_buy['status'] = group_buy_status($group_buy);
    if (isset($GLOBALS['_LANG']['gbs'][$group_buy['status']])) {
        $group_buy['status_desc'] = $GLOBALS['_LANG']['gbs'][$group_buy['status']];
    }
    $group_buy['start_time'] = $group_buy['formated_start_date'];
    $group_buy['end_time'] = $group_buy['formated_end_date'];
    return $group_buy;
}
开发者ID:jz233,项目名称:TheProject,代码行数:87,代码来源:lib_goods.php

示例4: group_buy_info

/**
 * 取得团购活动信息
 * @param   int     $group_buy_id   团购活动id
 * @param   int     $current_num    本次购买数量(计算当前价时要加上的数量)
 * @return  array
 *                  status          状态:
 */
function group_buy_info($group_buy_id, $current_num = 0)
{
    /* 取得团购活动信息 */
    //dqy add start 2011-8-24
    $group_buy_id = intval($group_buy_id);
    $sql = "SELECT b.*,g.*, b.act_id AS group_buy_id, b.act_desc AS group_buy_desc, b.start_time AS start_date, b.end_time AS end_date " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " AS b " . "LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON b.goods_id = g.goods_id " . "WHERE act_id = '{$group_buy_id}' " . "AND act_type = '" . GAT_GROUP_BUY . "'";
    //dqy add end 2011-8-24
    $group_buy = $GLOBALS['db']->getRow($sql);
    /* 如果为空,返回空数组 */
    if (empty($group_buy)) {
        return array();
    }
    $ext_info = unserialize($group_buy['ext_info']);
    $group_buy = array_merge($group_buy, $ext_info);
    /* 格式化时间 */
    $group_buy['formated_start_date'] = local_date('Y-m-d H:i', $group_buy['start_time']);
    $group_buy['formated_end_date'] = local_date('Y-m-d H:i', $group_buy['end_time']);
    /* 格式化保证金 */
    $group_buy['formated_deposit'] = price_format($group_buy['deposit'], false);
    /* 处理价格阶梯 */
    $price_ladder = $group_buy['price_ladder'];
    if (!is_array($price_ladder) || empty($price_ladder)) {
        $price_ladder = array(array('amount' => 0, 'price' => 0));
    } else {
        foreach ($price_ladder as $key => $amount_price) {
            $price_ladder[$key]['formated_price'] = price_format($amount_price['price'], false);
        }
    }
    $group_buy['price_ladder'] = $price_ladder;
    /* 统计信息 */
    $stat = group_buy_stat($group_buy_id, $group_buy['deposit']);
    $group_buy = array_merge($group_buy, $stat);
    /* 计算当前价 */
    $cur_price = $price_ladder[0]['price'];
    // 初始化
    $cur_amount = $stat['valid_goods'] + $current_num;
    // 当前数量
    foreach ($price_ladder as $amount_price) {
        if ($cur_amount >= $amount_price['amount']) {
            $cur_price = $amount_price['price'];
        } else {
            break;
        }
    }
    //yyy start
    $group_buy['goods_desc'] = $GLOBALS['db']->getOne("select goods_desc from " . $GLOBALS['ecs']->table('goods') . " where goods_id=" . $group_buy['goods_id']);
    //yyy end
    $group_buy['cur_price'] = $cur_price;
    $group_buy['formated_cur_price'] = price_format($cur_price, false);
    //dqy add start 2011-8-24
    if ($group_buy['shop_price'] == 0) {
        $group_buy['zhekou'] = 0;
    } else {
        $group_buy['zhekou'] = number_format(intval($group_buy['cur_price']) / intval($group_buy['shop_price']), 2) * 100;
    }
    $group_buy['jiesheng'] = $group_buy['shop_price'] - $group_buy['cur_price'];
    //dqy add end 2011-8-24
    /* 最终价 */
    $group_buy['trans_price'] = $group_buy['cur_price'];
    $group_buy['formated_trans_price'] = $group_buy['formated_cur_price'];
    $group_buy['trans_amount'] = $group_buy['valid_goods'];
    /* 状态 */
    $group_buy['status'] = group_buy_status($group_buy);
    if (isset($GLOBALS['_LANG']['gbs'][$group_buy['status']])) {
        $group_buy['status_desc'] = $GLOBALS['_LANG']['gbs'][$group_buy['status']];
    }
    $group_buy['start_time'] = $group_buy['formated_start_date'];
    $group_buy['end_time'] = $group_buy['formated_end_date'];
    return $group_buy;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:77,代码来源:lib_goods.php

示例5: group_buy_info

/**
 * 取得团购活动信息
 * @param   int     $group_buy_id   团购活动id
 * @param   int     $current_num    本次购买数量(计算当前价时要加上的数量)
 * @return  array
 *                  status          状态:
 */
function group_buy_info($group_buy_id, $current_num = 0)
{
    /* 取得团购活动信息 */
    $group_buy_id = intval($group_buy_id);
    $sql = "SELECT b.*,g.*, b.act_id AS group_buy_id, b.act_desc AS group_buy_desc, b.start_time AS start_date, b.end_time AS end_date " .
            "FROM " . $GLOBALS['ecs']->table('goods_activity') . " AS b " .
			"LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON b.goods_id = g.goods_id " .
            "WHERE act_id = '$group_buy_id' " .
            "AND act_type = '" . GAT_GROUP_BUY . "'";
    $group_buy = $GLOBALS['db']->getRow($sql);

    /* 如果为空,返回空数组 */
    if (empty($group_buy))
    {
        return array();
    }

    $ext_info = unserialize($group_buy['ext_info']);
    $group_buy = array_merge($group_buy, $ext_info);

    /* 格式化时间 */
    $group_buy['formated_start_date'] = local_date('Y-m-d H:i', $group_buy['start_time']);
    $group_buy['formated_end_date'] = local_date('Y-m-d H:i', $group_buy['end_time']);

    /* 格式化保证金 */
    $group_buy['formated_deposit'] = price_format($group_buy['deposit'], false);

    /* 处理价格阶梯 */
    $price_ladder = $group_buy['price_ladder'];
    if (!is_array($price_ladder) || empty($price_ladder))
    {
        $price_ladder = array(array('amount' => 0, 'price' => 0));
    }
    else
    {
        foreach ($price_ladder as $key => $amount_price)
        {
            $price_ladder[$key]['formated_price'] = price_format($amount_price['price'], false);
        }
    }
    $group_buy['price_ladder'] = $price_ladder;

    /* 统计信息 */
    $stat = group_buy_stat($group_buy_id, $group_buy['deposit']);
    $group_buy = array_merge($group_buy, $stat);

    /* 计算当前价 */
    $cur_price  = $price_ladder[0]['price']; // 初始化
    $cur_amount = $stat['valid_goods'] + $current_num; // 当前数量
    foreach ($price_ladder as $amount_price)
    {
        if ($cur_amount >= $amount_price['amount'])
        {
            $cur_price = $amount_price['price'];
        }
        else
        {
            break;
        }
    }
    $group_buy['cur_price'] = $cur_price;
    $group_buy['formated_cur_price'] = price_format($cur_price, false);
	
	/*团购节省和折扣计算 by ecmoban start*/
	$price    = $group_buy['market_price']; //原价 
	$nowprice = $group_buy['cur_price']; //现价
	$group_buy['jiesheng'] = $price-$nowprice; //节省金额 
	if($nowprice > 0)
	{
		$group_buy['zhekou'] = round(10 / ($price / $nowprice), 1); 
	}
	else 
	{ 
		$group_buy['zhekou'] = 0; 
	}
	/*团购节省和折扣计算 by ecmoban end*/
	
    /* 最终价 */
    $group_buy['trans_price'] = $group_buy['cur_price'];
    $group_buy['formated_trans_price'] = $group_buy['formated_cur_price'];
    $group_buy['trans_amount'] = $group_buy['valid_goods'];

    /* 状态 */
    $group_buy['status'] = group_buy_status($group_buy);
    if (isset($GLOBALS['_LANG']['gbs'][$group_buy['status']]))
    {
        $group_buy['status_desc'] = $GLOBALS['_LANG']['gbs'][$group_buy['status']];
    }

    $group_buy['start_time'] = $group_buy['formated_start_date'];
    $group_buy['end_time'] = $group_buy['formated_end_date'];

    return $group_buy;
//.........这里部分代码省略.........
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:101,代码来源:lib_goods.php


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