public function index() { global_run(); init_app_page(); require_once APP_ROOT_PATH . "system/model/youhui.php"; //浏览历史 $history_ids = get_view_history("youhui"); //浏览历史 if ($history_ids) { $ids_conditioin = " y.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $deal_cate_id = intval($_REQUEST['cid']); if ($deal_cate_id) { $url_param['cid'] = $deal_cate_id; } $deal_type_id = intval($_REQUEST['tid']); if ($deal_type_id) { $url_param['tid'] = $deal_type_id; } $deal_area_id = intval($_REQUEST['aid']); if ($deal_area_id) { $url_param['aid'] = $deal_area_id; } $deal_quan_id = intval($_REQUEST['qid']); if ($deal_quan_id) { $url_param['qid'] = $deal_quan_id; } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "user_count") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } if (isset($_REQUEST['ytype'])) { //2减免:满立减 1:代金券 $ytype = intval($_REQUEST['ytype']); $url_param['ytype'] = $ytype; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " 1=1 "; //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ //seo元素 $page_title = "优惠券"; $page_keyword = "优惠券"; $page_description = "优惠券"; $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id'])); //商圈缓存 $cate_list = load_auto_cache("cache_deal_cate"); //分类缓存 $cache_param = array("cid" => $deal_cate_id, "tid" => $deal_type_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id'])); $filter_nav_data = load_auto_cache("youhui_filter_nav_cache", $cache_param); if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "youhuis"))); } //全部 if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['cid']); unset($tmp_url_param['tid']); $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "youhuis", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bcate_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小分类 if ($filter_nav_data['scate_list']) { $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['scate_list']); } $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name']; $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name']; $type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id)); if ($deal_type_id > 0 && $type_list[$deal_type_id]) { $page_title = $type_list[$deal_type_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $type_list[$deal_type_id]['name']; $page_description = $page_description . "," . $type_list[$deal_type_id]['name']; } } else { //输出大分类 $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']); } if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['qid']); unset($tmp_url_param['aid']); $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "youhuis", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bquan_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小商圈 if ($filter_nav_data['squan_list']) { $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']); } $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name']; $page_description = $page_description . "," . $area_result[$deal_area_id]['name']; if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) { $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name']; $page_description = $page_description . "," . $area_result[$deal_quan_id]['name']; } } else { //输出大商圈 $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "youhuis", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "user_count") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "user_count"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "下载量", "key" => "user_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "youhuis", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; //标签筛选 //0减免:满立减 1:代金券 $tag_condition = ""; for ($i = 0; $i <= 1; $i++) { $t = $i == 1 ? $i : 2; $checked = false; if (isset($url_param['ytype']) && $url_param['ytype'] == $t) { $checked = true; } $tmp_url_param = $url_param; if (isset($tmp_url_param['ytype']) && $tmp_url_param['ytype'] == $t) { unset($tmp_url_param['ytype']); } else { $tmp_url_param['ytype'] = $t; } $dtags[] = array("name" => lang("YOUHUI_TYPE" . $i), "checked" => $checked, "url" => url("index", "youhuis", $tmp_url_param)); } if (isset($url_param['ytype'])) { if ($url_param['ytype'] == 1) { $ext_condition = " y.youhui_type = '" . $url_param['ytype'] . "' "; } else { $ext_condition = " y.youhui_type = 0 "; } } $sort_row_data['tag'] = $dtags; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取优惠券 //获取排序条件 if ($url_param['sort']) { $sort_field = "y." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { if ($ext_condition != "") { $ext_condition .= " and "; } $ext_condition .= " y.name like '%" . $GLOBALS['kw'] . "%' "; } $youhui_result = get_youhui_list($limit, array(YOUHUI_NOTICE, YOUHUI_ONLINE), $condition_param, "", $ext_condition, $sort_field); $youhui_list = $youhui_result['list']; foreach ($youhui_list as $k => $v) { $youhui_list[$k]['qrcode'] = gen_qrcode(SITE_DOMAIN . $v['url'], 3); } $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "youhui as y where " . $youhui_result['condition'], false); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('youhui_list', $youhui_list); $side_youhui_result = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE, YOUHUI_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", "", " y.user_count desc "); $side_youhui_list = $side_youhui_result['list']; $GLOBALS['tmpl']->assign('side_youhui_list', $side_youhui_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("youhuis.html"); }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); $id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/event.php"; $event = get_event($id); if ($event) { set_view_history("event", $event['id']); $history_ids = get_view_history("event"); //浏览历史 if ($history_ids) { $ids_conditioin = " e.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } $event['content'] = format_html_content_image($event['content'], 720); $event['submitted_data'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where event_id = " . $event['id'] . " and user_id = '" . $GLOBALS['user_info']['id'] . "'"); $GLOBALS['tmpl']->assign("event", $event); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他优惠券 $side_event_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "", " e.submit_count desc "); $GLOBALS['tmpl']->assign("side_event_list", $side_event_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($event['supplier_info']['name']) { $page_title .= "[" . $event['supplier_info']['name'] . "]"; $page_keyword .= $event['supplier_info']['name'] . ","; $page_description .= $event['supplier_info']['name'] . ","; } $page_title .= $event['name']; $page_keyword .= $event['name'] . ","; $page_description .= $event['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($event['cate_id']) { $event['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "event_cate where id = " . $event['cate_id']); $event['cate_url'] = url("index", "events", array("cid" => $event['cate_id'])); } if ($event['cate_name']) { $page_title .= " - " . $event['cate_name']; $page_keyword .= $event['cate_name'] . ","; $page_description .= $event['cate_name'] . ","; $site_nav[] = array('name' => $event['cate_name'], 'url' => $event['cate_url']); } $site_nav[] = array('name' => $event['name'], 'url' => $event['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("event.html"); } else { app_redirect_preview(); } }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); require_once APP_ROOT_PATH . "system/model/event.php"; //浏览历史 $history_ids = get_view_history("event"); //浏览历史 if ($history_ids) { $ids_conditioin = " e.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $deal_cate_id = intval($_REQUEST['cid']); if ($deal_cate_id) { $url_param['cid'] = $deal_cate_id; } $deal_area_id = intval($_REQUEST['aid']); if ($deal_area_id) { $url_param['aid'] = $deal_area_id; } $deal_quan_id = intval($_REQUEST['qid']); if ($deal_quan_id) { $url_param['qid'] = $deal_quan_id; } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "submit_count") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " 1=1 "; //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ //seo元素 $page_title = "活动"; $page_keyword = "活动"; $page_description = "活动"; $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id'])); //商圈缓存 $cate_list = load_auto_cache("cache_event_cate"); //分类缓存 $cache_param = array("cid" => $deal_cate_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id'])); $filter_nav_data = load_auto_cache("event_filter_nav_cache", $cache_param); if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "events"))); } //全部 if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['cid']); unset($tmp_url_param['tid']); $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "events", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bcate_list']; $filter_row_data['nav_list'][] = $filter_row; $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name']; $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name']; } else { //输出大分类 $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']); } if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['qid']); unset($tmp_url_param['aid']); $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "events", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bquan_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小商圈 if ($filter_nav_data['squan_list']) { $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']); } $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name']; $page_description = $page_description . "," . $area_result[$deal_area_id]['name']; if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) { $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name']; $page_description = $page_description . "," . $area_result[$deal_quan_id]['name']; } } else { //输出大商圈 $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "events", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "submit_count") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "submit_count"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "报名量", "key" => "submit_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "events", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取优惠券 //获取排序条件 if ($url_param['sort']) { $sort_field = "e." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { if ($ext_condition != "") { $ext_condition .= " and "; } $ext_condition .= " e.name like '%" . $GLOBALS['kw'] . "%' "; } $event_result = get_event_list($limit, array(EVENT_NOTICE, EVENT_ONLINE), $condition_param, "", $ext_condition, $sort_field); $event_list = $event_result['list']; $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "event as e where " . $event_result['condition'], false); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('event_list', $event_list); $side_event_result = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_NOTICE, EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", " is_recommend = 1 ", " e.submit_count desc "); $side_event_list = $side_event_result['list']; $GLOBALS['tmpl']->assign('side_event_list', $side_event_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("events.html"); }
public function index() { global_run(); init_app_page(); $deal_key = strim($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal = get_deal($deal_key); if ($deal) { if ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $GLOBALS['tmpl']->assign("cate_tree_type", 2); } else { set_view_history("shop", $deal['id']); $history_ids = get_view_history("shop"); $GLOBALS['tmpl']->assign("cate_tree_type", 1); } $GLOBALS['tmpl']->assign("search_type", 5); } else { set_view_history("deal", $deal['id']); $history_ids = get_view_history("deal"); } //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; if ($deal['is_shop'] == 0) { $history_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 0) { $history_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } } //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //$GLOBALS['tmpl']->assign("drop_nav","no_drop"); //首页下拉菜单不输出 //$GLOBALS['tmpl']->assign("wrap_type","1"); //首页宽屏展示 $deal['description'] = format_html_content_image($deal['description'], 720); $deal['notes'] = format_html_content_image($deal['notes'], 720); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他团购 if ($deal['is_shop'] == 0) { $side_deal_list = get_deal_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 and d.id<>" . $deal['id']); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type = 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } else { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } } //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($deal['supplier_info']['name']) { $page_title .= "[" . $deal['supplier_info']['name'] . "]"; $page_keyword .= $deal['supplier_info']['name'] . ","; $page_description .= $deal['supplier_info']['name'] . ","; } $page_title .= $deal['sub_name']; $page_keyword .= $deal['sub_name'] . ","; $page_description .= $deal['sub_name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($deal['cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id']); $deal['cate_url'] = url("index", "tuan", array("cid" => $deal['cate_id'])); } elseif ($deal['shop_cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "shop_cate where id = " . $deal['shop_cate_id']); if ($deal['buy_type'] == 1) { $deal['cate_url'] = url("index", "scores", array("cid" => $deal['shop_cate_id'])); } else { $deal['cate_url'] = url("index", "cate", array("cid" => $deal['shop_cate_id'])); } } if ($deal['cate_name']) { $page_title .= " - " . $deal['cate_name']; $page_keyword .= $deal['cate_name'] . ","; $page_description .= $deal['cate_name'] . ","; $site_nav[] = array('name' => $deal['cate_name'], 'url' => $deal['cate_url']); } $site_nav[] = array('name' => $deal['sub_name'], 'url' => $deal['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出促销 if ($deal['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } if ($deal['seo_title']) { $page_title = $deal['seo_title']; } if ($deal['seo_keyword']) { $page_keyword = $deal['seo_keyword']; } if ($deal['seo_description']) { $page_description = $deal['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("deal.html"); } else { app_redirect_preview(); } }
function insert_load_head_history() { require_once APP_ROOT_PATH . 'system/model/deal.php'; $history_list = array(); //浏览历史 $history_ids = get_view_history("deal"); if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_deal_list(2, array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } } $history_ids = get_view_history("shop"); if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_goods_list(2, array(DEAL_ONLINE), array("city_id" => 0), "", $ids_conditioin); //重新组装排序 foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } } $GLOBALS['tmpl']->assign("history_list", $history_list); $html = $GLOBALS['tmpl']->fetch("inc/insert/load_head_history.html"); return $html; }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("wrap_type", "1"); //宽屏展示 require_once APP_ROOT_PATH . "system/model/deal.php"; //浏览历史 $history_ids = get_view_history("deal"); //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $deal_cate_id = intval($_REQUEST['cid']); if ($deal_cate_id) { $url_param['cid'] = $deal_cate_id; } $deal_type_id = intval($_REQUEST['tid']); if ($deal_type_id) { $url_param['tid'] = $deal_type_id; } $deal_area_id = intval($_REQUEST['aid']); if ($deal_area_id) { $url_param['aid'] = $deal_area_id; } $deal_quan_id = intval($_REQUEST['qid']); if ($deal_quan_id) { $url_param['qid'] = $deal_quan_id; } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "current_price" && $sort_name != "buy_count") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } $dtag = intval($_REQUEST['dtag']); if ($dtag) { $url_param['dtag'] = $dtag; } $pr = intval($_REQUEST['pr']); //价格阶梯序号 if ($pr) { $url_param['pr'] = $pr; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " buy_type <> 1 and is_shop = 0 "; //团购且不为积分商品 //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ //seo元素 $page_title = "团购"; $page_keyword = "团购"; $page_description = "团购"; $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id'])); //商圈缓存 $cate_list = load_auto_cache("cache_deal_cate"); //分类缓存 $cache_param = array("cid" => $deal_cate_id, "tid" => $deal_type_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id'])); $filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param); if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "tuan"))); } //全部 if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['cid']); unset($tmp_url_param['tid']); $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "tuan", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bcate_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小分类 if ($filter_nav_data['scate_list']) { $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['scate_list']); } $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name']; $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name']; $type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id)); if ($deal_type_id > 0 && $type_list[$deal_type_id]) { $page_title = $type_list[$deal_type_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $type_list[$deal_type_id]['name']; $page_description = $page_description . "," . $type_list[$deal_type_id]['name']; } } else { //输出大分类 $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']); } if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['qid']); unset($tmp_url_param['aid']); $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "tuan", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bquan_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小商圈 if ($filter_nav_data['squan_list']) { $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']); } $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name']; $page_description = $page_description . "," . $area_result[$deal_area_id]['name']; if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) { $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name']; $page_description = $page_description . "," . $area_result[$deal_quan_id]['name']; } } else { //输出大商圈 $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "current_price") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "current_price"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "价格", "key" => "current_price", "type" => $c_sort_type, "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); //销量排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "buy_count") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "buy_count"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "销量", "key" => "buy_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; //标签筛选 1 - 6 /* 免预约 1 t 多套餐 2 t 可订座 3 t 代金券 4 t 过期退 5 t 随时退 6 t */ $tag_condition = ""; for ($t = 1; $t <= 6; $t++) { $checked = false; if (($dtag & pow(2, $t)) == pow(2, $t)) { $checked = true; } $tmp_url_param = $url_param; $tmp_url_param['dtag'] = $dtag ^ pow(2, $t); $dtags[] = array("name" => lang("DEAL_TAG_" . $t), "checked" => $checked, "url" => url("index", "tuan", $tmp_url_param)); } $ext_condition = " d.deal_tag&" . $dtag . "=" . $dtag . " "; $sort_row_data['tag'] = $dtags; //价格区间 $price_level = array(array("min" => "0", "max" => "100"), array("min" => "100", "max" => "500"), array("min" => "500", "max" => "2000"), array("min" => "2000", "max" => "0")); $tmp_url_param = $url_param; unset($tmp_url_param['pr']); $all_selected = false; if (empty($url_param['pr'])) { $all_selected = true; } $price_range[] = array("name" => "全部价格", "url" => url("index", "tuan", $tmp_url_param), "selected" => $all_selected); foreach ($price_level as $k => $v) { $tmp_url_param = $url_param; $tmp_url_param['pr'] = $k + 1; $current_selected = false; if ($url_param['pr'] == $k + 1) { $current_selected = true; } if ($v['min'] == 0 && $v['max'] > 0) { $range_name = $v['max'] . "元以下"; } else { if ($v['max'] == 0 && $v['min'] > 0) { $range_name = $v['min'] . "元以上"; } else { $range_name = $v['min'] . "-" . $v['max'] . "元"; } } $price_range[] = array("name" => $range_name, "url" => url("index", "tuan", $tmp_url_param), "selected" => $current_selected); } if ($price_level[$pr - 1]) { $price_range_item = $price_level[$pr - 1]; if ($price_range_item['min'] > 0) { $ext_condition .= " and d.current_price >= " . $price_range_item['min'] . " "; } if ($price_range_item['max'] > 0) { $ext_condition .= " and d.current_price <= " . $price_range_item['max'] . " "; } } $ext_condition .= " and d.buy_type <> 1 and d.is_shop = 0 "; $sort_row_data['range'][] = $price_range; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取商品 //获取排序条件 if ($url_param['sort']) { $sort_field = "d." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { $ext_condition .= " and d.name like '%" . $GLOBALS['kw'] . "%' "; } //开始身边团购的地理定位 $ypoint = $GLOBALS['geo']['ypoint']; //ypoint $xpoint = $GLOBALS['geo']['xpoint']; //xpoint $address = $GLOBALS['geo']['address']; if ($xpoint > 0) { $pi = PI; //圆周率 $r = EARTH_R; //地球平均半径(米) $field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((d.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((d.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (d.xpoint * {$pi}) / 180 ) ) * {$r}) as distance "; if (empty($sort_field)) { $sort_field = " distance asc "; } $GLOBALS['tmpl']->assign("geo", $GLOBALS['geo']); } $deal_result = get_deal_list($limit, array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition, $sort_field, $field_append); $deal_list = $deal_result['list']; foreach ($deal_list as $k => $v) { $distance = $v['distance']; $distance_str = ""; if ($distance > 0) { if ($distance > 1500) { $distance_str = "距离" . round($distance / 1000) . "公里"; } else { $distance_str = "距离" . round($distance) . "米"; } } $deal_list[$k]['distance'] = $distance_str; } $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal as d where " . $deal_result['condition'], false); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('deal_list', $deal_list); $side_deal_result = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 ", " d.buy_count desc "); $side_deal_list = $side_deal_result['list']; $GLOBALS['tmpl']->assign('side_deal_list', $side_deal_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("tuan.html"); }
public function index() { if (trim($_REQUEST['act']) == "print") { $this->doprint(); exit; } global_run(); init_app_page(); $id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui = get_youhui($id); if ($youhui) { set_view_history("youhui", $youhui['id']); $history_ids = get_view_history("youhui"); //浏览历史 if ($history_ids) { $ids_conditioin = " y.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } $youhui['description'] = format_html_content_image($youhui['description'], 720); $youhui['use_notice'] = format_html_content_image($youhui['use_notice'], 720); $GLOBALS['tmpl']->assign("youhui", $youhui); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他优惠券 $side_youhui_list = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "", " y.user_count desc "); $GLOBALS['tmpl']->assign("side_youhui_list", $side_youhui_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($youhui['supplier_info']['name']) { $page_title .= "[" . $youhui['supplier_info']['name'] . "]"; $page_keyword .= $youhui['supplier_info']['name'] . ","; $page_description .= $youhui['supplier_info']['name'] . ","; } $page_title .= $youhui['name']; $page_keyword .= $youhui['name'] . ","; $page_description .= $youhui['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($youhui['deal_cate_id']) { $youhui['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $youhui['deal_cate_id']); $youhui['cate_url'] = url("index", "youhuis", array("cid" => $youhui['deal_cate_id'])); } if ($youhui['cate_name']) { $page_title .= " - " . $youhui['cate_name']; $page_keyword .= $youhui['cate_name'] . ","; $page_description .= $youhui['cate_name'] . ","; $site_nav[] = array('name' => $youhui['cate_name'], 'url' => $youhui['cate_url']); } $site_nav[] = array('name' => $youhui['name'], 'url' => $youhui['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("youhui.html"); } else { app_redirect_preview(); } }
public function index() { global_run(); init_app_page(); require_once APP_ROOT_PATH . "system/model/supplier.php"; //浏览历史 $history_ids = get_view_history("store"); //浏览历史 if ($history_ids) { $ids_conditioin = " sl.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_location_list(app_conf("SIDE_DEAL_COUNT"), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $deal_cate_id = intval($_REQUEST['cid']); if ($deal_cate_id) { $url_param['cid'] = $deal_cate_id; } $deal_type_id = intval($_REQUEST['tid']); if ($deal_type_id) { $url_param['tid'] = $deal_type_id; } $deal_area_id = intval($_REQUEST['aid']); if ($deal_area_id) { $url_param['aid'] = $deal_area_id; } $deal_quan_id = intval($_REQUEST['qid']); if ($deal_quan_id) { $url_param['qid'] = $deal_quan_id; } $supplier_id = intval($_REQUEST['supplier_id']); if ($supplier_id) { $url_param['supplier_id'] = $supplier_id; } $supplier_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier where id = " . $supplier_id); if (empty($supplier_info)) { $url_param['supplier_id'] = $supplier_id = 0; } else { $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $GLOBALS['city']['id'])); if ($ids) { $tcondition .= " and city_id in (" . implode(",", $ids) . ")"; } $location_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location where supplier_id = " . $supplier_id . $tcondition); $GLOBALS['tmpl']->assign("supplier_info", $supplier_info); $GLOBALS['tmpl']->assign("location_count", $location_count); $GLOBALS['tmpl']->assign("current_city", $GLOBALS['city']); } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "good_rate") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } if (isset($_REQUEST['v'])) { //1: 认证商家 $vtype = intval($_REQUEST['v']); $url_param['v'] = $vtype; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " 1=1 "; //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ //seo元素 $page_title = "商家列表"; $page_keyword = "商家列表"; $page_description = "商家列表"; $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id'])); //商圈缓存 $cate_list = load_auto_cache("cache_deal_cate"); //分类缓存 $cache_param = array("cid" => $deal_cate_id, "tid" => $deal_type_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "supplier_id" => $supplier_id, "city_id" => intval($GLOBALS['city']['id'])); $filter_nav_data = load_auto_cache("store_filter_nav_cache", $cache_param); if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "stores", array("supplier_id" => $supplier_id)))); } //全部 if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['cid']); unset($tmp_url_param['tid']); $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "stores", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bcate_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小分类 if ($filter_nav_data['scate_list']) { $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['scate_list']); } $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name']; $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name']; $type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id)); if ($deal_type_id > 0 && $type_list[$deal_type_id]) { $page_title = $type_list[$deal_type_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $type_list[$deal_type_id]['name']; $page_description = $page_description . "," . $type_list[$deal_type_id]['name']; } } else { //输出大分类 $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']); } if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['qid']); unset($tmp_url_param['aid']); $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "stores", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bquan_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小商圈 if ($filter_nav_data['squan_list']) { $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']); } $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name']; $page_description = $page_description . "," . $area_result[$deal_area_id]['name']; if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) { $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name']; $page_description = $page_description . "," . $area_result[$deal_quan_id]['name']; } } else { //输出大商圈 $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "stores", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "good_rate") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "good_rate"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "好评率", "key" => "good_rate", "type" => $c_sort_type, "current" => $current, "url" => url("index", "stores", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; //标签筛选 //0减免:满立减 1:代金券 $tag_condition = ""; for ($t = 1; $t <= 1; $t++) { $checked = false; if (isset($url_param['v']) && $url_param['v'] == $t) { $checked = true; } $tmp_url_param = $url_param; if (isset($tmp_url_param['v']) && $tmp_url_param['v'] == $t) { unset($tmp_url_param['v']); } else { $tmp_url_param['v'] = $t; } $dtags[] = array("name" => lang("STORE_VERIFY_" . $t), "checked" => $checked, "url" => url("index", "stores", $tmp_url_param)); } if (isset($url_param['v'])) { $ext_condition = " sl.is_verify = '" . $url_param['v'] . "' "; } $sort_row_data['tag'] = $dtags; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取商家列表 //获取排序条件 if ($url_param['sort']) { $sort_field = "sl." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { if ($ext_condition != "") { $ext_condition .= " and "; } $ext_condition .= " sl.name like '%" . $GLOBALS['kw'] . "%' "; } $store_result = get_location_list($limit, $condition_param, "", $ext_condition, $sort_field); $store_list = $store_result['list']; $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location as sl where " . $store_result['condition']); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('store_list', $store_list); $side_store_result = get_location_list(app_conf("SIDE_DEAL_COUNT"), array("supplier_id" => $supplier_id, "cid" => $deal_cate_id, "city_id" => $GLOBALS['city']['id']), "", "", " sl.good_rate desc "); $side_store_list = $side_store_result['list']; $GLOBALS['tmpl']->assign('side_store_list', $side_store_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("stores_index.html"); }
public function index() { global_run(); init_app_page(); $store_id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/supplier.php"; $store_info = get_location($store_id); if ($store_info) { set_view_history("store", $store_info['id']); $history_ids = get_view_history("store"); //浏览历史 if ($history_ids) { $ids_conditioin = " sl.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_location_list(app_conf("SIDE_DEAL_COUNT"), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } $store_info['good_rate_precent'] = round($store_info['good_rate'] * 100, 1); $store_info['ref_avg_price'] = round($store_info['ref_avg_price'], 2); $store_info['brief'] = format_html_content_image($store_info['brief'], 720); $GLOBALS['tmpl']->assign("store_info", $store_info); //开始输出商户图库数据json $store_images = $GLOBALS['db']->getAll("select brief,image from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $store_info['id'] . " and status = 1 order by sort limit " . MAX_SP_IMAGE); foreach ($store_images as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v['image'], 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; $page_title .= $store_info['name']; $page_keyword .= $store_info['name'] . ","; $page_description .= $store_info['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($store_info['deal_cate_id']) { $store_info['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $store_info['deal_cate_id']); $store_info['cate_url'] = url("index", "stores", array("cid" => $store_info['deal_cate_id'])); } if ($store_info['cate_name']) { $page_title .= " - " . $store_info['cate_name']; $page_keyword .= $store_info['cate_name'] . ","; $page_description .= $store_info['cate_name'] . ","; $site_nav[] = array('name' => $store_info['cate_name'], 'url' => $store_info['cate_url']); } $site_nav[] = array('name' => $store_info['name'], 'url' => $store_info['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); if ($store_info['seo_title']) { $page_title = $store_info['seo_title']; } if ($store_info['seo_keyword']) { $page_keyword = $store_info['seo_keyword']; } if ($store_info['seo_description']) { $page_description = $store_info['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); //输出右侧的其他团购 require_once APP_ROOT_PATH . "system/model/deal.php"; $side_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $store_info['deal_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 "); //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); } else { app_redirect_preview(); } $GLOBALS['tmpl']->display("store.html"); }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("wrap_type", "1"); //宽屏展示 require_once APP_ROOT_PATH . "system/model/deal.php"; //浏览历史 $history_ids = get_view_history("shop"); //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $shop_cate_id = intval($_REQUEST['cid']); if ($shop_cate_id) { $url_param['cid'] = $shop_cate_id; } $brand_id = intval($_REQUEST['bid']); if ($brand_id) { $url_param['bid'] = intval($_REQUEST['bid']); } foreach ($_REQUEST as $k => $v) { if (preg_match("/fid_(\\d+)/i", $k, $matches)) { $url_param[$matches[0]] = strim($v); } } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "current_price" && $sort_name != "buy_count") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } $dtag = intval($_REQUEST['dtag']); if ($dtag) { $url_param['dtag'] = $dtag; } $pr = intval($_REQUEST['pr']); //价格阶梯序号 if ($pr) { $url_param['pr'] = $pr; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " buy_type <> 1 and is_shop = 1 "; //商品且不为积分商品 //seo元素 $page_title = "商城"; $page_keyword = "商城"; $page_description = "商城"; //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ $cate_cache = load_auto_cache("cache_shop_cate"); //商城分类缓存 //获取品牌 if ($shop_cate_id > 0) { $cate_key = load_auto_cache("shop_cate_key", array("cid" => $shop_cate_id)); $brand_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "brand where match(tag_match) against('" . $cate_key . "' IN BOOLEAN MODE) order by sort limit 100"); if ($brand_id > 0 && $brand_list) { $brand_info = $GLOBALS['db']->getRow("select id,name from " . DB_PREFIX . "brand where id = " . $brand_id); } } if ($shop_cate_id > 0 && $cate_cache[$shop_cate_id] || $brand_id > 0 && $brand_list) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "cate"))); } //全部 if ($shop_cate_id > 0 && $cate_cache[$shop_cate_id]) { if ($cate_cache[$shop_cate_id]['pid'] == 0) { //选中大分类 $bcate_info = $cate_cache[$shop_cate_id]; $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0)); $filter_row = array(); unset($tmp_url_param['cid']); $filter_row['current'] = array("name" => $cate_cache[$shop_cate_id]['name'], "cancel" => url("index", "cate")); $filter_row['list'] = $bcate_list; $filter_row_data['nav_list'][] = $filter_row; $scate_list = load_auto_cache("cache_shop_cate", array("pid" => $shop_cate_id)); } else { //选中小分类 $scate_info = $cate_cache[$shop_cate_id]; $bcate_info = $cate_cache[$scate_info['pid']]; $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0)); $filter_row = array(); $filter_row['current'] = array("name" => $bcate_info['name'], "cancel" => url("index", "cate")); $filter_row['list'] = $bcate_list; $filter_row_data['nav_list'][] = $filter_row; $scate_list = load_auto_cache("cache_shop_cate", array("pid" => $bcate_info['id'])); } //输出小分类 if ($scate_list) { $tmp_url_param = $url_param; $tmp_url_param['cid'] = $bcate_info['id']; if ($scate_info) { $scate_list_out[] = array("name" => "全部", "url" => url("index", "cate", $tmp_url_param)); } else { $scate_list_out[] = array("name" => "全部", "url" => url("index", "cate", $tmp_url_param), "current" => true); } foreach ($scate_list as $k => $v) { if ($v['id'] == $shop_cate_id) { $v['current'] = true; } $scate_list_out[] = $v; } $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $scate_list_out); } if ($bcate_info) { $page_title = $bcate_info['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $bcate_info['name']; $page_description = $page_description . "," . $bcate_info['name']; } if ($scate_info) { $page_title = $scate_info['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $scate_info['name']; $page_description = $page_description . "," . $scate_info['name']; } } else { //输出大分类 $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0)); $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $bcate_list); } //有分类结束 //关于品牌筛选 if ($brand_list) { $brand_list_bak = $brand_list; $brand_list = array(); $tmp_url_param = $url_param; unset($tmp_url_param['bid']); $brand_list[] = array("name" => "全部", "url" => url("index", "cate", $tmp_url_param), "current" => true); foreach ($brand_list_bak as $k => $v) { $tmp_url_param = $url_param; $tmp_url_param['bid'] = $v['id']; $v['url'] = url("index", "cate", $tmp_url_param); $brand_list[] = $v; } } if ($brand_info) { //选中大分类 $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['bid']); $filter_row['current'] = array("name" => $brand_info['name'], "cancel" => url("index", "cate", $tmp_url_param)); $filter_row['list'] = $brand_list; $filter_row_data['nav_list'][] = $filter_row; $page_title = $brand_info['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $brand_info['name']; $page_description = $page_description . "," . $brand_info['name']; } else { if ($brand_list) { //输出品牌 $filter_row_data['filter_list'][] = array("name" => "品牌", "list" => $brand_list); } } //end 品牌 //获取筛选分组 $cate_info = $cate_cache[$shop_cate_id]; $filter_group = load_auto_cache("cache_shop_filter_group", array("cid" => $cate_info['id'])); foreach ($filter_group as $k => $v) { $filter_list = $v['filter_list']; $filter_list_bak = $filter_list; $filter_list = array(); $tmp_url_param = $url_param; unset($tmp_url_param['fid_' . $v['id']]); if (empty($url_param['fid_' . $v['id']])) { $filter_list[] = array("name" => "全部", "url" => url("index", "cate", $tmp_url_param), "current" => true); } else { $filter_list[] = array("name" => "全部", "url" => url("index", "cate", $tmp_url_param)); } foreach ($filter_list_bak as $kk => $vv) { $tmp_url_param = $url_param; $tmp_url_param['fid_' . $v['id']] = $vv['name']; $vv['url'] = url("index", "cate", $tmp_url_param); if ($url_param['fid_' . $v['id']] == $vv['name']) { $vv['current'] = true; } $filter_list[] = $vv; } $filter_row_data['filter_list'][] = array("name" => $v['name'], "list" => $filter_list); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "cate", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "current_price") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "current_price"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "价格", "key" => "current_price", "type" => $c_sort_type, "current" => $current, "url" => url("index", "cate", $tmp_url_param)); //销量排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "buy_count") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "buy_count"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "销量", "key" => "buy_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "cate", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; //标签筛选 /* 多套餐 2 t 随时退 6 t 七天退 7 t 免运费 8 t 满立减 9 t */ $tag_condition = ""; for ($t = 1; $t < 10; $t++) { if ($t != 1 && $t != 3 && $t != 4 && $t != 5) { $checked = false; if (($dtag & pow(2, $t)) == pow(2, $t)) { $checked = true; } $tmp_url_param = $url_param; $tmp_url_param['dtag'] = $dtag ^ pow(2, $t); $dtags[] = array("name" => lang("DEAL_TAG_" . $t), "checked" => $checked, "url" => url("index", "cate", $tmp_url_param)); } } $ext_condition = " d.deal_tag&" . $dtag . "=" . $dtag . " "; $sort_row_data['tag'] = $dtags; //价格区间 $price_level = array(array("min" => "0", "max" => "100"), array("min" => "100", "max" => "500"), array("min" => "500", "max" => "2000"), array("min" => "2000", "max" => "0")); $tmp_url_param = $url_param; unset($tmp_url_param['pr']); $all_selected = false; if (empty($url_param['pr'])) { $all_selected = true; } $price_range[] = array("name" => "全部价格", "url" => url("index", "cate", $tmp_url_param), "selected" => $all_selected); foreach ($price_level as $k => $v) { $tmp_url_param = $url_param; $tmp_url_param['pr'] = $k + 1; $current_selected = false; if ($url_param['pr'] == $k + 1) { $current_selected = true; } if ($v['min'] == 0 && $v['max'] > 0) { $range_name = $v['max'] . "元以下"; } else { if ($v['max'] == 0 && $v['min'] > 0) { $range_name = $v['min'] . "元以上"; } else { $range_name = $v['min'] . "-" . $v['max'] . "元"; } } $price_range[] = array("name" => $range_name, "url" => url("index", "cate", $tmp_url_param), "selected" => $current_selected); } if ($price_level[$pr - 1]) { $price_range_item = $price_level[$pr - 1]; if ($price_range_item['min'] > 0) { $ext_condition .= " and d.current_price >= " . $price_range_item['min'] . " "; } if ($price_range_item['max'] > 0) { $ext_condition .= " and d.current_price <= " . $price_range_item['max'] . " "; } } $ext_condition .= " and d.buy_type <> 1 and d.is_shop = 1 "; $sort_row_data['range'][] = $price_range; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取商品 //获取排序条件 if ($url_param['sort']) { $sort_field = "d." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { $ext_condition .= " and d.name like '%" . $GLOBALS['kw'] . "%' "; } $deal_result = get_goods_list($limit, array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition, $sort_field); $deal_list = $deal_result['list']; $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal as d where " . $deal_result['condition'], false); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('deal_list', $deal_list); $side_deal_result = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 1 ", " d.buy_count desc "); $side_deal_list = $side_deal_result['list']; $GLOBALS['tmpl']->assign('side_deal_list', $side_deal_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("cate.html"); }