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(); } }
public function store() { global_run(); init_app_page(); $id = intval($_REQUEST['id']); $type = intval($_REQUEST['type']); //0主表 1提交表 require_once APP_ROOT_PATH . "system/model/supplier.php"; if ($type == 0) { $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($store_info) { //开始输出商户图库数据json $store_images = $GLOBALS['db']->getAll("select brief,image from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $store_info['id'] . " and status = 1 order by sort limit " . MAX_SP_IMAGE); foreach ($store_images as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v['image'], 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); } } else { $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_biz_submit where id = " . $id); if ($store_info) { //开始输出商户图库数据json $store_images_rs = unserialize($store_info['cache_supplier_location_images']); foreach ($store_images_rs as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v, 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); } } if ($store_info) { if (!$this->is_manage()) { $account_info = es_session::get('account_info'); if ($store_info['supplier_id'] != $account_info['supplier_id']) { app_redirect(url("index")); } } $store_info['good_rate_precent'] = round($store_info['good_rate'] * 100, 1); $store_info['ref_avg_price'] = round($store_info['ref_avg_price'], 2); $store_info['brief'] = format_html_content_image($store_info['brief'], 720); $GLOBALS['tmpl']->assign("store_info", $store_info); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; $page_title .= $store_info['name']; $page_keyword .= $store_info['name'] . ","; $page_description .= $store_info['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($store_info['deal_cate_id']) { $store_info['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $store_info['deal_cate_id']); $store_info['cate_url'] = url("index", "stores", array("cid" => $store_info['deal_cate_id'])); } if ($store_info['cate_name']) { $page_title .= " - " . $store_info['cate_name']; $page_keyword .= $store_info['cate_name'] . ","; $page_description .= $store_info['cate_name'] . ","; $site_nav[] = array('name' => $store_info['cate_name'], 'url' => $store_info['cate_url']); } $site_nav[] = array('name' => $store_info['name'], 'url' => $store_info['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); if ($store_info['seo_title']) { $page_title = $store_info['seo_title']; } if ($store_info['seo_keyword']) { $page_keyword = $store_info['seo_keyword']; } if ($store_info['seo_description']) { $page_description = $store_info['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); } else { app_redirect_preview(); } $GLOBALS['tmpl']->assign("preview", true); $GLOBALS['tmpl']->display("store.html"); }
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(); } }
public function index() { if (trim($_REQUEST['act']) == "print") { $this->doprint(); exit; } global_run(); init_app_page(); $id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui = get_youhui($id); if ($youhui) { set_view_history("youhui", $youhui['id']); $history_ids = get_view_history("youhui"); //浏览历史 if ($history_ids) { $ids_conditioin = " y.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_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); } $youhui['description'] = format_html_content_image($youhui['description'], 720); $youhui['use_notice'] = format_html_content_image($youhui['use_notice'], 720); $GLOBALS['tmpl']->assign("youhui", $youhui); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他优惠券 $side_youhui_list = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "", " y.user_count desc "); $GLOBALS['tmpl']->assign("side_youhui_list", $side_youhui_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($youhui['supplier_info']['name']) { $page_title .= "[" . $youhui['supplier_info']['name'] . "]"; $page_keyword .= $youhui['supplier_info']['name'] . ","; $page_description .= $youhui['supplier_info']['name'] . ","; } $page_title .= $youhui['name']; $page_keyword .= $youhui['name'] . ","; $page_description .= $youhui['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($youhui['deal_cate_id']) { $youhui['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $youhui['deal_cate_id']); $youhui['cate_url'] = url("index", "youhuis", array("cid" => $youhui['deal_cate_id'])); } if ($youhui['cate_name']) { $page_title .= " - " . $youhui['cate_name']; $page_keyword .= $youhui['cate_name'] . ","; $page_description .= $youhui['cate_name'] . ","; $site_nav[] = array('name' => $youhui['cate_name'], 'url' => $youhui['cate_url']); } $site_nav[] = array('name' => $youhui['name'], 'url' => $youhui['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("youhui.html"); } else { app_redirect_preview(); } }
function getGoodsArray($item) { /** * has_attr: 0:无属性; 1:有属性 * 有商品属性在要购买时,要选择属性后,才能购买(用户在列表中点:购买时,要再弹出一个:商品属性选择对话框) * change_cart_request_server: * 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示) * 0:提交,1:不提交; * * num_unit: 单位 * limit_num: 库存数量 * */ $goods = array(); $goods['city_name'] = ""; $goods['goods_id'] = $item['id']; $goods['title'] = emptyTag($item['name']); if (empty($item['sub_name'])) { $goods['sub_name'] = emptyTag($item['name']); } else { $goods['sub_name'] = emptyTag($item['sub_name']); } //$goods['image']=get_abs_img_root(make_img($item['img'],0)); $goods['image'] = get_abs_img_root(get_spec_image($item['img'], 320, 194, 1)); //get_abs_img_root( get_spec_image($v['o_path'],160,0,0)); $goods['buy_count'] = $item['buy_count']; $goods['start_date'] = $item['begin_time']; $goods['end_date'] = $item['end_time']; $goods['ori_price'] = round($item['origin_price'], 2); $goods['cur_price'] = round($item['current_price'], 2); if (empty($item['brief'])) { $goods['goods_brief'] = $item['name']; } else { $goods['goods_brief'] = $item['brief']; } $goods['ori_price_format'] = format_price($goods['ori_price']); $goods['cur_price_format'] = format_price($goods['cur_price']); $goods['discount'] = $item['discount']; $sp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $item['supplier_id'] . " order by is_main desc"); $goods['address'] = $sp_info['address']; // 地址未完 $goods['num_unit'] = ""; //$item['num_unit']; $limit_num = intval($item['max_bought']); //如果库存为0时,不设置为:99999,不限制购买数量; if ($limit_num == 0) { $limit_num = 99999; } $goods['limit_num'] = $limit_num; $goods['goods_desc'] = $item['description']; $goods['is_shop'] = $item['is_shop']; $goods['is_hot'] = $item['is_hot']; $goods['notes'] = $item['notes']; $goods['package'] = $item['package']; $goods['supplier_location_id'] = $GLOBALS['db']->getOne("select location_id from " . DB_PREFIX . "deal_location_link where deal_id = " . $item['id']); $goods['any_refund'] = $item['any_refund']; $goods['expire_refund'] = $item['expire_refund']; //标签列表 //支持随时退款 $ext_label = array(); if ($goods['any_refund'] == 1) { $ext_label[] = array('type' => 0, 'ico' => '', 'name' => '支持随时退款'); } //支持过期退款 if ($goods['expire_refund'] == 1) { $ext_label[] = array('type' => 1, 'ico' => '', 'name' => '支持过期退款'); } $goods['ext_label'] = $ext_label; $goods['time_status'] = $item['time_status']; $goods['end_time'] = $item['end_time']; $goods['begin_time'] = $item['begin_time']; $goods['sp_location_id'] = $sp_info['id']; //供应商信息 $goods['sp_detail'] = $sp_info['name']; //供应商信息 $goods['sp_tel'] = $sp_info['tel']; /*供应商电话*/ $pattern = "/<img([^>]*)\\/>/i"; $replacement = "<img width=300 \$1 />"; $goods['goods_desc'] = get_abs_img_root(format_html_content_image($goods['goods_desc'], 300)); $goods['goods_desc'] = preg_replace($pattern, $replacement, $goods['goods_desc']); $goods['saving_format'] = $item['save_price_format']; if ($goods['end_date'] == 0) { $goods['less_time'] = "none"; //永不过期,无倒计时 $goods['less_time_format'] = "999天"; //永不过期,无倒计时 } else { $goods['less_time'] = $goods['end_date'] - get_gmtime(); if ($goods['less_time'] < 0) { $goods['less_time'] = 0; } $goods['less_time_format'] = getTimeFormat($goods['less_time']); } $goods['has_attr'] = 0; //has_attr: 0:无属性; 1:有属性 if ($item['is_delivery'] == 1) { $goods['has_delivery'] = 1; $goods['has_mcod'] = 1; } else { $goods['has_delivery'] = 0; $goods['has_mcod'] = 0; } if ($goods['cart_type'] == 0) { $goods['has_cart'] = 1; //1:可以跟其它商品一起放入购物车购买;0:不能放入购物车,只能独立购买 } else { $goods['has_cart'] = 0; } $goods['change_cart_request_server'] = 1; $goods['is_refund'] = $item['is_refund']; /*0:不支持退款; 1:支持退款*/ $goods['avg_point'] = $item['avg_point']; /*购买点评平均分*/ $goods['distance'] = $item['distance']; $goods['attr'] = getAttrArray($item['id']); if (intval($goods['attr']['has_attr_1']) > 0 || intval($goods['attr']['has_attr_2']) > 0) { $goods['has_attr'] = 1; } //$goods['share_content']=msubstr($topic['content']).get_domain().str_replace("mapi/","",url("shop","topic",array("id"=>$topic['id']))); $goods['share_url'] = get_domain() . str_replace("sjmapi/", "", url("index", "deal#" . $item['id'])); $goods['share_content'] = emptyTag($item['name']) . $goods['share_url']; return $goods; }
public function index() { global_run(); init_app_page(); $store_id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/supplier.php"; $store_info = get_location($store_id); if ($store_info) { set_view_history("store", $store_info['id']); $history_ids = get_view_history("store"); //浏览历史 if ($history_ids) { $ids_conditioin = " sl.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_location_list(app_conf("SIDE_DEAL_COUNT"), 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); } $store_info['good_rate_precent'] = round($store_info['good_rate'] * 100, 1); $store_info['ref_avg_price'] = round($store_info['ref_avg_price'], 2); $store_info['brief'] = format_html_content_image($store_info['brief'], 720); $GLOBALS['tmpl']->assign("store_info", $store_info); //开始输出商户图库数据json $store_images = $GLOBALS['db']->getAll("select brief,image from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $store_info['id'] . " and status = 1 order by sort limit " . MAX_SP_IMAGE); foreach ($store_images as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v['image'], 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; $page_title .= $store_info['name']; $page_keyword .= $store_info['name'] . ","; $page_description .= $store_info['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($store_info['deal_cate_id']) { $store_info['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $store_info['deal_cate_id']); $store_info['cate_url'] = url("index", "stores", array("cid" => $store_info['deal_cate_id'])); } if ($store_info['cate_name']) { $page_title .= " - " . $store_info['cate_name']; $page_keyword .= $store_info['cate_name'] . ","; $page_description .= $store_info['cate_name'] . ","; $site_nav[] = array('name' => $store_info['cate_name'], 'url' => $store_info['cate_url']); } $site_nav[] = array('name' => $store_info['name'], 'url' => $store_info['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); if ($store_info['seo_title']) { $page_title = $store_info['seo_title']; } if ($store_info['seo_keyword']) { $page_keyword = $store_info['seo_keyword']; } if ($store_info['seo_description']) { $page_description = $store_info['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); //输出右侧的其他团购 require_once APP_ROOT_PATH . "system/model/deal.php"; $side_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $store_info['deal_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 "); //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); } else { app_redirect_preview(); } $GLOBALS['tmpl']->display("store.html"); }