0) ? ' AND ' . get_children($cat) : ''; $sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, b.brand_desc, COUNT(*) AS goods_num, IF(b.brand_logo > '', '1', '0') AS tag ". "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ". $GLOBALS['ecs']->table('goods') . " AS g ". "WHERE g.brand_id = b.brand_id $children AND is_show = 1 " . " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ". "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY tag DESC, b.sort_order ASC"; $row = $GLOBALS['db']->getAll($sql); foreach ($row AS $key => $val) { $row[$key]['url'] = build_uri($app, array('cid' => $cat, 'bid' => $val['brand_id']), $val['brand_name']); $row[$key]['brand_desc'] = htmlspecialchars($val['brand_desc'],ENT_QUOTES); } return $row; } // function get_promotion_info1($goods_id = '') { $snatch = array(); $group = array(); $auction = array(); $package = array(); $favourable = array(); $gmtime = gmtime(); $sql = 'SELECT act_id, act_name, act_type, start_time, end_time FROM ' . $GLOBALS['ecs']->table('goods_activity') . " WHERE is_finished=0 AND start_time <= '$gmtime' AND end_time >= '$gmtime'"; if(!empty($goods_id)) { $sql .= " AND goods_id = '$goods_id'"; } $res = $GLOBALS['db']->getAll($sql); foreach ($res as $data) { switch ($data['act_type']) { case GAT_SNATCH: //夺宝奇兵 $snatch[$data['act_id']]['act_name'] = $data['act_name']; $snatch[$data['act_id']]['url'] = build_uri('snatch', array('sid' => $data['act_id'])); $snatch[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $snatch[$data['act_id']]['sort'] = $data['start_time']; $snatch[$data['act_id']]['type'] = 'snatch'; break; case GAT_GROUP_BUY: //团购 $group[$data['act_id']]['act_name'] = $data['act_name']; $group[$data['act_id']]['url'] = build_uri('group_buy', array('gbid' => $data['act_id'])); $group[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $group[$data['act_id']]['sort'] = $data['start_time']; $group[$data['act_id']]['type'] = 'group_buy'; break; case GAT_AUCTION: //拍卖 $auction[$data['act_id']]['act_name'] = $data['act_name']; $auction[$data['act_id']]['url'] = build_uri('auction', array('auid' => $data['act_id'])); $auction[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $auction[$data['act_id']]['sort'] = $data['start_time']; $auction[$data['act_id']]['type'] = 'auction'; break; case GAT_PACKAGE: //礼包 $package[$data['act_id']]['act_name'] = $data['act_name']; $package[$data['act_id']]['url'] = 'package.php#' . $data['act_id']; $package[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $package[$data['act_id']]['sort'] = $data['start_time']; $package[$data['act_id']]['type'] = 'package'; break; } } $user_rank = ',' . $_SESSION['user_rank'] . ','; $favourable = array(); $sql = 'SELECT act_id, act_range, act_range_ext, act_name, start_time, end_time FROM ' . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '$gmtime' AND end_time >= '$gmtime'"; if(!empty($goods_id)) { $sql .= " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'"; } $res = $GLOBALS['db']->getAll($sql); if(empty($goods_id)) { foreach ($res as $rows) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } else { $sql = "SELECT cat_id, brand_id FROM " . $GLOBALS['ecs']->table('goods') . "WHERE goods_id = '$goods_id'"; $row = $GLOBALS['db']->getRow($sql); $category_id = $row['cat_id']; $brand_id = $row['brand_id']; foreach ($res as $rows) { if ($rows['act_range'] == FAR_ALL) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } elseif ($rows['act_range'] == FAR_CATEGORY) { /* 找出分类id的子分类id */ $id_list = array(); $raw_id_list = explode(',', $rows['act_range_ext']); foreach ($raw_id_list as $id) { $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); } $ids = join(',', array_unique($id_list)); if (strpos(',' . $ids . ',', ',' . $category_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } elseif ($rows['act_range'] == FAR_BRAND) { if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $brand_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } elseif ($rows['act_range'] == FAR_GOODS) { if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $goods_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } } } $sort_time = array(); $arr = array_merge($snatch, $group, $auction, $package, $favourable); foreach($arr as $key => $value) { $sort_time[] = $value['sort']; } array_multisort($sort_time, SORT_NUMERIC, SORT_DESC, $arr); return $arr; } $this->assign('promotion_info1', get_promotion_info1()); ?>
554fcae493e564ee0dc75bdf2ebf94cacart_info|a:1:{s:4:"name";s:9:"cart_info";}554fcae493e564ee0dc75bdf2ebf94ca

农家特产

推荐品牌

Fatal error: Call to undefined function get_brands1() in /data/home/hmu054035/htdocs/temp/compiled/categorytree_index.lbi.php on line 26