关于团购的问题!首页团购一秒内刷新成360buy的团购产品

2016-07-07 15:12 来源:www.chinab4c.com 作者:ecshop专家

关于团购的问题!首页团购一秒内刷新成360buy的团购产品1!!!
网站www.bipapauto.net
index.dwt 页面
<script type="text/javascript" src="themes/360buy/images/misc/lib/js/e/jquery.timer.js"></script>
<div class="w w1">
<div class="m m2" id="timed" clstag="homepage|keycount|home2012|15a">
<div class="mt">
<h2>限时抢购</h2>
<div class="extra"></div>
</div>
<div class="mc">
<ul class="lh">
<?php
$GLOBALS['smarty']->assign('group_buy_goods', index_get_group_buyex());
?>
<!--{foreach from=$group_buy_goods item=buy_goods name=group_buy_goods}-->
<!-- {if $smarty.foreach.group_buy_goods.index > 0} -->
<?php
$GLOBALS['smarty']->assign('goods_save', get_goods_saving($GLOBALS['smarty']->_var['buy_goods']['last_price_no_format'], $GLOBALS['smarty']->_var['buy_goods']['market_price_no_format']));
?>
<li class="fore{$smarty.foreach.group_buy_goods.index}" id="timed{$smarty.foreach.group_buy_goods.index}">
<div id="timer{$buy_goods.group_buy_id}" class="countdown"></div>
<div class="p-img ld"><a title="{$buy_goods.goods_name|escape:html}" target="_blank" href="{$buy_goods.url}"><b id="icon39" class="pi pix1" style=""><span>{$goods_save.save_rate}</span><br/>
折</b><img width="130" height="130" alt="{$buy_goods.goods_name|escape:html}" data-img="1" src="{$buy_goods.thumb}"/></a></div>
<div class="p-name"><a target="_blank" title="{$buy_goods.goods_name|escape:html}" href="{$buy_goods.url}">{$buy_goods.short_style_name|escape:html}</a></div>
<div class="p-price"><span>抢购价:</span><strong>{$buy_goods.last_price}</strong></div>
</li>
<script>

$('#timer{$buy_goods.group_buy_id}').everyTime(1000, function() {

Temp = get_group_buy_time("{$buy_goods.end_time|default:0}");
$(this).html(Temp);

});
</script>
<!-- {/if} -->
<!--{/foreach}-->
</ul>
</div>
</div>
<!--timed end-->
<div class="m m2" id="group" clstag="homepage|keycount|home2012|16a">
<div class="mt">
<h2>今日团购</h2>
<div class="extra"><a href="group_buy.php" target="_blank">更多团购&nbsp;&gt;</a></div>
</div>
<!--{foreach from=$group_buy_goods item=goods name=group_buy_goods}-->
<!-- {if $smarty.foreach.group_buy_goods.index eq 0} -->
<div class="mc">
<div class="p-img"><a href="{$goods.url}" target="_blank" title="{$goods.goods_name|escape:html}"><img data-lazyload="{$goods.thumb}" width="100" height="100" alt="{$goods.goods_name|escape:html}" data-img="1"></a></div>
<div class="p-name"><a href="{$goods.url}" target="_blank">{$goods.act_desc}</a></div>
<div class="p-market" style=" padding-left:5px; padding-right:0px;">原价:<del>{$goods.market_price_no_format}</del></div>
<span class="clr" style="height:0px"></span>
<div class="p-detail"> <a href="{$goods.url}" class="btn-tuan" target="_blank">参团</a> <span>团购价:</span><strong>{$goods.last_price}</strong> </div>
</div>
<!-- {/if} -->
<!--{/foreach}-->
</div>
<!--group end-->

左侧团购会刷新,右侧不会!
左侧 index_get_group_buyex()方法!!


function index_get_group_buyex( )
{
$time = gmtime( );
$limit = get_library_number( "group_buy", "index" );
$group_buy_list = array( );
if ( 0 < $limit )
{
$sql = "SELECT gb.act_id AS group_buy_id, gb.goods_id, gb.ext_info, gb.goods_name,gb.end_time, g.goods_thumb,g.market_price, g.goods_img, gb.act_desc FROM ".$GLOBALS['ecs']->table( "goods_activity" )." AS gb, ".$GLOBALS['ecs']->table( "goods" )." AS g WHERE gb.act_type = '".GAT_GROUP_BUY."' AND g.goods_id = gb.goods_id AND gb.start_time <= '".$time."' AND gb.end_time >= '".$time."' AND g.is_delete = 0 ORDER BY gb.act_id DESC ".( "LIMIT ".$limit );
$res = $GLOBALS['db']->query( $sql );
while ( $row = $GLOBALS['db']->fetchRow( $res ) )
{
$row['market_price_no_format'] = $row['market_price'];
$row['goods_img'] = get_image_path( $row['goods_id'], $row['goods_img'] );
$row['thumb'] = get_image_path( $row['goods_id'], $row['goods_thumb'], TRUE );
$ext_info = unserialize( $row['ext_info'] );
$row = array_merge( $row, $ext_info );
$price_ladder = $ext_info['price_ladder'];
if ( !is_array( $price_ladder ) && empty( $price_ladder ) )
{
$row['last_price'] = price_format( 0 );
}
else
{
foreach ( $price_ladder as $amount_price )
{
$price_ladder[$amount_price['amount']] = $amount_price['price'];
}
}
ksort( $price_ladder );
$row['last_price_no_format'] = end( $price_ladder );
$row['last_price'] = price_format( end( $price_ladder ) );
$stat = group_buy_stat( $row['group_buy_id'], $row['deposit'] );
$row['valid_order'] = $stat['valid_order'];
$row['url'] = build_uri( "group_buy", array(
"gbid" => $row['group_buy_id']
) );
$row['short_name'] = 0 < $GLOBALS['_CFG']['goods_name_length'] ? sub_str( $row['goods_name'], $GLOBALS['_CFG']['goods_name_length'] ) : $row['goods_name'];
$row['short_style_name'] = add_style( $row['short_name'], "" );
$row['market_price'] = price_format( $row['market_price'] );
$row['end_time'] = $row['end_time'];
$group_buy_list[] = $row;
}
}
return $group_buy_list;
}

----首页index.php
首页团购 index_get_group_buy()方法

function index_get_group_buy()
{
$time = gmtime();
$limit = get_library_number('group_buy', 'index');

$group_buy_list = array();
if ($limit > 0)
{
$sql = 'SELECT gb.act_id AS group_buy_id, gb.goods_id, gb.ext_info, gb.goods_name, g.goods_thumb, g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods_activity') . ' AS gb, ' .
$GLOBALS['ecs']->table('goods') . ' AS g ' .
"WHERE gb.act_type = '" . GAT_GROUP_BUY . "' " .
"AND g.goods_id = gb.goods_id " .
"AND gb.start_time <= '" . $time . "' " .
"AND gb.end_time >= '" . $time . "' " .
"AND g.is_delete = 0 " .
"ORDER BY gb.act_id DESC " .
"LIMIT $limit" ;
$res = $GLOBALS['db']->query($sql);

while ($row = $GLOBALS['db']->fetchRow($res))
{
/* 如果缩略图为空,使用默认图片 */
$row['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$row['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);

/* 根据价格阶梯,计算最低价 */
$ext_info = unserialize($row['ext_info']);
$price_ladder = $ext_info['price_ladder'];
if (!is_array($price_ladder) || empty($price_ladder))
{
$row['last_price'] = price_format(0);
}
else
{
foreach ($price_ladder AS $amount_price)
{
$price_ladder[$amount_price['amount']] = $amount_price['price'];
}
}
ksort($price_ladder);
$row['last_price'] = price_format(end($price_ladder));
$row['url'] = build_uri('group_buy', array('gbid' => $row['group_buy_id']));
$row['short_name']= $GLOBALS['_CFG']['goods_name_length'] > 0 ?
sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$row['short_style_name']= add_style($row['short_name'],'');
$group_buy_list[] = $row;
}
}

return $group_buy_list;
}


首页左侧团购跟 京东上的团购一样!www.360buy.com
查询数据库 活动表内又没有这些数据 !!清除缓存 貌似无用!
求高人解疑答惑!!!

回答:
查看源文件 又不是京东的产品是我自己的我很纳闷!!

与楼主同样问题

你也是仿京东哪个模版???

???没听明白!!

新手看帖 学习中 礼貌顶帖