$cache_id = sprintf('%X', crc32($cache_id)); } else { /* 缓存id:语言 */ $cache_id = $_CFG['lang']; $cache_id = sprintf('%X', crc32($cache_id)); } /* 如果没有缓存,生成缓存 */ if (!$smarty->is_cached('group_buy_list.dwt', $cache_id)) { if ($count > 0) { /* 取得当前页的团购活动 */ $gb_list = group_buy_list($size, $page); $smarty->assign('gb_list', $gb_list); /* 设置分页链接 */ $pager = get_pager('group_buy.php', array('act' => 'list'), $count, $page, $size); $smarty->assign('pager', $pager); } /* 模板赋值 */ $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(); $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('full_page', 1); $smarty->assign('ur_here', $_LANG['group_buy_list']); $smarty->assign('action_link', array('href' => 'group_buy.php?act=add', 'text' => $_LANG['add_group_buy'])); $list = group_buy_list(); $smarty->assign('group_buy_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 显示商品列表页面 */ assign_query_info(); $smarty->display('group_buy_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $list = group_buy_list(); $smarty->assign('group_buy_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('group_buy_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') { /* 初始化/取得团购活动信息 */ if ($_REQUEST['act'] == 'add') { $group_buy = array('act_id' => 0, 'start_time' => date('Y-m-d', time() + 86400), 'end_time' => date('Y-m-d', time() + 4 * 86400), 'price_ladder' => array(array('amount' => 0, 'price' => 0))); } else { $group_buy_id = intval($_REQUEST['id']); if ($group_buy_id <= 0) { die('invalid param');
$where_brand[0] = " brand_buy=0 "; //非品牌团购 $where_brand[1] = " brand_buy=1 "; $sql_today_mather = $comm . " AND " . $where_start_time['lt'] . " AND " . $where_end_time['gt'] . " and group_buy_type=0 and brand_buy=0 AND " . $comm2; // $today_mather = group_buy_list($sql_today_mather); $sql_today_baby = $comm . " AND " . $where_start_time['lt'] . " AND " . $where_end_time['gt'] . " and group_buy_type=1 and brand_buy=0 AND " . $comm2; $today_baby = group_buy_list($sql_today_baby); $sql_brand_mum = $comm . " AND " . $where_start_time['lt'] . " AND " . $where_end_time['gt'] . " and group_buy_type=0 and brand_buy=1 AND " . $comm2; $brand_mum = group_buy_list($sql_brand_mum); $sql_brand_baby = $comm . " AND " . $where_start_time['lt'] . " AND " . $where_end_time['gt'] . " and group_buy_type=1 and brand_buy=1 AND " . $comm2; $brand_baby = group_buy_list($sql_brand_baby); $sql_notStart_mum = $comm . " AND b.start_time > '{$now}' AND b.end_time > '{$now}' and group_buy_type=0 AND " . $comm2; $notStart_mum = group_buy_list($sql_notStart_mum); $sql_notStart_baby = $comm . " AND b.start_time > '{$now}' AND b.end_time > '{$now}' and group_buy_type=1 AND " . $comm2; $notStart_baby = group_buy_list($sql_notStart_baby); $notStart_mum = addDate($notStart_mum); $notStart_baby = addDate($notStart_baby); $smarty->assign('today_mather', $today_mather); $smarty->assign('today_baby', $today_baby); $smarty->assign('brand_mum', $brand_mum); $smarty->assign('brand_baby', $brand_baby); $smarty->assign('notStart_mum', $notStart_mum); $smarty->assign('notStart_baby', $notStart_baby); } /* 模板赋值 */ $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题