예제 #1
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     require_once APP_ROOT_PATH . "system/model/event.php";
     //浏览历史
     $history_ids = get_view_history("event");
     //浏览历史
     if ($history_ids) {
         $ids_conditioin = " e.id in (" . implode(",", $history_ids) . ") ";
         $history_deal_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_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);
     }
     //参数处理
     $deal_cate_id = intval($_REQUEST['cid']);
     if ($deal_cate_id) {
         $url_param['cid'] = $deal_cate_id;
     }
     $deal_area_id = intval($_REQUEST['aid']);
     if ($deal_area_id) {
         $url_param['aid'] = $deal_area_id;
     }
     $deal_quan_id = intval($_REQUEST['qid']);
     if ($deal_quan_id) {
         $url_param['qid'] = $deal_quan_id;
     }
     $sort_name = strim($_REQUEST["sort"]);
     if ($sort_name != "submit_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;
     }
     if ($GLOBALS['kw']) {
         $url_param['kw'] = $GLOBALS['kw'];
     }
     //条件初始化
     $condition = " 1=1 ";
     //输出自定义的filter_row
     /* array(
     				"nav_list"=>array(
     						array( //导航类型的切换
     							"current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"),
     							"list"=>array(
     									array("name"=>"xxx","url"=>"xxx")
     								)
     						)
     				),
     				"filter_list"=>array( //列表类型的切换
     					array(
     						"name"=>"分类",
     						"list"	=> array(
     								array("name"=>"xxx","url"=>"xxx")
     						)
     					)		
     				)
     			
     		); */
     //seo元素
     $page_title = "活动";
     $page_keyword = "活动";
     $page_description = "活动";
     $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id']));
     //商圈缓存
     $cate_list = load_auto_cache("cache_event_cate");
     //分类缓存
     $cache_param = array("cid" => $deal_cate_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id']));
     $filter_nav_data = load_auto_cache("event_filter_nav_cache", $cache_param);
     if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) {
         $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "events")));
     }
     //全部
     if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) {
         $filter_row = array();
         $tmp_url_param = $url_param;
         unset($tmp_url_param['cid']);
         unset($tmp_url_param['tid']);
         $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "events", $tmp_url_param));
         $filter_row['list'] = $filter_nav_data['bcate_list'];
         $filter_row_data['nav_list'][] = $filter_row;
         $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title;
         $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name'];
         $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name'];
     } else {
         //输出大分类
         $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']);
     }
     if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) {
         $filter_row = array();
         $tmp_url_param = $url_param;
         unset($tmp_url_param['qid']);
         unset($tmp_url_param['aid']);
         $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "events", $tmp_url_param));
         $filter_row['list'] = $filter_nav_data['bquan_list'];
         $filter_row_data['nav_list'][] = $filter_row;
         //输出小商圈
         if ($filter_nav_data['squan_list']) {
             $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']);
         }
         $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title;
         $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name'];
         $page_description = $page_description . "," . $area_result[$deal_area_id]['name'];
         if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) {
             $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title;
             $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name'];
             $page_description = $page_description . "," . $area_result[$deal_quan_id]['name'];
         }
     } else {
         //输出大商圈
         $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']);
     }
     $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data);
     //输出排序
     $sort_row_data = array();
     /* $sort_row_data = array(
     			"sort"	=> array(
     				array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false")		
     			),
     			"range"	=> array(
     				array
     				(
     					array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"),
     					array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"),
     					array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"),
     					array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"),
     				)
     			),
     			"tag"	=> array(
     				array("name"=>"xxx","url"=>"xxx","checked"=>"true|false")
     			)		
     		); */
     //默认排序
     $tmp_url_param = $url_param;
     unset($tmp_url_param['type']);
     unset($tmp_url_param['sort']);
     if (empty($url_param['sort'])) {
         $current = true;
     } else {
         $current = false;
     }
     $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "events", $tmp_url_param));
     //价格排序
     $tmp_url_param = $url_param;
     if ($tmp_url_param['sort'] == "submit_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'] = "submit_count";
         $tmp_url_param['type'] = "desc";
         $c_sort_type = "desc";
         $current = false;
     }
     $sort_list[] = array("name" => "报名量", "key" => "submit_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "events", $tmp_url_param));
     $sort_row_data['sort'] = $sort_list;
     $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data);
     //开始获取优惠券
     //获取排序条件
     if ($url_param['sort']) {
         $sort_field = "e." . $url_param['sort'] . " " . $url_param['type'];
     }
     require_once APP_ROOT_PATH . "app/Lib/page.php";
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
     $condition_param = $url_param;
     $condition_param['city_id'] = $GLOBALS['city']['id'];
     if ($GLOBALS['kw']) {
         if ($ext_condition != "") {
             $ext_condition .= " and ";
         }
         $ext_condition .= " e.name like '%" . $GLOBALS['kw'] . "%' ";
     }
     $event_result = get_event_list($limit, array(EVENT_NOTICE, EVENT_ONLINE), $condition_param, "", $ext_condition, $sort_field);
     $event_list = $event_result['list'];
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "event as e where " . $event_result['condition'], false);
     $page = new Page($total, app_conf("DEAL_PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('event_list', $event_list);
     $side_event_result = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_NOTICE, EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", " is_recommend = 1 ", " e.submit_count desc ");
     $side_event_list = $side_event_result['list'];
     $GLOBALS['tmpl']->assign('side_event_list', $side_event_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("events.html");
 }
예제 #2
0
 public function index()
 {
     $rss = new UniversalFeedCreator();
     $rss->useCached();
     // use cached version if age<1 hour
     $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE");
     $rss->description = app_conf("SHOP_SEO_TITLE");
     //optional
     $rss->descriptionTruncSize = 500;
     $rss->descriptionHtmlSyndicated = true;
     $rss->link = get_domain() . APP_ROOT;
     $rss->syndicationURL = get_domain() . APP_ROOT;
     //optional
     $image->descriptionTruncSize = 500;
     $image->descriptionHtmlSyndicated = true;
     //对图片路径的修复
     if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
         $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN'];
     } else {
         $domain = SITE_DOMAIN . APP_ROOT;
     }
     $city = City::locate_city();
     $city_id = $city['id'];
     $tuan_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_shop = 0 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc ");
     $tuan_list = $tuan_list['list'];
     foreach ($tuan_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "deal#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $deal_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc ");
     $deal_list = $deal_list['list'];
     foreach ($deal_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "deal#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $youhui_list = get_youhui_list(10, array(YOUHUI_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_effect =1 ", " create_time desc ");
     $youhui_list = $youhui_list['list'];
     foreach ($youhui_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "youhui#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $event_list = get_event_list(10, array(EVENT_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_effect =1 ", " sort asc ");
     $event_list = $event_list['list'];
     foreach ($event_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "event#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml");
 }
예제 #3
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     $id = intval($_REQUEST['act']);
     require_once APP_ROOT_PATH . "system/model/event.php";
     $event = get_event($id);
     if ($event) {
         set_view_history("event", $event['id']);
         $history_ids = get_view_history("event");
         //浏览历史
         if ($history_ids) {
             $ids_conditioin = " e.id in (" . implode(",", $history_ids) . ") ";
             $history_deal_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_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);
         }
         $event['content'] = format_html_content_image($event['content'], 720);
         $event['submitted_data'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where event_id = " . $event['id'] . " and user_id = '" . $GLOBALS['user_info']['id'] . "'");
         $GLOBALS['tmpl']->assign("event", $event);
         $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME);
         //输出右侧的其他优惠券
         $side_event_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "", " e.submit_count desc ");
         $GLOBALS['tmpl']->assign("side_event_list", $side_event_list['list']);
         //关于分类信息与seo
         $page_title = "";
         $page_keyword = "";
         $page_description = "";
         if ($event['supplier_info']['name']) {
             $page_title .= "[" . $event['supplier_info']['name'] . "]";
             $page_keyword .= $event['supplier_info']['name'] . ",";
             $page_description .= $event['supplier_info']['name'] . ",";
         }
         $page_title .= $event['name'];
         $page_keyword .= $event['name'] . ",";
         $page_description .= $event['name'] . ",";
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
         if ($event['cate_id']) {
             $event['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "event_cate where id = " . $event['cate_id']);
             $event['cate_url'] = url("index", "events", array("cid" => $event['cate_id']));
         }
         if ($event['cate_name']) {
             $page_title .= " - " . $event['cate_name'];
             $page_keyword .= $event['cate_name'] . ",";
             $page_description .= $event['cate_name'] . ",";
             $site_nav[] = array('name' => $event['cate_name'], 'url' => $event['cate_url']);
         }
         $site_nav[] = array('name' => $event['name'], 'url' => $event['url']);
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $GLOBALS['tmpl']->assign("page_title", $page_title);
         $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
         $GLOBALS['tmpl']->assign("page_description", $page_description);
         $GLOBALS['tmpl']->display("event.html");
     } else {
         app_redirect_preview();
     }
 }
예제 #4
0
 public function store_load_supplier_event()
 {
     $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/event.php";
     $supplier_data_result = get_event_list($limit, array(EVENT_NOTICE, EVENT_ONLINE), array(), " left join " . DB_PREFIX . "event_location_link as l on e.id = l.event_id ", " 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 . "event as e left join " . DB_PREFIX . "event_location_link as l on e.id = l.event_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_event.html");
     ajax_return($data);
 }