Exemple #1
0
 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('mall.html', $cache_id)) {
         init_app_page();
         //获取商城公告
         $notice_list = get_notice(0, array(0, 2));
         $GLOBALS['tmpl']->assign("notice_list", $notice_list);
         //输出首页推荐的分类
         $index_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_cates as $k => $v) {
             $index_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_cates[$k]['deal_list'] = $deal_result['list'];
         }
         $GLOBALS['tmpl']->assign("index_cates", $index_cates);
         $GLOBALS['tmpl']->assign("drop_nav", "no_drop");
         //首页下拉菜单不输出
         $GLOBALS['tmpl']->assign("wrap_type", "1");
         //首页宽屏展示
     }
     $GLOBALS['tmpl']->display("mall.html", $cache_id);
 }
 public function index()
 {
     $id = intval($_REQUEST['id']);
     if ($id == 0) {
         //分页
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
         $condition = " brand_promote = 1 and (end_time = 0 or end_time > " . get_gmtime() . ") ";
         $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where " . $condition . " order by time_status asc,sort desc limit " . $limit);
         $brand_total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "brand where " . $condition);
         foreach ($brand_list as $k => $v) {
             $brand_list[$k]['url'] = url("shop", "discount#index", array("id" => $v['id']));
             $brand_list[$k]['time_status'] = syn_brand_status($v['id']);
         }
         $page = new Page($brand_total, app_conf("DEAL_PAGE_SIZE"));
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         //开始输出当前的site_nav
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
         $site_nav[] = array('name' => $GLOBALS['lang']['BRAND_DISCOUNT'], 'url' => url("shop", "discount#index"));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         //输出当前的site_nav
         $GLOBALS['tmpl']->assign("brand_list", $brand_list);
         $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['BRAND_DISCOUNT']);
         $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['BRAND_DISCOUNT']);
         $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['BRAND_DISCOUNT']);
         //输出右侧的推荐
         $condition_rec = "buy_type <> 1 and is_effect =1 and is_delete = 0 and is_shop =1 and brand_promote = 1 and (begin_time = 0 or begin_time <= " . get_gmtime() . ") and (end_time = 0 or end_time > " . get_gmtime() . ") ";
         $rec_list = get_goods_list(intval(app_conf("REC_CATE_GOODS_LIMIT")), 0, $condition_rec);
         $GLOBALS['tmpl']->assign("rec_list", $rec_list['list']);
         $GLOBALS['tmpl']->display("discount_index.html", $cache_id);
     } else {
         $GLOBALS['tmpl']->caching = true;
         $cache_id = md5(MODULE_NAME . "show" . trim($_REQUEST['id']) . $GLOBALS['deal_city']['id']);
         if (!$GLOBALS['tmpl']->is_cached('brand_info.html', $cache_id)) {
             $condition = " brand_promote = 1 and (end_time = 0 or end_time > " . get_gmtime() . ") ";
             $brand_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "brand where id = " . $id . " and " . $condition);
             if ($brand_info) {
                 //开始输出当前的site_nav
                 $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
                 $site_nav[] = array('name' => $GLOBALS['lang']['BRAND_DISCOUNT'], 'url' => url("shop", "discount#index"));
                 $site_nav[] = array('name' => $brand_info['name'], 'url' => url("shop", "discount#index", array("id" => $brand_info['id'])));
                 $GLOBALS['tmpl']->assign("site_nav", $site_nav);
                 //输出当前的site_nav
                 $GLOBALS['tmpl']->assign("page_title", $brand_info['name']);
                 $GLOBALS['tmpl']->assign("page_keyword", $brand_info['name']);
                 $GLOBALS['tmpl']->assign("page_description", $brand_info['name']);
             } else {
                 app_redirect(APP_ROOT . "/");
             }
         }
         $GLOBALS['tmpl']->display("brand_info.html", $cache_id);
     }
 }
 public function index()
 {
     require_once APP_ROOT_PATH . 'app/Lib/shop_lib.php';
     $catalog_id = intval($GLOBALS['request']['catalog_id']);
     //商品分类ID
     $city_id = intval($GLOBALS['request']['city_id']);
     //城市分类ID
     $page = intval($GLOBALS['request']['page']);
     //分页
     $keyword = strim($GLOBALS['request']['keyword']);
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $condition = " deal_type = 0 ";
     if ($keyword) {
         $kws_div = div_str($keyword);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and  (match(tag_match,name_match,locate_match,shop_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%')";
     }
     $merchant_id = intval($GLOBALS['request']['merchant_id']);
     if ($merchant_id > 0) {
         $deal_ids = $GLOBALS['db']->getOne("select group_concat(deal_id) from " . DB_PREFIX . "deal_location_link where location_id = " . $merchant_id);
         if ($deal_ids) {
             $condition .= " and id in (" . $deal_ids . ") ";
         }
     }
     $deals = get_goods_list($limit, $catalog_id, $condition, "sort desc,id desc", false, $city_id);
     $list = $deals['list'];
     $count = $deals['count'];
     $page_total = ceil($count / $page_size);
     $root = array();
     $root['return'] = 1;
     $goodses = array();
     foreach ($list as $item) {
         //$goods = array();
         $goods = getGoodsArray($item);
         $goodses[] = $goods;
     }
     $root['item'] = $goodses;
     $root['page'] = array("page" => $page, "page_total" => $page_total);
     output($root);
 }
Exemple #4
0
/**
 *  搜索商品
 */
function action_search_goods()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    check_authz_json('pre_sale');
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    //非虚拟商品
    $filter = $json->decode($_GET['JSON']);
    $filter->is_virtual = 0;
    $arr = get_goods_list($filter);
    make_json_result($arr);
}
Exemple #5
0
 public function index()
 {
     require_once APP_ROOT_PATH . 'system/model/deal.php';
     $root = array();
     $root['return'] = 1;
     $catalog_id = intval($GLOBALS['request']['catalog_id']);
     //商品分类ID
     $cata_type_id = intval($GLOBALS['request']['cata_type_id']);
     //商品二级分类
     $city_id = intval($GLOBALS['request']['city_id']);
     //城市分类ID
     $page = intval($GLOBALS['request']['page']);
     //分页
     $keyword = strim($GLOBALS['request']['keyword']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     //print_r($GLOBALS['request']);
     $order_type = strim($GLOBALS['request']['order_type']);
     $quan_id = intval($GLOBALS['request']['quan_id']);
     //商圈id
     if ($cata_type_id > 0) {
         $catalog_id = $cata_type_id;
     }
     if ($order_type == 'buy_count') {
         $marked_tag = 1;
     } elseif ($order_type == 'price_desc') {
         $marked_tag = 2;
     } elseif ($order_type == 'newest') {
         $marked_tag = 3;
     } else {
         $marked_tag = 1;
     }
     $root['marked_tag'] = $marked_tag;
     /*输出分类*/
     $bcate_list = getShopcateList();
     $url_param['quan_id'] = $quan_id;
     $url_param['catalog_id'] = $catalog_id;
     foreach ($bcate_list as $k => $v) {
         if ($catalog_id == $v['id']) {
             $bcate_list[$k]['marked_tag'] = 1;
         }
         /*
         if($catalog_id==$v['id'])
         {
         	$bcate_list['bcate_type'][$k]['act'] = 1;
         }
         */
         $tmp_url_param = $url_param;
         unset($tmp_url_param['catalog_id']);
         $tmp_url_param['catalog_id'] = $v['id'];
         $tmp_url_param['catename'] = $v['name'];
         if ($quan_id > 0) {
             $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area  where id=" . $quan_id);
             $tmp_url_param['quanname'] = $quanname;
         } else {
             $tmp_url_param['quanname'] = "全城";
         }
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $bcate_list[$k]["url"] = $url;
         foreach ($v['bcate_type'] as $kk => $vv) {
             /*
             if($catalog_id==$vv['id'])
             {
             	$bcate_list['bcate_type'][$kk]['act'] = 1;
             }
             */
             $tmp_url_param = $url_param;
             unset($tmp_url_param['catalog_id']);
             $tmp_url_param['catalog_id'] = $vv['id'];
             if ($bcate_list['bcate_type'][$kk]['id'] == $vv['id']) {
                 $tmp_url_param['catename'] = $v['name'];
             } else {
                 $tmp_url_param['catename'] = $vv['name'];
             }
             if ($quan_id > 0) {
                 $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area a where id=" . $quan_id);
                 $tmp_url_param['quanname'] = $quanname;
             } else {
                 $tmp_url_param['quanname'] = "全城";
             }
             $turl = wap_url("index", "goodslist", $tmp_url_param);
             $url = str_replace('sjmapi', 'wap', $turl);
             $bcate_list[$k]["bcate_type"][$kk]["url"] = $url;
         }
     }
     //品牌列表
     if ($catalog_id > 0) {
         $cate_key = load_auto_cache("shop_cate_key", array("cid" => $catalog_id));
         $brand_list = $GLOBALS['db']->getAll("select id,name,sort,0 as city_id, from " . DB_PREFIX . "brand where match(tag_match) against('" . $cate_key . "' IN BOOLEAN MODE)  order by sort limit 100");
     } else {
         $brand_list = $GLOBALS['db']->getAll("select id,name,sort,0 as city_id from " . DB_PREFIX . "brand  order by sort limit 100");
     }
     $quan_list = array();
     $quan_list[0]['id'] = 0;
     $quan_list[0]['name'] = '全部品牌';
     /*
     $quan_list[0]['quan_sub'][0]['id']=0;
     $quan_list[0]['quan_sub'][0]['pid']=0;
     $quan_list[0]['quan_sub'][0]['name']='全部';
     */
     foreach ($brand_list as $k => $v) {
         $quan_list[] = $v;
     }
     foreach ($quan_list as $k => $v) {
         $tmp_url_param = $url_param;
         unset($tmp_url_param['quan_id']);
         $tmp_url_param['quan_id'] = $v['id'];
         $tmp_url_param['quanname'] = $v['name'];
         if ($catalog_id > 0) {
             $catename = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "shop_cate  where id=" . $catalog_id);
             $tmp_url_param['catename'] = $catename;
         } else {
             $tmp_url_param['catename'] = "全部分类";
         }
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $quan_list[$k]["url"] = $url;
         $quan_list[$k]['quan_sub'][] = array('id' => $v['id'], 'pid' => $v['id'], 'name' => '全部');
     }
     $ordertype[] = array("name" => "默认排序", "sc" => "avg_point");
     $ordertype[] = array("name" => "最新发布", "sc" => "newest");
     $ordertype[] = array("name" => "销量最高", "sc" => "buy_count");
     $ordertype[] = array("name" => "价格最高", "sc" => "price_desc");
     $ordertype[] = array("name" => "价格最低", "sc" => "price_asc");
     foreach ($ordertype as $k => $v) {
         $tmp_url_param = $url_param;
         if ($quanname) {
             $tmp_url_param['quanname'] = $quanname;
         }
         if ($catename) {
             $tmp_url_param['catename'] = $catename;
         }
         if ($keyword) {
             $tmp_url_param['keyword'] = $keyword;
         }
         $tmp_url_param['order_type'] = $v['sc'];
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $ordertype[$k]["url"] = $url;
     }
     $root['ordertype'] = $ordertype;
     /*排序*/
     if ($order_type == 'avg_point') {
         $order = " avg_point desc,id desc ";
     } elseif ($order_type == 'newest') {
         $order = " create_time desc,id desc ";
     } elseif ($order_type == 'buy_count') {
         $order = " buy_count desc,id desc ";
     } elseif ($order_type == 'price_asc') {
         $order = " current_price asc,id desc ";
     } elseif ($order_type == 'price_desc') {
         $order = " current_price desc,id desc ";
     } else {
         $order = "sort desc,id desc ";
     }
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     //buy_type = 0 普通商品;1积分商品
     $condition = " buy_type = 0  and is_shop=1";
     if ($keyword) {
         $kws_div = div_str($keyword);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and  (match(tag_match,name_match,locate_match,shop_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%')";
     }
     $merchant_id = intval($GLOBALS['request']['merchant_id']);
     if ($merchant_id > 0) {
         $deal_ids = $GLOBALS['db']->getOne("select group_concat(deal_id) from " . DB_PREFIX . "deal_location_link where location_id = " . $merchant_id);
         if ($deal_ids) {
             $condition .= " and id in (" . $deal_ids . ") ";
         } else {
             $condition .= " and id ='' ";
         }
     }
     //根据传入的商圈ID来搜索该商圈下的商品
     if ($quan_id > 0) {
         $condition .= " and brand_id = " . $quan_id;
     }
     //get_goods_list($limit,$type=array(DEAL_ONLINE,DEAL_HISTORY,DEAL_NOTICE),$param=array("cid"=>0,"city_id"=>0), $join='', $where='',$orderby = '')
     $deals = get_goods_list($limit, array(DEAL_ONLINE, DEAL_HISTORY), array("cid" => $catalog_id, "city_id" => $city_id), '', $condition, $order);
     $condition = $deals['condition'];
     $sql = "select count(*) from " . DB_PREFIX . "deal as d where  " . $condition;
     $count = $GLOBALS['db']->getOne($sql);
     $list = $deals['list'];
     $page_total = ceil($count / $page_size);
     $goodses = array();
     foreach ($list as $item) {
         //$goods = array();
         $goods = getGoodsArray($item);
         $goods['image'] = get_abs_img_root(get_spec_image($item['img'], 140, 85, 0));
         $goodses[] = $goods;
     }
     $root['item'] = $goodses;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     //$root['quan_list'] = getCityList();
     /*
     //输出城市
     $root['city_list']=getCityList();
     //输出商圈
     $quan_list=getQuanList($city_id);
     $root['quan_list2'] = $quan_list;
     */
     //$root['bcate_list'] = $bcate_list;
     //$root['quan_list'] = $quan_list;
     if ($bcate_list === false) {
         $root['bcate_list'] = array();
     } else {
         $root['bcate_list'] = $bcate_list;
     }
     if ($quan_list === false) {
         $root['quan_list'] = array();
     } else {
         $root['quan_list'] = $quan_list;
     }
     $root['page_title'] = "商品列表";
     $root['city_name'] = $city_name;
     output($root);
 }
 public function index()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 60;
     //首页缓存10分钟
     $field = es_cookie::get("shop_sort_field");
     $field_sort = es_cookie::get("shop_sort_type");
     $cache_id = md5(MODULE_NAME . ACTION_NAME . implode(",", $_REQUEST) . $field . $field_sort);
     if (!$GLOBALS['tmpl']->is_cached("page/score.html", $cache_id)) {
         require APP_ROOT_PATH . 'app/Lib/page.php';
         $cates = intval($_REQUEST['cates']);
         $GLOBALS['tmpl']->assign("cates", $cates);
         $integral = intval($_REQUEST['integral']);
         $GLOBALS['tmpl']->assign("integral", $integral);
         $sort = intval($_REQUEST['sort']);
         //1.最新  2.热门  3.积分
         $GLOBALS['tmpl']->assign("sort", $sort);
         //输出投标列表
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
         $condition = " 1=1";
         if ($sort == 1) {
             $condition .= " AND is_new = 1";
         } elseif ($sort == 2) {
             $condition .= " AND is_hot = 1 ";
         } elseif ($sort == 3) {
             $orderby = " score desc";
         }
         if ($cates > 0) {
             $cates_id = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "goods_cate where pid = " . $cates);
             $flatmap = array_map("array_pop", $cates_id);
             $cates_ids = implode(',', $flatmap);
             if ($cates_ids == "") {
                 $condition .= " AND cate_id in (" . $cates . ") ";
             } else {
                 $condition .= " AND cate_id in (" . $cates . "," . $cates_ids . ") ";
             }
         }
         if ($integral == 0) {
             $condition .= "";
         } elseif ($integral == 1) {
             $condition .= " AND score  <= 500";
         } elseif ($integral == 2) {
             $condition .= " AND score  between 500 and 1000";
         } elseif ($integral == 3) {
             $condition .= " AND score  between 1000 and 3000";
         } elseif ($integral == 4) {
             $condition .= " AND score  between 3000 and 5000";
         } else {
             $condition .= " AND score  >= 5000";
         }
         $result = get_goods_list($limit, $condition, $orderby);
         $GLOBALS['tmpl']->assign("goods_list", $result['list']);
         $page_args['cates'] = $cates;
         $page_args['integral'] = $integral;
         $page_args['sort'] = $sort;
         //商品类别
         $cates_urls = load_auto_cache("score_cates");
         //$cates_urls = $GLOBALS['db']->getAll("SELECT id,name FROM ".DB_PREFIX."goods_cate WHERE is_effect=1 and is_delete = 0 and pid= 0");
         $cates_url = array();
         $cates_url[0]['id'] = 0;
         $cates_url[0]['name'] = "不限";
         $tmp_args = $page_args;
         $tmp_args['cates'] = 0;
         $cates_url[0]['url'] = url("index", "score#index", $tmp_args);
         foreach ($cates_urls as $k => $v) {
             $cates_url[$k + 1]['id'] = $v['id'];
             $cates_url[$k + 1]['name'] = $v['name'];
             $tmp_args = $page_args;
             $tmp_args['cates'] = $v['id'];
             $cates_url[$k + 1]['url'] = url("index", "score#index", $tmp_args);
         }
         $GLOBALS['tmpl']->assign('cates_url', $cates_url);
         //积分范围
         $integral_url = array(array("name" => "不限"), array("name" => "500积分以下"), array("name" => "500-1000积分"), array("name" => "1000-3000积分"), array("name" => "3000-5000积分"), array("name" => "5000积分以上"));
         foreach ($integral_url as $k => $v) {
             $tmp_args = $page_args;
             $tmp_args['integral'] = $k;
             $integral_url[$k]['url'] = url("index", "score#index", $tmp_args);
         }
         $GLOBALS['tmpl']->assign('integral_url', $integral_url);
         //排序
         $sort_url = array(array("name" => "默认排序"), array("name" => "最新"), array("name" => "热门"), array("name" => "积分"));
         foreach ($sort_url as $k => $v) {
             $tmp_args = $page_args;
             $tmp_args['sort'] = $k;
             $sort_url[$k]['url'] = url("index", "score#index", $tmp_args);
         }
         $GLOBALS['tmpl']->assign('sort_url', $sort_url);
         $page_pram = "";
         foreach ($page_args as $k => $v) {
             $page_pram .= "&" . $k . "=" . $v;
         }
         $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"), $page_pram);
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         $GLOBALS['tmpl']->assign("page_args", $page_args);
         $GLOBALS['tmpl']->assign("field", $field);
         //??
         $GLOBALS['tmpl']->assign("field_sort", $field_sort);
         //??
     }
     $GLOBALS['tmpl']->display("page/score.html", $cache_id);
 }
Exemple #7
0
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()
 {
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']);
     if (!$GLOBALS['tmpl']->is_cached('mall.html', $cache_id)) {
         //输出商城分类
         $cate_tree = get_cate_tree(0, 1);
         $top_count = 0;
         foreach ($cate_tree as $k => $v) {
             if ($v['level'] == 0) {
                 $top_count++;
             }
             //				if($top_count>6)
             //				{
             //					$cate_tree[$k]['is_hide'] = 1;
             //				}
         }
         $GLOBALS['tmpl']->assign("cate_tree", $cate_tree);
         //获取推荐
         $hot_list = get_goods_list(intval(app_conf("REC_HOT_LIMIT")), 0, " is_hot = 1 and buy_type <> 1", "", false);
         $best_list = get_goods_list(intval(app_conf("REC_BEST_LIMIT")), 0, " is_best = 1 and buy_type <> 1 ", "", false);
         $new_list = get_goods_list(intval(app_conf("REC_NEW_LIMIT")), 0, " is_new = 1 and buy_type <> 1 ", "", false);
         $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['HOT_LIST'], 'list' => $hot_list['list'], 'url' => url("shop", "rec#rhot")));
         $hot_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html");
         $GLOBALS['tmpl']->assign("hot_span_goods_html", $hot_span_goods_html);
         $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['BEST_LIST'], 'list' => $best_list['list'], 'url' => url("shop", "rec#rbest")));
         $best_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html");
         $GLOBALS['tmpl']->assign("best_span_goods_html", $best_span_goods_html);
         $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['NEW_LIST'], 'list' => $new_list['list'], 'url' => url("shop", "rec#rnew")));
         $new_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html");
         $GLOBALS['tmpl']->assign("new_span_goods_html", $new_span_goods_html);
         $recommend_cate = $GLOBALS['db']->getAll("select id,name,uname from " . DB_PREFIX . "shop_cate where grade = 0 order by sort desc");
         //输出分类商品
         $recommend_cate_html = "";
         foreach ($recommend_cate as $cate => $catev) {
             require_once APP_ROOT_PATH . "system/utils/child.php";
             $ids_util = new child("shop_cate");
             $ids = $ids_util->getChildIds($catev['id']);
             $ids[] = $catev['id'];
             $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where shop_cate_id in (" . implode(",", $ids) . ") limit 8");
             foreach ($brand_list as $kk => $brand_item) {
                 $brand_list[$kk]['url'] = url("shop", "brand#index", array("id" => $brand_item['id']));
             }
             //商城推荐分类列表
             $time = get_gmtime();
             $count_sql = "select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0  and p_shop_cate_id=" . $catev['id'];
             $sql = "select * from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0  and p_shop_cate_id=" . $catev['id'];
             $city = get_current_deal_city();
             $city_id = $city['id'];
             if ($city_id > 0) {
                 $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id));
                 if ($ids) {
                     $sql .= " and city_id in (" . implode(",", $ids) . ")";
                     $count_sql .= " and city_id in (" . implode(",", $ids) . ")";
                 }
             }
             $sql .= " and buy_type <> 1 ";
             $count_sql .= " and buy_type <> 1 ";
             $sql .= " order by sort desc limit 10 ";
             $deals = $GLOBALS['db']->getAll($sql);
             $deals_count = $GLOBALS['db']->getOne($count_sql);
             if ($deals) {
                 foreach ($deals as $k => $deal) {
                     if ($deal['buy_type'] == 1) {
                         $module = "exchange";
                     } else {
                         $module = "goods";
                     }
                     if ($deal['uname'] != '') {
                         $durl = url("shop", $module, array("id" => $deal['uname']));
                     } else {
                         $durl = url("shop", $module, array("id" => $deal['id']));
                     }
                     $deal['url'] = $durl;
                     $deals[$k] = $deal;
                 }
             }
             $cate_list = array('list' => $deals, 'count' => $deals_count);
             //$cate_list=$catev['id'];
             //$cate_list['sd'] = get_goods_list(intval(app_conf("REC_CATE_GOODS_LIMIT")),$catev['id']," buy_type <> 1 ","",false);
             $cate_title = $catev['name'];
             if ($catev['uname'] != "") {
                 $curl = url("shop", "cate#index", array("id" => $catev['uname']));
             } else {
                 $curl = url("shop", "cate#index", array("id" => $catev['id']));
             }
             $GLOBALS['tmpl']->assign("inc_var", array('id' => $catev['id'], 'brand_list' => $brand_list, 'title' => $cate_title, 'list' => $cate_list['list'], 'url' => $curl));
             $recommend_cate_html .= $GLOBALS['tmpl']->fetch("inc/recommend_cate_goods.html");
         }
         $GLOBALS['tmpl']->assign("recommend_cate_html", $recommend_cate_html);
         $GLOBALS['tmpl']->assign("page_title", app_conf("MALL_SHOP_TITLE"));
         $GLOBALS['tmpl']->assign("page_keyword", app_conf("MALL_SHOP_TITLE"));
         $GLOBALS['tmpl']->assign("page_description", app_conf("MALL_SHOP_TITLE"));
         //输出商城公告
         $notice_list = get_notice(0, array(0, 2));
         $GLOBALS['tmpl']->assign("notice_list", $notice_list);
     }
     $GLOBALS['tmpl']->display("mall.html", $cache_id);
 }
Exemple #9
0
 public function store_load_supplier_shop()
 {
     $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/deal.php";
     $supplier_data_result = get_goods_list($limit, array(DEAL_ONLINE, DEAL_NOTICE), array(), " left join " . DB_PREFIX . "deal_location_link as l on d.id = l.deal_id ", " d.buy_type <> 1 and d.is_shop = 1 and 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 . "deal as d left join " . DB_PREFIX . "deal_location_link as l on d.id = l.deal_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_shop.html");
     ajax_return($data);
 }
Exemple #10
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("wrap_type", "1");
     //宽屏展示
     //参数处理
     $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']);
     }
     $sort_name = strim($_REQUEST["sort"]);
     if ($sort_name != "return_score" && $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;
     }
     //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", "scores")));
     }
     //全部
     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));
             foreach ($bcate_list as $k => $v) {
                 $bcate_list[$k]['url'] = $v['score_url'];
             }
             $filter_row = array();
             unset($tmp_url_param['cid']);
             $filter_row['current'] = array("name" => $cate_cache[$shop_cate_id]['name'], "cancel" => url("index", "scores"));
             $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));
             foreach ($scate_list as $k => $v) {
                 $scate_list[$k]['url'] = $v['score_url'];
             }
         } 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));
             foreach ($bcate_list as $k => $v) {
                 $bcate_list[$k]['url'] = $v['score_url'];
             }
             $filter_row = array();
             $filter_row['current'] = array("name" => $bcate_info['name'], "cancel" => url("index", "scores"));
             $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']));
             foreach ($scate_list as $k => $v) {
                 $scate_list[$k]['url'] = $v['score_url'];
             }
         }
         //输出小分类
         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", "scores", $tmp_url_param));
             } else {
                 $scate_list_out[] = array("name" => "全部", "url" => url("index", "scores", $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));
         foreach ($bcate_list as $k => $v) {
             $bcate_list[$k]['url'] = $v['score_url'];
         }
         $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", "scores", $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", "scores", $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", "scores", $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 品牌
     $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", "scores", $tmp_url_param));
     //价格排序
     $tmp_url_param = $url_param;
     if ($tmp_url_param['sort'] == "return_score") {
         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'] = "return_score";
         $tmp_url_param['type'] = "desc";
         $c_sort_type = "desc";
         $current = false;
     }
     $sort_list[] = array("name" => "积分", "key" => "return_score", "type" => $c_sort_type, "current" => $current, "url" => url("index", "scores", $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", "scores", $tmp_url_param));
     $sort_row_data['sort'] = $sort_list;
     $ext_condition = "  d.buy_type = 1 and d.is_shop = 1 ";
     $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data);
     //开始获取商品
     //获取排序条件
     //积分商城积分排序相反
     if ($url_param['sort'] == "return_score") {
         $sort_type = $url_param['type'] == "desc" ? "asc" : "desc";
     } else {
         $sort_type = $url_param['type'];
     }
     if ($url_param['sort']) {
         $sort_field = "d." . $url_param['sort'] . " " . $sort_type;
     }
     require_once APP_ROOT_PATH . "system/model/deal.php";
     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'];
     $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']);
     $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("scores.html");
 }
 public function index()
 {
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . intval($_REQUEST['p']) . $GLOBALS['deal_city']['id']);
     if (!$GLOBALS['tmpl']->is_cached('score_list.html', $cache_id)) {
         //获取当前页的团购商品列表
         //分页
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
         $id = intval($_REQUEST['id']);
         if ($id == 0) {
             $uname = addslashes(trim($_REQUEST['id']));
         }
         $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')");
         //输出商城分类
         $cate_tree = get_cate_tree($cate_item['id']);
         $GLOBALS['tmpl']->assign("cate_tree", $cate_tree);
         $result = get_goods_list($limit, intval($cate_item['id']), 'buy_type = 1', '');
         $GLOBALS['tmpl']->assign("list", $result['list']);
         $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"));
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         //开始输出当前的site_nav
         $cates = array();
         $cate = $cate_item;
         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);
         foreach ($cates as $cate_row) {
             $page_title .= $cate_row['name'] . " - ";
             $page_kd .= $cate_row['name'] . ",";
         }
         $page_title = substr($page_title, 0, -3);
         krsort($cates);
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
         if ($cate_item) {
             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);
             }
         } else {
             $site_nav[] = array('name' => $GLOBALS['lang']['SCORE_LIST'], 'url' => url("shop", "score"));
         }
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         //输出当前的site_nav
         $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['SCORE_LIST']);
         $GLOBALS['tmpl']->assign("page_keyword", $page_kd . $GLOBALS['lang']['SCORE_LIST'] . ",");
         $GLOBALS['tmpl']->assign("page_description", $page_kd . $GLOBALS['lang']['SCORE_LIST'] . ",");
         if (!$result['list'] && intval($_REQUEST['p']) > 0) {
             $GLOBALS['tmpl']->display("score_list.html");
             exit;
         }
     }
     $GLOBALS['tmpl']->display("score_list.html", $cache_id);
 }
Exemple #12
0
 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);
 }
Exemple #13
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     if (empty($GLOBALS['user_info'])) {
         app_redirect(url("index", "user#login"));
     }
     require_once APP_ROOT_PATH . "system/model/review.php";
     $order_item_id = intval($_REQUEST['order_item_id']);
     //订单商品ID
     $youhui_log_id = intval($_REQUEST['youhui_log_id']);
     //优惠券领取日志ID
     $event_submit_id = intval($_REQUEST['event_submit_id']);
     //活动报名日志ID
     if ($order_item_id > 0) {
         $deal_id = intval($GLOBALS['db']->getOne("select deal_id from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id));
     } else {
         $deal_id = intval($_REQUEST['deal_id']);
     }
     if ($youhui_log_id > 0) {
         $youhui_id = intval($GLOBALS['db']->getOne("select youhui_id from " . DB_PREFIX . "youhui_log where id = " . $youhui_log_id));
     } else {
         $youhui_id = intval($_REQUEST['youhui_id']);
     }
     if ($event_submit_id > 0) {
         $event_id = intval($GLOBALS['db']->getOne("select event_id from " . DB_PREFIX . "event_submit where id = " . $event_submit_id));
     } else {
         $event_id = intval($_REQUEST['event_id']);
     }
     $location_id = intval($_REQUEST['location_id']);
     if ($deal_id > 0) {
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $deal_info = get_deal($deal_id);
         if ($deal_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("deal_id" => $deal_id, "order_item_id" => $order_item_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $deal_info['url']);
             }
             $dp_data = load_dp_info(array("deal_id" => $deal_id));
             if ($deal_info['is_shop'] == 1) {
                 $dp_cfg = load_dp_cfg(array("scate_id" => $deal_info['shop_cate_id']));
             } else {
                 $dp_cfg = load_dp_cfg(array("cate_id" => $deal_info['cate_id']));
             }
             $item_info['id'] = $deal_info['id'];
             $item_info['key'] = 'deal_id';
             $item_info['ex_key'] = 'order_item_id';
             $item_info['ex_id'] = $order_item_id;
             $item_info['name'] = $deal_info['sub_name'];
             $item_info['detail'] = $deal_info['name'];
             $item_info['url'] = $deal_info['url'];
             $item_info['image'] = $deal_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //print_r($dp_cfg);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $deal_info['sub_name'], 'url' => url("index", "review", array("deal_id" => $deal_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($deal_info['supplier_info']['name']) {
                 $page_title .= "[" . $deal_info['supplier_info']['name'] . "]";
                 $page_keyword .= $deal_info['supplier_info']['name'] . ",";
                 $page_description .= $deal_info['supplier_info']['name'] . ",";
             }
             $page_title .= $deal_info['sub_name'];
             $page_keyword .= $deal_info['sub_name'];
             $page_description .= $deal_info['sub_name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
             //输出右侧的其他团购
             if ($deal_info['is_shop'] == 0) {
                 $side_deal_list = get_deal_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type <> 1 and d.is_shop = 0 and d.id<>" . $deal_info['id']);
             } elseif ($deal_info['is_shop'] == 1) {
                 if ($deal_info['buy_type'] == 1) {
                     $side_deal_list = get_goods_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type = 1 and d.is_shop = 1 and d.id<>" . $deal_info['id']);
                 } else {
                     $side_deal_list = get_goods_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type <> 1 and d.is_shop = 1 and d.id<>" . $deal_info['id']);
                 }
             }
             //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE));
             $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']);
         } else {
             showErr("你要点评的商品不存在");
         }
     } elseif ($youhui_id > 0) {
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $youhui_info = get_youhui($youhui_id);
         if ($youhui_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("youhui_id" => $youhui_id, "youhui_log_id" => $youhui_log_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $youhui_info['url']);
             }
             $dp_data = load_dp_info(array("youhui_id" => $youhui_id));
             $dp_cfg = load_dp_cfg(array("cate_id" => $youhui_info['deal_cate_id']));
             $item_info['id'] = $youhui_info['id'];
             $item_info['key'] = 'youhui_id';
             $item_info['ex_key'] = 'youhui_log_id';
             $item_info['ex_id'] = $youhui_log_id;
             $item_info['name'] = $youhui_info['name'];
             $item_info['url'] = $youhui_info['url'];
             $item_info['image'] = $youhui_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $youhui_info['name'], 'url' => url("index", "review", array("youhui_id" => $youhui_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($youhui_info['supplier_info']['name']) {
                 $page_title .= "[" . $youhui_info['supplier_info']['name'] . "]";
                 $page_keyword .= $youhui_info['supplier_info']['name'] . ",";
                 $page_description .= $youhui_info['supplier_info']['name'] . ",";
             }
             $page_title .= $youhui_info['name'];
             $page_keyword .= $youhui_info['name'];
             $page_description .= $youhui_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的优惠券不存在");
         }
     } elseif ($location_id > 0) {
         require_once APP_ROOT_PATH . "system/model/supplier.php";
         $location_info = get_location($location_id);
         if ($location_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("location_id" => $location_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $location_info['url']);
             }
             $dp_data = load_dp_info(array("location_id" => $location_id));
             $dp_cfg = load_dp_cfg(array("cate_id" => $location_info['deal_cate_id']));
             $item_info['id'] = $location_info['id'];
             $item_info['key'] = 'location_id';
             $item_info['name'] = $location_info['name'];
             $item_info['url'] = $location_info['url'];
             $item_info['image'] = $location_info['preview'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $location_info['name'], 'url' => url("index", "review", array("location_id" => $location_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($location_info['supplier_info']['name']) {
                 $page_title .= "[" . $location_info['supplier_info']['name'] . "]";
                 $page_keyword .= $location_info['supplier_info']['name'] . ",";
                 $page_description .= $location_info['supplier_info']['name'] . ",";
             }
             $page_title .= $location_info['name'];
             $page_keyword .= $location_info['name'];
             $page_description .= $location_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的商家不存在");
         }
     } elseif ($event_id > 0) {
         require_once APP_ROOT_PATH . "system/model/event.php";
         $event_info = get_event($event_id);
         if ($event_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("event_id" => $event_id, "event_submit_id" => $event_submit_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $event_info['url']);
             }
             $dp_data = load_dp_info(array("event_id" => $event_id));
             $dp_cfg = load_dp_cfg(array("ecate_id" => $event_info['cate_id']));
             $item_info['id'] = $event_info['id'];
             $item_info['key'] = 'event_id';
             $item_info['ex_key'] = 'event_submit_id';
             $item_info['ex_id'] = $event_submit_id;
             $item_info['name'] = $event_info['name'];
             $item_info['url'] = $event_info['url'];
             $item_info['image'] = $event_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $event_info['name'], 'url' => url("index", "review", array("event_id" => $event_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($event_info['supplier_info']['name']) {
                 $page_title .= "[" . $event_info['supplier_info']['name'] . "]";
                 $page_keyword .= $event_info['supplier_info']['name'] . ",";
                 $page_description .= $event_info['supplier_info']['name'] . ",";
             }
             $page_title .= $event_info['name'];
             $page_keyword .= $event_info['name'];
             $page_description .= $event_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的活动不存在");
         }
     } else {
         app_redirect(url("index"));
     }
     $GLOBALS['tmpl']->display("review.html");
 }
Exemple #14
0
 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");
 }
 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $page = intval($GLOBALS['request']['page']);
     $cates = intval($GLOBALS['request']['cates']);
     $integral = intval($GLOBALS['request']['integral']);
     $sort = intval($GLOBALS['request']['sort']);
     //检查用户,用户密码
     //		$user = user_check($email,$pwd);
     //		$user_id  = intval($user['id']);
     //		if ($user_id >0){
     require APP_ROOT_PATH . 'app/Lib/deal.php';
     $root['user_login_status'] = 1;
     $root['response_code'] = 1;
     //输出投标列表
     //$page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
     $condition = " 1=1";
     if ($sort == 1) {
         $condition .= " AND is_new = 1";
     } elseif ($sort == 2) {
         $condition .= " AND is_hot = 1 ";
     } elseif ($sort == 3) {
         $orderby = " score desc";
     }
     if ($cates > 0) {
         $cates_id = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "goods_cate where pid = " . $cates);
         $flatmap = array_map("array_pop", $cates_id);
         $cates_ids = implode(',', $flatmap);
         if ($cates_ids == "") {
             $condition .= " AND cate_id in (" . $cates . ") ";
         } else {
             $condition .= " AND cate_id in (" . $cates . "," . $cates_ids . ") ";
         }
     }
     if ($integral == 0) {
         $condition .= "";
     } elseif ($integral == 1) {
         $condition .= " AND score  <= 500";
     } elseif ($integral == 2) {
         $condition .= " AND score  between 500 and 1000";
     } elseif ($integral == 3) {
         $condition .= " AND score  between 1000 and 3000";
     } elseif ($integral == 4) {
         $condition .= " AND score  between 3000 and 5000";
     } else {
         $condition .= " AND score  >= 5000";
     }
     //商品列表
     $goods_list = get_goods_list($limit, $condition, $orderby);
     foreach ($goods_list as $k => $v) {
         //$root['goods_img'] = SITE_DOMAIN/$v['img'];
         //$root['goods_img'] = str_replace(".","",$v['img']);
         $root['goods_img'] = $v['img'];
     }
     $root['goods_list'] = $goods_list['list'];
     $root['page'] = array("page" => $page, "page_total" => ceil($goods_list['count'] / app_conf("DEAL_PAGE_SIZE")), "page_size" => app_conf("DEAL_PAGE_SIZE"));
     $page_args['cates'] = $cates;
     $page_args['integral'] = $integral;
     $page_args['sort'] = $sort;
     //商品类别
     $cates_urls = load_auto_cache("score_cates");
     $cates_url = array();
     $cates_url[0]['id'] = 0;
     $cates_url[0]['name'] = "不限";
     $tmp_args = $page_args;
     $tmp_args['cates'] = 0;
     $cates_url[0]['url'] = url("index", "score#index", $tmp_args);
     foreach ($cates_urls as $k => $v) {
         $cates_url[$k + 1]['id'] = $v['id'];
         $cates_url[$k + 1]['name'] = $v['name'];
         $tmp_args = $page_args;
         $tmp_args['cates'] = $v['id'];
         $cates_url[$k + 1]['url'] = url("index", "score#index", $tmp_args);
     }
     $root['cates_url'] = $cates_url;
     //积分范围
     $integral_url = array(array("id" => 0, "name" => "不限"), array("id" => 1, "name" => "500积分以下"), array("id" => 2, "name" => "500-1000积分"), array("id" => 3, "name" => "1000-3000积分"), array("id" => 4, "name" => "3000-5000积分"), array("id" => 5, "name" => "5000积分以上"));
     foreach ($integral_url as $k => $v) {
         $tmp_args = $page_args;
         $tmp_args['integral'] = $k;
         $integral_url[$k]['url'] = url("index", "score#index", $tmp_args);
     }
     $root['integral_url'] = $integral_url;
     $sort_url = array(array("id" => 0, "name" => "默认排序"), array("id" => 1, "name" => "最新"), array("id" => 2, "name" => "热门"), array("id" => 3, "name" => "积分"));
     foreach ($sort_url as $k => $v) {
         $tmp_args = $page_args;
         $tmp_args['sort'] = $k;
         $sort_url[$k]['url'] = url("index", "score#index", $tmp_args);
     }
     $root['sort_url'] = $sort_url;
     $cates = intval($GLOBALS['request']['cates']);
     $root['cates'] = $cates;
     $integral = intval($GLOBALS['request']['integral']);
     $root['integral'] = $integral;
     $sort = intval($GLOBALS['request']['sort']);
     $root['sort'] = $sort;
     //		}else{
     //			$root['response_code'] = 0;
     //			$root['show_err'] ="未登录";
     //			$root['user_login_status'] = 0;
     //		}
     $root['program_title'] = "积分商城";
     output($root);
 }
 /**
  * 异步调用商品列表
  */
 public function get_goods_list()
 {
     $_POST['filters'] = strip_tags(urldecode($_POST['filters']));
     $_POST['filters'] = json_str_iconv($_POST['filters']);
     $json = new EcsJson();
     $filters = $json->decode($_POST['filters']);
     $arr = get_goods_list($filters);
     $opt = array();
     foreach ($arr as $key => $val) {
         $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name']);
     }
     make_json_result($opt);
 }
Exemple #17
0
    } else {
        /* 扣除 */
        log_account_change($auction['last_bid']['bid_user'], 0, -1 * $auction['deposit'], 0, 0, sprintf($_LANG['deduct_auction_deposit'], $auction['act_name']));
    }
    /* 记日志 */
    admin_log($auction['act_name'], 'edit', 'auction');
    /* 清除缓存 */
    clear_cache_files();
    /* 提示信息 */
    sys_msg($_LANG['settle_deposit_ok']);
} elseif ($_REQUEST['act'] == 'search_goods') {
    check_authz_json('auction');
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filter = $json->decode($_GET['JSON']);
    $arr['goods'] = get_goods_list($filter);
    if (!empty($arr['goods'][0]['goods_id'])) {
        $arr['products'] = get_good_products($arr['goods'][0]['goods_id']);
    }
    make_json_result($arr);
} elseif ($_REQUEST['act'] == 'search_products') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filters = $json->decode($_GET['JSON']);
    if (!empty($filters->goods_id)) {
        $arr['products'] = get_good_products($filters->goods_id);
    }
    make_json_result($arr);
}
/*
 * 取得拍卖活动列表
Exemple #18
0
 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();
     }
 }
Exemple #19
0
    $keywords = $_POST['keywords'];
    $description = $_POST['description'];
    if ($is_insert) {
        $sql = 'INSERT INTO ' . $ecs->table('topic') . ' (title,start_time,end_time,data,intro,template,css,topic_img,title_pic,base_style, htmls,keywords,description)' . "VALUES ('{$_POST['topic_name']}','{$start_time}','{$end_time}','{$data}','{$_POST['topic_intro']}','{$_POST['topic_template_file']}','{$_POST['topic_css']}', '{$topic_img}', '{$title_pic}', '{$base_style}', '{$htmls}','{$keywords}','{$description}')";
    } else {
        $sql = 'UPDATE ' . $ecs->table('topic') . "SET title='{$_POST['topic_name']}',start_time='{$start_time}',end_time='{$end_time}',data='{$data}',intro='{$_POST['topic_intro']}',template='{$_POST['topic_template_file']}',css='{$_POST['topic_css']}', topic_img='{$topic_img}', title_pic='{$title_pic}', base_style='{$base_style}', htmls='{$htmls}', keywords='{$keywords}', description='{$description}'" . " WHERE topic_id='{$topic_id}' LIMIT 1";
    }
    $db->query($sql);
    clear_cache_files();
    $links[] = array('href' => 'topic.php', 'text' => $_LANG['back_list']);
    sys_msg($_LANG['succed'], 0, $links);
} elseif ($_REQUEST['act'] == 'get_goods_list') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filters = $json->decode($_GET['JSON']);
    $arr = get_goods_list($filters);
    $opt = array();
    foreach ($arr as $key => $val) {
        $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name']);
    }
    make_json_result($opt);
} elseif ($_REQUEST['act'] == 'delete') {
    admin_priv('topic_manage');
    $sql = 'DELETE FROM ' . $ecs->table('topic') . ' WHERE ';
    if (!empty($_POST['checkboxs'])) {
        $sql .= db_create_in($_POST['checkboxs'], 'topic_id');
    } elseif (!empty($_GET['id'])) {
        $_GET['id'] = intval($_GET['id']);
        $sql .= "topic_id = '{$_GET['id']}'";
    } else {
        exit;
 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);
     }
 }