/** * 获得指定品牌的详细信息 * * @access private * @param integer $id * @return void */ function get_brand_info($id) { $sql = 'SELECT b.* , tb.brand_banner FROM ' . $this->pre . "brand as b LEFT JOIN " . $this->pre . "touch_brand as tb ON b.brand_id = tb.brand_id WHERE b.brand_id = '{$id}'"; $res = $this->row($sql); $res['brand_logo'] = get_banner_path($res['brand_logo']); $res['brand_banner'] = get_banner_path($res['brand_banner']); return $res; }
/** * 获得指定品牌的详细信息 * * @access private * @param integer $id * @return void */ function get_brand_info($id) { $sql = 'SELECT b.* , tb.brand_banner FROM ' . $this->pre . "brand as b LEFT JOIN " . $this->pre . "touch_brand as tb ON b.brand_id = tb.brand_id WHERE b.brand_id = '$id'"; $res = $this->row($sql); $brand_logo = strtolower(substr($res ['brand_logo'], 0, '4')) == 'http' ? $res ['brand_logo'] : $base_url . 'data/brandlogo/' . $res ['brand_logo']; $brand_banner = strtolower(substr($res ['brand_banner'], 0, '4')) == 'http' ? $res ['brand_banner'] : $base_url . 'data/brand_banner/' . $res ['brand_banner']; $res['brand_logo'] = get_banner_path($res ['brand_logo']); $res['brand_banner'] = get_banner_path($res ['brand_banner']); return $res; }
/** * 获取优惠活动的信息和活动banner * @param unknown $size * @param unknown $page * @return Ambigous <multitype:, type, string, unknown> */ function get_activity_info($size, $page) { $start = ($page - 1) * $size; $sql = 'SELECT f.* , a.act_banner' . ' FROM ' . $this->pre . 'favourable_activity f LEFT JOIN ' . $this->pre . 'touch_activity a on a.act_id = f.act_id ' . " ORDER BY f.sort_order ASC, f.end_time DESC LIMIT $start , $size"; $res = $this->query($sql); $arr = array(); foreach ($res as $row) { $arr[$row['act_id']]['start_time'] = local_date('Y-m-d H:i', $row['start_time']); $arr[$row['act_id']]['end_time'] = local_date('Y-m-d H:i', $row['end_time']); $arr[$row['act_id']]['url'] = url('activity/goods_list', array('id' => $row['act_id'])); $arr[$row['act_id']]['act_name'] = $row['act_name']; $arr[$row['act_id']]['act_id'] = $row['act_id']; $arr[$row['act_id']]['act_banner'] = get_banner_path($row['act_banner']); } return $arr; }
/** * 获得品牌列表 * * @global type $page_libs * @staticvar null $static_page_libs * @param type $cat * @param type $app * @param type $size * @param type $page * @return type */ function get_brands($app = 'brand', $size, $page) { $start = ($page - 1) * $size; $sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, b.brand_desc, t.brand_banner FROM " . $this->pre . "brand b LEFT JOIN " . $this->pre . "touch_brand t ON t.brand_id = b.brand_id " . "WHERE is_show = 1 " . "GROUP BY b.brand_id , b.sort_order order by b.sort_order ASC LIMIT {$start} , {$size}"; $res = $this->query($sql); $arr = array(); foreach ($res as $row) { $arr[$row['brand_id']]['brand_name'] = $row['brand_name']; $arr[$row['brand_id']]['url'] = url('brand/goods_list', array('id' => $row['brand_id'])); $arr[$row['brand_id']]['brand_logo'] = get_banner_path($row['brand_logo']); $arr[$row['brand_id']]['brand_banner'] = get_banner_path($row['brand_banner']); $arr[$row['brand_id']]['goods_num'] = model('Brand')->goods_count_by_brand($row['brand_id']); $arr[$row['brand_id']]['brand_desc'] = htmlspecialchars($row['brand_desc'], ENT_QUOTES); } return $arr; }
/** * 首页推荐分类 * @return type * by Leah */ function get_recommend_res() { $cat_recommend_res = $this->query("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $this->pre . "cat_recommend AS cr INNER JOIN " . $this->pre . "category AS c ON cr.cat_id=c.cat_id AND c.is_show = 1 ORDER BY c.sort_order ASC, c.cat_id ASC"); if (!empty($cat_recommend_res)) { $cat_rec = array(); foreach ($cat_recommend_res as $cat_recommend_data) { $cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name'], 'url' => url('category/index', array('id' => $cat_recommend_data['cat_id'])), 'child_id' => model('Category')->get_parent_id_tree($cat_recommend_data['cat_id']), 'goods_list' => model('Category')->assign_cat_goods($cat_recommend_data['cat_id'], 3), 'cat_image' => get_banner_path(model('Category')->get_cat_image($cat_recommend_data['cat_id']))); } return $cat_rec; } }