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() { $rss = new UniversalFeedCreator(); $rss->useCached(); // use cached version if age<1 hour $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE"); $rss->description = app_conf("SHOP_SEO_TITLE"); //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->link = get_domain() . APP_ROOT; $rss->syndicationURL = get_domain() . APP_ROOT; //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; //对图片路径的修复 if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") { $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN']; } else { $domain = SITE_DOMAIN . APP_ROOT; } $city = City::locate_city(); $city_id = $city['id']; $tuan_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_shop = 0 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc "); $tuan_list = $tuan_list['list']; foreach ($tuan_list as $data) { $item = new FeedItem(); $gurl = url("index", "deal#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $deal_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc "); $deal_list = $deal_list['list']; foreach ($deal_list as $data) { $item = new FeedItem(); $gurl = url("index", "deal#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $youhui_list = get_youhui_list(10, array(YOUHUI_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_effect =1 ", " create_time desc "); $youhui_list = $youhui_list['list']; foreach ($youhui_list as $data) { $item = new FeedItem(); $gurl = url("index", "youhui#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $event_list = get_event_list(10, array(EVENT_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_effect =1 ", " sort asc "); $event_list = $event_list['list']; foreach ($event_list as $data) { $item = new FeedItem(); $gurl = url("index", "event#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml"); }
public function index() { global_run(); $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['city']['id']); if (!$GLOBALS['tmpl']->is_cached('index.html', $cache_id)) { init_app_page(); $GLOBALS['tmpl']->assign("drop_nav", "no_drop"); //首页下拉菜单不输出 $GLOBALS['tmpl']->assign("wrap_type", "1"); //首页宽屏展示 //获取首页公告 $notice_list = get_notice(0, array(0, 1)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //获取热门团购分类 $tuan_cate = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 order by sort asc"); foreach ($tuan_cate as $k => $v) { $tuan_cate[$k]['url'] = url("index", "tuan", array("cid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_cate", $tuan_cate); //输出热门团购标签 $tuan_tag = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate_type as dct left join " . DB_PREFIX . "deal_cate_type_link as dctl on dct.id = dctl.deal_cate_type_id order by dct.sort limit 15"); foreach ($tuan_tag as $k => $v) { $tuan_tag[$k]['url'] = url("index", "tuan", array("cid" => $v['cate_id'], "tid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_tag", $tuan_tag); //输出团购地区 $tuan_area = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id = " . intval($GLOBALS['city']['id']) . " and pid > 0 order by sort limit 50"); foreach ($tuan_area as $k => $v) { $tuan_area[$k]['url'] = url("index", "tuan", array("aid" => $v['pid'], "qid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_area", $tuan_area); //输出首页推荐的分类 $index_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 and rec_youhui = 1 order by sort"); foreach ($index_cates as $k => $v) { $index_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select dct.* from " . DB_PREFIX . "deal_cate_type as dct left join " . DB_PREFIX . "deal_cate_type_link as dctl on dct.id = dctl.deal_cate_type_id where dctl.cate_id = " . $v['id'] . " and dct.is_recommend = 1 order by dct.sort"); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_result = get_deal_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 0 and d.is_recommend = 1 "); $index_cates[$k]['deal_list'] = $deal_result['list']; } $GLOBALS['tmpl']->assign("index_cates", $index_cates); //输出首页商城推荐分类 $index_mall_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_delete = 0 and is_effect = 1 and recommend = 1 and pid = 0 order by sort"); foreach ($index_mall_cates as $k => $v) { $index_mall_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where pid = " . $v['id'] . " order by sort limit 8"); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_result = get_goods_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.is_recommend = 1 "); $index_mall_cates[$k]['deal_list'] = $deal_result['list']; } $GLOBALS['tmpl']->assign("index_mall_cates", $index_mall_cates); //输出推荐门店 require_once APP_ROOT_PATH . "system/model/supplier.php"; $store_result = get_location_list(app_conf("INDEX_SUPPLIER_COUNT"), array("city_id" => intval($GLOBALS['city']['id'])), "", " is_recommend=1 AND is_effect = 1 ", " is_verify desc,sort desc "); $GLOBALS['tmpl']->assign("store_list", $store_result['list']); //输出首页推荐的优惠券 require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui_result = get_youhui_list(20, array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "y.is_recommend = 1"); $GLOBALS['tmpl']->assign("youhui_list", $youhui_result['list']); //输出友情链接 $links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 order by sort desc"); foreach ($links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $GLOBALS['tmpl']->assign("links", $links); } $GLOBALS['tmpl']->display("index.html", $cache_id); }
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 store_load_supplier_youhui() { $store_id = intval($_REQUEST['store_id']); $page_size = 5; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; require_once APP_ROOT_PATH . "system/model/youhui.php"; $supplier_data_result = get_youhui_list($limit, array(YOUHUI_NOTICE, YOUHUI_ONLINE), array(), ' left join ' . DB_PREFIX . "youhui_location_link as l on y.id = l.youhui_id ", " l.location_id = " . $store_id); $GLOBALS['tmpl']->assign("supplier_data_list", $supplier_data_result['list']); //分页 require_once APP_ROOT_PATH . "app/Lib/page.php"; $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "youhui as y left join " . DB_PREFIX . "youhui_location_link as l on y.id = l.youhui_id where " . $supplier_data_result['condition']); $page = new Page($total, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('total', $total); $GLOBALS['tmpl']->assign('page_size', $page_size); $data['html'] = $GLOBALS['tmpl']->fetch("inc/store_page/store_supplier_youhui.html"); ajax_return($data); }