public function index() { $preview = intval($_REQUEST['preview']); $id = intval($_REQUEST['id']); if ($preview > 0) { $goods = get_goods($id, $preview); if ($goods['buy_type'] == 0) { app_redirect(url("shop", "goods", array("id" => $goods['id'], "preview" => $preview))); } $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($goods['id']) . " and d.is_shop = 1 and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 if ($preview > 0) { $goods = get_goods($id, $preview); } else { $goods = get_goods($id); } //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('score_info.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(APP_ROOT . "/"); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 $goods = get_goods($id); //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); jump_deal($goods, MODULE_NAME); if (!$goods || $goods['buy_type'] != 1) { app_redirect(APP_ROOT . "/"); } $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "score#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "score#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "exchange#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "exchange#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } } $GLOBALS['tmpl']->display("score_info.html", $cache_id); }
public function index() { global $tmpl; //获取当前页的团购商品 $id = addslashes(trim($_REQUEST['id'])); $uname = addslashes(trim($_REQUEST['id'])); $preview = intval($_REQUEST['preview']); if ($id == 0 && $uname == '') { app_redirect(url("tuan", "index")); } //获取当前页的团购商品 if ($preview > 0) { $deal = get_deal_show($id, 0, 0, $preview); $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($deal['id']) . " and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } else { $deal = get_deal_show($id); } jump_deal($deal, MODULE_NAME); if ($deal['buy_type'] == 1) { app_redirect(url("tuan", "index")); } if ($deal['is_effect'] == 0 && $preview == 0 && $adm_id == 0) { app_redirect(url("tuan", "index")); } $GLOBALS['tmpl']->assign("deal", $deal); //供应商的地址列表 $GLOBALS['tmpl']->assign("json_location", $deal['json_location']); $GLOBALS['tmpl']->assign("locations", $deal['locations']); require_once './app/Lib/side.php'; //读取边栏信息,需放在deal数据的分配之后 $coupon_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where deal_id = " . intval($deal['id']) . " and is_new = 0 and is_valid = 1 and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("coupon_data", $coupon_data); if (app_conf("SHOW_DEAL_CATE") == 1) { $deal_cate_id = intval($deal['cate_id']); $GLOBALS['tmpl']->assign("is_index", 1); $GLOBALS['tmpl']->assign("hide_sort", 1); $cache_param = array("id" => $deal_cate_id, "tid" => 0, "qid" => 0, "city_id" => intval($GLOBALS['deal_city']['id'])); $filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param); $GLOBALS['tmpl']->assign('bquan_list', $filter_nav_data['bquan_list']); //开始输出分类 $GLOBALS['tmpl']->assign("bcate_list", $filter_nav_data['bcate_list']); } //输出促销 if ($deal['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } //输出团购的留言 $rel_table = "deal"; $condition = ''; $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $before_sale_condition = $condition . " and is_buy = 0"; $after_sale_condition = $condition . " and is_buy = 1"; $limit = "15"; $before_sale_message = get_message_list($limit, $before_sale_condition); $after_sale_message = get_message_list($limit, $after_sale_condition); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->assign("message_list", $before_sale_message['list']); $before_message_html = load_message_list(); $GLOBALS['tmpl']->assign("message_list", $after_sale_message['list']); $after_message_html = load_message_list(); $GLOBALS['tmpl']->assign("before_message_html", $before_message_html); $GLOBALS['tmpl']->assign("after_message_html", $after_message_html); //end 留言 if ($deal) { $GLOBALS['tmpl']->assign("page_title", $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']); $GLOBALS['tmpl']->assign("page_keyword", $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['name']); $GLOBALS['tmpl']->assign("page_description", $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']); $GLOBALS['tmpl']->display("deal.html"); } else { $GLOBALS['tmpl']->assign("page_title", "没有相关的团购"); $GLOBALS['tmpl']->assign("page_keyword", "没有相关的团购"); $GLOBALS['tmpl']->assign("page_description", "没有相关的团购"); $GLOBALS['tmpl']->display("no_deal.html"); } }
public function index() { $preview = intval($_REQUEST['preview']); $id = intval($_REQUEST['id']); if (isset($_GET['plat'])) { $plat = $_GET['plat']; } if ($preview > 0) { $goods = get_goods($id, $preview); if ($goods['buy_type'] == 1) { app_redirect(url("shop", "exchange", array("id" => $goods['id'], "preview" => $preview))); } $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($goods['id']) . " and d.is_shop = 1 and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id'] . $preview); $GLOBALS['tmpl']->is_cached('goods_info.html', $cache_id); if (!$GLOBALS['tmpl']->is_cached('goods_info.html', $cache_id) || $plat == APP_PLAT) { $id = intval($_REQUEST['id']); //获取当前页的团购商品 $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(url("shop", "index")); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } //获取当前页的团购商品 if ($preview > 0) { $goods = get_goods($id, $preview); } else { $goods = get_goods($id); } //输出促销 if ($goods['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } //输出商城分类 $cate_tree = get_cate_tree($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_id", $goods['shop_cate_id']); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); if (!$goods || $goods['buy_type'] == 1) { app_redirect(url("shop", "mall")); } /** if($plat == APP_PLAT){ echo json_encode($goods);exit; } */ //判断is_shop自动跳转 jump_deal($goods, MODULE_NAME); //输出规格库存的配置 $attr_stock = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "attr_stock where deal_id = " . $goods['id'] . " order by id asc"); $attr_cfg_json = "{"; $attr_stock_json = "{"; foreach ($attr_stock as $k => $v) { $attr_cfg_json .= $k . ":" . "{"; $attr_stock_json .= $k . ":" . "{"; foreach ($v as $key => $vvv) { if ($key != 'attr_cfg') { $attr_stock_json .= "\"" . $key . "\":" . "\"" . $vvv . "\","; } } $attr_stock_json = substr($attr_stock_json, 0, -1); $attr_stock_json .= "},"; $attr_cfg_data = unserialize($v['attr_cfg']); foreach ($attr_cfg_data as $attr_id => $vv) { $attr_cfg_json .= $attr_id . ":" . "\"" . $vv . "\","; } $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_cfg_json .= "},"; } if ($attr_stock) { $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_stock_json = substr($attr_stock_json, 0, -1); } $attr_cfg_json .= "}"; $attr_stock_json .= "}"; $GLOBALS['tmpl']->assign("attr_cfg_json", $attr_cfg_json); $GLOBALS['tmpl']->assign("attr_stock_json", $attr_stock_json); // if($plat == APP_PLAT){ // if($goods['brand_id']>0){ // $goods['brand_name']=$GLOBALS['db']->getOne('select name from '.DB_PREFIX.'brand where id ='.$goods['brand_id']); // }else{ // $goods['brand_name'] =""; // } // array_recursive($goods, 'strval'); // echo json_encode($goods); // exit; // } // $GLOBALS['tmpl']->assign("goods", $goods); //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); $page_title = substr($page_title, 0, -3); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $GLOBALS['lang']['SHOP_HOME'], 'url' => url("shop", "mall#index", '')); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("shop", "cate#index", array("id" => $cate_row['uname'])); } else { $curl = url("shop", "cate#index", array("id" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($goods['uname'] != "") { $gurl = url("shop", "goods#index", array("id" => $goods['uname'])); } else { $gurl = url("shop", "goods#index", array("id" => $goods['id'])); } $site_nav[] = array('name' => $goods['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $goods['seo_title'] != '' ? $goods['seo_title'] : $goods['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $goods['seo_keyword'] != '' ? $goods['seo_keyword'] : $goods['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $goods['seo_description'] != '' ? $goods['seo_description'] : $goods['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //输出关联商品 $relate_list = get_goods_list(intval(app_conf("RELATE_GOODS_LIMIT")), $goods['shop_cate_id'], ' buy_type <> 1 and is_shop = 1 and id <> ' . $goods['id'], '', true); $shop_cate_uname = $GLOBALS['db']->getOne("select uname from " . DB_PREFIX . "shop_cate where id = " . $goods['shop_cate_id']); if ($shop_cate_uname != "") { $curl = url("shop", "cate#index", array("id" => $shop_cate_uname)); } else { $curl = url("shop", "cate#index", array("id" => $goods['shop_cate_id'])); } $GLOBALS['tmpl']->assign("relate_list", array('title' => $GLOBALS['lang']['RELATE_LIST'], 'list' => $relate_list['list'], 'url' => $curl)); //供应商的地址列表 //定义location_id $locations = $GLOBALS['db']->getAll("select a.* from " . DB_PREFIX . "supplier_location as a left join " . DB_PREFIX . "deal_location_link as b on a.id = b.location_id where a.is_effect = 1 and b.deal_id = " . intval($goods['id'])); $json_location = array(); $location_ids = array(0); foreach ($locations as $litem) { $location_ids[] = $litem['id']; $arr = array(); $arr['title'] = $litem['name']; $arr['address'] = $litem['address']; $arr['tel'] = $litem['tel']; $arr['lng'] = $litem['xpoint']; $arr['lat'] = $litem['ypoint']; $json_location[] = $arr; } $GLOBALS['tmpl']->assign("json_location", json_encode($json_location)); $GLOBALS['tmpl']->assign("locations", $locations); // 判断该商品所属类型是否允许购买 $is_can_buy = is_can_buy($goods['shop_cate_id']); $GLOBALS['tmpl']->assign("is_can_buy", $is_can_buy); // 输出套餐内容 $sql = "select * from " . DB_PREFIX . "set_meal where deal_id=" . $id; $set_meal = $GLOBALS['db']->getAll($sql); $GLOBALS['tmpl']->assign("set_meal", $set_meal); } if ($_REQUEST['plat'] == APP_PLAT) { $GLOBALS['tmpl']->display("goods_app_info.html"); } else { $GLOBALS['tmpl']->display("goods_info.html", $cache_id); } }
public function index() { $preview = intval($_REQUEST['preview']); $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id'] . $preview); if (!$GLOBALS['tmpl']->is_cached('youhui_ydetail.html', $cache_id)) { //获取当前页的团购商品 $id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($id == 0 && $uname == '') { app_redirect(url("shop", "index")); } elseif ($id == 0 && $uname != '') { $id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal where uname = '" . $uname . "'"); } if ($preview > 0) { $youhui = get_youhui($id, $preview); $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($youhui['id']) . " and d.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/admin.php?m=Public&a=login"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } else { $youhui = get_youhui($id); } jump_deal($youhui, MODULE_NAME); if (!$youhui) { app_redirect(url("youhui", "index")); } $GLOBALS['tmpl']->assign("youhui", $youhui); //供应商的地址列表 //定义location_id $locations = $GLOBALS['db']->getAll("select a.* from " . DB_PREFIX . "supplier_location as a left join " . DB_PREFIX . "deal_location_link as b on a.id = b.location_id where a.is_effect = 1 and b.deal_id = " . intval($youhui['id'])); $json_location = array(); $location_ids = array(0); foreach ($locations as $litem) { $location_ids[] = $litem['id']; $arr = array(); $arr['title'] = $litem['name']; $arr['address'] = $litem['address']; $arr['tel'] = $litem['tel']; $arr['lng'] = $litem['xpoint']; $arr['lat'] = $litem['ypoint']; $json_location[] = $arr; } $GLOBALS['tmpl']->assign("json_location", json_encode($json_location)); $GLOBALS['tmpl']->assign("locations", $locations); //输出促销 if ($youhui['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } //开始输出当前的site_nav $cates = array(); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where id = " . $youhui['cate_id']); do { $cates[] = $cate; $pid = intval($cate['pid']); $cate = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where is_effect =1 and is_delete =0 and id = " . $pid); } while ($pid != 0); krsort($cates); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index")); if ($cates) { foreach ($cates as $cate_row) { if ($cate_row['uname'] != "") { $curl = url("youhui", "ycate#index", array("cid" => $cate_row['uname'])); } else { $curl = url("youhui", "ycate#index", array("cid" => $cate_row['id'])); } $site_nav[] = array('name' => $cate_row['name'], 'url' => $curl); } } if ($youhui['uname'] != "") { $gurl = url("youhui", "ydetail#index", array("id" => $youhui['uname'])); } else { $gurl = url("youhui", "ydetail#index", array("id" => $youhui['id'])); } $site_nav[] = array('name' => $youhui['name'], 'url' => $gurl); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $seo_title = $youhui['seo_title'] != '' ? $youhui['seo_title'] : $youhui['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $youhui['seo_keyword'] != '' ? $youhui['seo_keyword'] : $youhui['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $youhui['seo_description'] != '' ? $youhui['seo_description'] : $youhui['name']; $GLOBALS['tmpl']->assign("page_description", $seo_description . ","); //周边热卖 $areas = $GLOBALS['db']->getAll("select a.name from " . DB_PREFIX . "area as a left join " . DB_PREFIX . "supplier_location_area_link as l on l.area_id = a.id where l.location_id in (" . implode(",", $location_ids) . ")"); $condition_arr = array(); foreach ($areas as $area) { $condition_arr[] = str_to_unicode_string($area['name']); } $condition = " (match(d.locate_match) against('" . implode(" ", $condition_arr) . "' IN BOOLEAN MODE)) and d.id <> " . $youhui['id']; $near_youhui = search_youhui_list(4, 0, $condition, "", false, ""); $GLOBALS['tmpl']->assign("near_youhui_list", $near_youhui['list']); } $GLOBALS['tmpl']->display("youhui_ydetail.html", $cache_id); }