caching = true; } /*------------------------------------------------------ */ //-- act 操作项的初始化 /*------------------------------------------------------ */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ /*------------------------------------------------------ */ //-- 积分兑换商品列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 初始化分页信息 */ $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 10; $cat_id = isset($_REQUEST['cat_id']) && intval($_REQUEST['cat_id']) > 0 ? intval($_REQUEST['cat_id']) : 0; $integral_max = isset($_REQUEST['integral_max']) && intval($_REQUEST['integral_max']) > 0 ? intval($_REQUEST['integral_max']) : 0; $integral_min = isset($_REQUEST['integral_min']) && intval($_REQUEST['integral_min']) > 0 ? intval($_REQUEST['integral_min']) : 0; /* 排序、显示方式以及类型 */ $default_display_type = $_CFG['show_order_type'] == '0' ? 'list' : ($_CFG['show_order_type'] == '1' ? 'grid' : 'text'); $default_sort_order_method = $_CFG['sort_order_method'] == '0' ? 'DESC' : 'ASC'; $default_sort_order_type = $_CFG['sort_order_type'] == '0' ? 'goods_id' : ($_CFG['sort_order_type'] == '1' ? 'exchange_integral' : 'last_update'); $sort = (isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array('goods_id', 'exchange_integral', 'last_update','click_count'))) ? trim($_REQUEST['sort']) : $default_sort_order_type; $order = (isset($_REQUEST['order']) && in_array(trim(strtoupper($_REQUEST['order'])), array('ASC', 'DESC'))) ? trim($_REQUEST['order']) : $default_sort_order_method; $display = (isset($_REQUEST['display']) && in_array(trim(strtolower($_REQUEST['display'])), array('list', 'grid', 'text'))) ? trim($_REQUEST['display']) : (isset($_COOKIE['ECS']['display']) ? $_COOKIE['ECS']['display'] : $default_display_type); $display = in_array($display, array('list', 'grid', 'text')) ? $display : 'text'; setcookie('ECS[display]', $display, gmtime() + 86400 * 7); /* 页面的缓存ID */ $cache_id = sprintf('%X', crc32($cat_id . '-' . $display . '-' . $sort .'-' . $order .'-' . $page . '-' . $size . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $integral_max . '-' .$integral_min)); if (!$smarty->is_cached('exchange_list.dwt', $cache_id)) { /* 如果页面没有被缓存则重新获取页面的内容 */ $children = get_children($cat_id); $cat = get_cat_info($cat_id); // 获得分类的相关信息 if (!empty($cat)) { $smarty->assign('keywords', htmlspecialchars($cat['keywords'])); $smarty->assign('description', htmlspecialchars($cat['cat_desc'])); } assign_template(); $position = assign_ur_here('exchange'); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); // 促销活动信息 /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } $ext = ''; //商品查询条件扩展 //$smarty->assign('best_goods', get_exchange_recommend_goods('best', $children, $integral_min, $integral_max)); //$smarty->assign('new_goods', get_exchange_recommend_goods('new', $children, $integral_min, $integral_max)); $smarty->assign('hot_goods', get_exchange_recommend_goods('hot', $children, $integral_min, $integral_max)); $count = get_exchange_goods_count($children, $integral_min, $integral_max); $max_page = ($count> 0) ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } $goodslist = exchange_get_goods($children, $integral_min, $integral_max, $ext, $size, $page, $sort, $order); if($display == 'grid') { if(count($goodslist) % 2 != 0) { $goodslist[] = array(); } } $smarty->assign('goods_list', $goodslist); $smarty->assign('category', $cat_id); $smarty->assign('integral_max', $integral_max); $smarty->assign('integral_min', $integral_min); assign_pager('exchange', $cat_id, $count, $size, $sort, $order, $page, '', '', $integral_min, $integral_max, $display); // 分页 assign_dynamic('exchange_list'); // 动态内容 } $smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? "feed-typeexchange.xml" : 'feed.php?type=exchange'); // RSS URL $smarty->display('exchange_list.dwt', $cache_id); } /*------------------------------------------------------ */ //-- 积分兑换商品详情 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'view') { $goods_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $cache_id = $goods_id . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-exchange'; $cache_id = sprintf('%X', crc32($cache_id)); if (!$smarty->is_cached('exchange_goods.dwt', $cache_id)) { $smarty->assign('image_width', $_CFG['image_width']); $smarty->assign('image_height', $_CFG['image_height']); $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('id', $goods_id); $smarty->assign('type', 0); $smarty->assign('cfg', $_CFG); $sql_attr_www_ecshop68_com="SELECT a.attr_id, ga.goods_attr_id FROM ". $GLOBALS['ecs']->table('attribute') . " AS a left join ". $GLOBALS['ecs']->table('goods_attr') . " AS ga on a.attr_id=ga.attr_id WHERE a.is_attr_gallery=1 and ga.goods_id='" . $goods_id. "' order by ga.goods_attr_id "; $goods_attr=$GLOBALS['db']->getRow($sql_attr_www_ecshop68_com); $goods_attr_id=$goods_attr['goods_attr_id']; $smarty->assign('attr_id', $goods_attr['attr_id']); if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'get_gallery_attr') { include('includes/cls_json.php'); $json = new JSON; $goods_attr_id=$_REQUEST['goods_attr_id']; $gallery_list_www_ecshop68_com=get_goods_gallery_attr_www_ecshop68_com($goods_id, $goods_attr_id); $gallery_content=array(); $gallery_content['thumblist'] ='