table('goods_activity') . "WHERE act_type = '" . GAT_AUCTION . "' " . "AND start_time <= '$now' AND end_time >= '$now' AND is_finished < 2"; return $GLOBALS['db']->getOne($sql); } /** * 取得某页的拍卖活动 * @param int $size 每页记录数 * @param int $page 当前页 * @return array */ function auction_list($size, $page) { $auction_list = array(); $auction_list['finished'] = $auction_list['finished'] = array(); $now = gmtime(); $sql = "SELECT a.*, IFNULL(g.goods_thumb, '') AS goods_thumb " . "FROM " . $GLOBALS['ecs']->table('goods_activity') . " AS a " . "LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON a.goods_id = g.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 a.act_id DESC"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); 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($GLOBALS['_CFG']['time_format'], $auction['start_time']); $auction['end_time'] = local_date($GLOBALS['_CFG']['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_thumb'], true); $auction['url'] = build_uri('auction', array('auid' => $auction['act_id'])); if ($auction['status_no'] < 2) { $auction_list['under_way'][] = $auction; } else { $auction_list['finished'][] = $auction; } } $auction_list = @array_merge($auction_list['under_way'], $auction_list['finished']); return $auction_list; }