/** * 智能跳转 * 用于热门关键词的智能检索,优先搜团购->商品->优惠券->活动->商家->分享,如都没有提示没有相关数据 */ public function jump() { $kw = strim($_REQUEST['kw']); if ($kw) { $param['kw'] = $kw; $condition_param['city_id'] = $GLOBALS['city']['id']; global_run(); //先验证团购 require_once APP_ROOT_PATH . "system/model/deal.php"; $ext_condition = " d.buy_type <> 1 and d.is_shop = 0 "; $ext_condition .= " and d.name like '%" . $kw . "%' "; if (get_deal_count(array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition)) { app_redirect(url("index", "tuan", $param)); } else { //商品 $ext_condition = " d.buy_type <> 1 and d.is_shop = 1 "; $ext_condition .= " and d.name like '%" . $kw . "%' "; if (get_goods_count(array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition)) { app_redirect(url("index", "cate", $param)); } else { //优惠券 require_once APP_ROOT_PATH . "system/model/youhui.php"; $ext_condition = " y.name like '%" . $kw . "%' "; if (get_youhui_count(array(YOUHUI_NOTICE, YOUHUI_ONLINE), $condition_param, "", $ext_condition)) { app_redirect(url("index", "youhuis", $param)); } else { //活动 require_once APP_ROOT_PATH . "system/model/event.php"; $ext_condition = " e.name like '%" . $kw . "%' "; if (get_event_count(array(EVENT_NOTICE, EVENT_ONLINE), $condition_param, "", $ext_condition)) { app_redirect(url("index", "events", $param)); } else { //商家 require_once APP_ROOT_PATH . "system/model/supplier.php"; $ext_condition = " sl.name like '%" . $kw . "%' "; $rs = get_location_list(1, $condition_param, "", $ext_condition); if ($rs['list']) { app_redirect(url("index", "stores", $param)); } else { app_redirect(url("index", "discover", $param)); } } } } } } else { app_redirect(url("index")); } }
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() { 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"); }
include "config.php"; include "functions.php"; extract($_REQUEST, EXTR_PREFIX_ALL | EXTR_REFS, 'r_'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta id="viewport" name="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> <link rel="shortcut icon" href="images/favicon.ico" /> <script type="text/javascript" src="domotiga.js"></script> <title>DomotiGa</title> <link rel="stylesheet" href="stylesheets/iphone.css" /> <?php // Get list of locations $data = get_location_list(); if (is_array($data)) { $data = array_unique($data); sort($data); } else { $data = array(); } ?> <link rel="apple-touch-icon" href="images/favicon.ico" /> <script language="javascript"> <!-- var state = 'none'; function showhide(layer_ref) { if (state == 'block') { state = 'none'; }
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 load_business_address() { $city_id = intval($_REQUEST['city_id']); //城市ID require_once APP_ROOT_PATH . "system/model/city.php"; $city = City::locate_city(); if ($city_id == 0) { $city_id = $city['id']; } $aid = intval($_REQUEST['aid']); //行政区ID $qid = intval($_REQUEST['qid']); //商圈ID $deal_id = intval($_REQUEST['deal_id']); //商品ID $event_id = intval($_REQUEST['event_id']); //活动ID $youhui_id = intval($_REQUEST['youhui_id']); //优惠券ID $supplier_id = intval($_REQUEST['supplier_id']); //商家ID if ($deal_id > 0) { $join = " left join " . DB_PREFIX . "deal_location_link as l on sl.id = l.location_id "; $where = " sl.supplier_id = " . $supplier_id . " and l.deal_id = " . $deal_id . " "; } elseif ($event_id > 0) { $join = " left join " . DB_PREFIX . "event_location_link as l on sl.id = l.location_id "; $where = " sl.supplier_id = " . $supplier_id . " and l.event_id = " . $event_id . " "; } elseif ($youhui_id > 0) { $join = " left join " . DB_PREFIX . "youhui_location_link as l on sl.id = l.location_id "; $where = " sl.supplier_id = " . $supplier_id . " and l.youhui_id = " . $youhui_id . " "; } else { $join = ""; $where = " sl.supplier_id = " . $supplier_id . " "; } //$join = ""; //$where = ""; $page_size = 3; require_once APP_ROOT_PATH . "system/model/supplier.php"; require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $location_list = get_location_list($limit, array("city_id" => $city_id, "aid" => $aid, "qid" => $qid), $join, $where); if ($join) { $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location as sl " . $join . " where " . $location_list['condition']); } else { $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location as sl where " . $location_list['condition']); } $page = new Page($total, $page_size, "", "short"); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); //获取城市列表 $city_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_city where is_effect = 1 order by sort asc"); foreach ($city_list as $k => $v) { if ($v['id'] == $city_id) { $city_list[$k]['current'] = true; } } $GLOBALS['tmpl']->assign("city_list", $city_list); //获取地区 if ($city_id > 0) { $area_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "area WHERE pid=0 AND city_id=" . $city_id . " ORDER BY `sort` asc "); } foreach ($area_list as $k => $v) { if ($v['id'] == $aid) { $area_list[$k]['current'] = true; } } $GLOBALS['tmpl']->assign("area_list", $area_list); //获取商圈 if ($city_id > 0 && $aid > 0) { $quan_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "area WHERE pid=" . $aid . " AND city_id=" . $city_id . " ORDER BY `sort` asc "); } foreach ($quan_list as $k => $v) { if ($v['id'] == $qid) { $quan_list[$k]['current'] = true; } } $GLOBALS['tmpl']->assign("quan_list", $quan_list); $GLOBALS['tmpl']->assign("supplier_id", $supplier_id); $GLOBALS['tmpl']->assign("location_list", $location_list['list']); $GLOBALS['tmpl']->assign("sellall", url("index", "stores", array("supplier_id" => $supplier_id))); $data['html'] = $GLOBALS['tmpl']->fetch("inc/business_address.html"); ajax_return($data); }