示例#1
0
 public function index()
 {
     //用于重写模式下的城市定位跳转
     $act = strim($_REQUEST['act']);
     if ($act) {
         require_once APP_ROOT_PATH . "system/model/city.php";
         $_GET['city'] = $act;
         City::locate_city();
         app_redirect(url("index"));
     }
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME);
     if (!$GLOBALS['tmpl']->is_cached('city_index.html', $cache_id)) {
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
         $site_nav[] = array('name' => $GLOBALS['lang']['SWITCH_CITY'], 'url' => url("index", "city"));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $city_lists = load_auto_cache("city_list_result");
         //print_r($city_lists);
         $GLOBALS['tmpl']->assign("city_lists", $city_lists['zm']);
         $province_list = $GLOBALS['db']->getAll("select id,name,uname from " . DB_PREFIX . "deal_city where pid=0 and is_effect=1 order by uname asc");
         foreach ($province_list as $k => $v) {
             $province_new[$v['id']] = $v;
             $province_new[$v['id']]['city_list'] = $GLOBALS['db']->getAll("select id,name,uname from " . DB_PREFIX . "deal_city where is_effect=1 and pid = " . $v['id'] . " order by uname asc");
             foreach ($province_new[$v['id']]['city_list'] as $kk => $vv) {
                 $province_new[$v['id']]['city_list'][$kk]['url'] = url("index", "index", array("city" => $vv['uname']));
             }
         }
         //print_r($province_new);
         $GLOBALS['tmpl']->assign("province_list", $province_new);
         $GLOBALS['tmpl']->assign("city_json", json_encode($province_new));
         $GLOBALS['tmpl']->assign("city_lists_data", $city_lists['ls']);
     }
     $GLOBALS['tmpl']->display("city_index.html", $cache_id);
 }
示例#2
0
 public function index()
 {
     //print_r($GLOBALS['request']);
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $id = intval($GLOBALS['request']['id']);
     $city_id = intval($GLOBALS['request']['city_id']);
     $act_2 = $GLOBALS['request']['act_2'];
     //子操作 空:没子操作; dz:设置打折提醒
     if ($act_2 != '' && $user_id == 0) {
         $root['act_2'] = $act_2;
         $root['user_login_status'] = 0;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         output($root);
     }
     $ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
     //ypoint
     $xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
     //xpoint
     $pi = 3.14159265;
     //圆周率
     $r = 6378137;
     //地球平均半径(米)
     $sql = "select a.id,a.name,a.avg_point,a.address,a.api_address,a.supplier_id,a.tel,a.dp_count,a.avg_point,a.supplier_id as brand_id,a.brief,a.preview as logo,a.xpoint,a.ypoint,a.route,a.youhui_count,a.event_count,(select count(*) from " . DB_PREFIX . "supplier_location_dp as dp where dp.supplier_location_id = a.id and dp.status = 1) as comment_count, c.name as city_name, \n\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((a.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((a.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (a.xpoint * {$pi}) / 180 ) ) * {$r}) as distance \n\t\t  from " . DB_PREFIX . "supplier_location as a " . " left outer join " . DB_PREFIX . "deal_city as c on c.id = a.city_id " . "where a.id = {$id} ";
     //file_put_contents(APP_ROOT_PATH. "sjmapi/log/sql_".strftime("%Y%m%d%H%M%S",time()).".txt",$sql);
     $list = $GLOBALS['db']->getRow($sql);
     $root = m_merchantItem($list);
     //is_auto_order 1:手机自主下单;消费者(在手机端上)可以直接给该门店支付金额
     $sql = "select is_auto_order from  " . DB_PREFIX . "supplier_location where id = " . $id;
     $is_auto_order = $GLOBALS['db']->getOne($sql);
     $root['is_auto_order'] = intval($is_auto_order);
     //$root['is_auto_order'] = 0;
     //其它门店
     $sql = "select a.id,a.name,a.avg_point,a.address,a.api_address,a.supplier_id,a.tel,a.dp_count,a.avg_point,a.supplier_id as brand_id,a.brief,a.preview as logo,a.xpoint,a.ypoint,a.route,a.youhui_count,a.event_count,(select count(*) from " . DB_PREFIX . "supplier_location_dp as dp where dp.supplier_location_id = a.id and dp.status = 1) as comment_count, c.name as city_name,\n\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((a.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((a.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (a.xpoint * {$pi}) / 180 ) ) * {$r}) as distance\n\t\tfrom " . DB_PREFIX . "supplier_location as a " . " left outer join " . DB_PREFIX . "deal_city as c on c.id = a.city_id " . "where a.id != {$id} and a.supplier_id =" . intval($root['supplier_id']);
     //$root['ss'] = $sql;
     $other_supplier_location = $GLOBALS['db']->getAll($sql);
     if ($other_supplier_location === false) {
         $root['other_supplier_location'] = array();
     } else {
         foreach ($other_supplier_location as $k => $v) {
             $other_supplier_location[$k]['logo'] = get_abs_img_root($v['logo']);
         }
         $root['other_supplier_location'] = $other_supplier_location;
     }
     /*门店团购*/
     $time = get_gmtime();
     $t_where = "where b.location_id=" . $list['id'] . " and a.is_shop=0 and a.is_effect=1 and a.is_delete=0  and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0)) and a.buy_status <> 2";
     $g_where = "where b.location_id=" . $list['id'] . " and a.is_shop=1 and a.is_effect=1 and a.is_delete=0  and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0)) and a.buy_status <> 2";
     $y_where = "where a.is_effect = 1 and b.location_id=" . $list['id'] . " and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0))";
     if ($city_id == 0) {
         require_once APP_ROOT_PATH . "system/model/city.php";
         $city = City::locate_city();
         $city_id = $city['id'];
     }
     if ($city_id > 0) {
         $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id));
         if ($ids) {
             $t_where .= " and a.city_id in (" . implode(",", $ids) . ")";
             $g_where .= " and a.city_id in (" . implode(",", $ids) . ")";
             $y_where .= " and a.city_id in (" . implode(",", $ids) . ")";
         }
     }
     $tuan_list = $GLOBALS['db']->getAll("select a.brief,a.auto_order,a.id,a.name,a.sub_name,a.origin_price,a.current_price,a.img,a.buy_count,a.discount from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $t_where . " order by a.sort desc,a.id desc");
     $tuan_count = $GLOBALS['db']->getOne("select count(a.id) from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $t_where . "");
     foreach ($tuan_list as $k => $v) {
         $tuan_list[$k]['origin_price'] = round($v['origin_price'], 2);
         $tuan_list[$k]['current_price'] = round($v['current_price'], 2);
         if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
             //手动折扣
             $tuan_list[$k]['save_price'] = round($v['origin_price'] - $v['current_price'], 2);
         } else {
             $tuan_list[$k]['save_price'] = round($v['origin_price'] * ((10 - $v['discount']) / 10), 2);
         }
         if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
             $tuan_list[$k]['discount'] = round($v['current_price'] / $v['origin_price'] * 10, 2);
         }
         $tuan_list[$k]['discount'] = round($tuan_list[$k]['discount'], 2);
         $tuan_list[$k]['img'] = get_abs_img_root(get_spec_image($v['img'], 140, 85, 0));
         if (empty($v['brief'])) {
             $tuan_list[$k]['brief'] = $v['name'];
             $tuan_list[$k]['name'] = $v['sub_name'];
         }
     }
     if ($tuan_list === false) {
         $root['tuan_list'] = array();
     } else {
         $root['tuan_list'] = $tuan_list;
     }
     $root['tuan_count'] = $tuan_count;
     /*门店商品*/
     $goods_list = $GLOBALS['db']->getAll("select a.brief,a.id,a.is_hot,a.name,a.sub_name,a.origin_price,a.current_price,a.img,a.buy_count,a.discount from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $g_where . " order by a.sort desc,a.id desc");
     foreach ($goods_list as $k => $v) {
         $goods_list[$k]['origin_price'] = round($v['origin_price'], 2);
         $goods_list[$k]['current_price'] = round($v['current_price'], 2);
         if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
             //手动折扣
             $goods_list[$k]['save_price'] = round($v['origin_price'] - $v['current_price'], 2);
         } else {
             $goods_list[$k]['save_price'] = round($v['origin_price'] * ((10 - $v['discount']) / 10), 2);
         }
         if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
             $goods_list[$k]['discount'] = round($v['current_price'] / $v['origin_price'] * 10, 2);
         }
         $goods_list[$k]['discount'] = round($goods_list[$k]['discount'], 2);
         $goods_list[$k]['img'] = get_abs_img_root(get_spec_image($v['img'], 140, 85, 0));
         if (empty($v['brief'])) {
             $goods_list[$k]['brief'] = $v['name'];
             $goods_list[$k]['name'] = $v['sub_name'];
         }
     }
     if ($goods_list === false) {
         $root['goods_list'] = array();
     } else {
         $root['goods_list'] = $goods_list;
     }
     /*优惠券*/
     $youhui_list = $GLOBALS['db']->getAll("select a.id,a.supplier_id as merchant_id,a.begin_time,a.youhui_type,a.total_num,a.end_time,a.name as title,a.list_brief as content,a.icon as merchant_logo,a.create_time,a.address as api_address,a.view_count,a.print_count,a.sms_count from " . DB_PREFIX . "youhui as a left join " . DB_PREFIX . "youhui_location_link as b on b.youhui_id=a.id " . $y_where . " order by a.sort desc,a.id desc");
     $sql = "select a.id,a.supplier_id as merchant_id,a.begin_time,a.youhui_type,a.total_num,a.end_time,a.name as title,a.list_brief as content,a.icon as merchant_logo,a.create_time,a.address as api_address,a.view_count,a.print_count,a.sms_count from " . DB_PREFIX . "youhui as a left join " . DB_PREFIX . "youhui_location_link as b on b.youhui_id=a.id " . $y_where . " order by a.sort desc,a.id desc";
     $youhui_list = $GLOBALS['db']->getAll($sql);
     foreach ($youhui_list as $k => $v) {
         $youhui_list[$k]['merchant_logo'] = get_abs_img_root(get_spec_image($v['merchant_logo'], 140, 85, 0));
         $youhui_list[$k]['down_count'] = $youhui_list[$k]['sms_count'] + $youhui_list[$k]['print_count'];
         $youhui_list[$k]['begin_time'] = to_date($v['begin_time'], "Y-m-d") . '至' . to_date($v['end_time'], "Y-m-d");
     }
     if ($youhui_list === false) {
         $root['youhui_list'] = array();
     } else {
         $root['youhui_list'] = $youhui_list;
     }
     /*门店评论*/
     // 		$comment_list=$GLOBALS['db']->getAll("select a.id,a.content,a.point,a.avg_price,a.create_time,b.id as user_id,b.user_name from ".DB_PREFIX."supplier_location_dp as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$list['id']." and a.status = 1 limit 10");
     // 		$comment_count=$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."supplier_location_dp as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$list['id']." and a.status = 1");
     // 		foreach($comment_list as $k=>$v)
     // 		{
     // 			$comment_list[$k]['avg_price']=round($v['avg_price'],1);
     // 			$comment_list[$k]['time']=pass_date($v['create_time']);
     // 			$comment_list[$k]['width']=$v['avg_point'] > 0 ? ($v['avg_point'] / 5) * 90 : 0;
     // 		}
     // 		if ($comment_list === false){
     // 			$root['comment_list']= array();
     // 		}else{
     // 			$root['comment_list']=$comment_list;
     // 		}
     // 		$root['comment_count']=$comment_count;
     require_once APP_ROOT_PATH . "system/model/review.php";
     require_once APP_ROOT_PATH . "system/model/user.php";
     $message_re = get_dp_list(3, $param = array("deal_id" => 0, "youhui_id" => 0, "event_id" => 0, "location_id" => $list['id'], "tag" => ""), "", "");
     foreach ($message_re['list'] as $k => $v) {
         $message_re['list'][$k]['width'] = $v['point'] / 5 * 100;
         $uinfo = load_user($v['user_id']);
         $message_re['list'][$k]['user_name'] = $uinfo['user_name'];
         foreach ($message_re['list'][$k]['images'] as $kk => $vv) {
             $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1));
             $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv);
         }
     }
     $root['message_list'] = $message_re['list'];
     if (count($message_re['list']) > 0) {
         $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where  " . $message_re['condition'];
         $message_re['count'] = $GLOBALS['db']->getOne($sql);
     }
     $root['message_count'] = $message_re['count'];
     if ($act_2 == "dz") {
         $sql = "select uid from  " . DB_PREFIX . "supplier_dy where uid = {$user_id} and supplier_id = " . $list['brand_id'];
         if (intval($GLOBALS['db']->getOne($sql) > 0)) {
             //已经设置打折提醒,则取消
             $sql = "delete from " . DB_PREFIX . "supplier_dy where uid = {$user_id} and supplier_id = " . $list['brand_id'];
             $GLOBALS['db']->query($sql);
         } else {
             //没设置,则设置
             $merchant_dy = array('uid' => $user_id, 'supplier_id' => $list['brand_id']);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_dy", $merchant_dy, 'INSERT');
         }
     }
     $root['is_dy'] = $GLOBALS['db']->getOne("select uid from " . DB_PREFIX . "supplier_dy where uid = {$user_id} and supplier_id = " . $list['brand_id'] . " ");
     $root['return'] = 1;
     $root['user_login_status'] = 1;
     $root['page_title'] = "商家详情";
     output($root);
 }
示例#3
0
 public function index()
 {
     $device_type = strim($GLOBALS['request']['device_type']);
     //苹果端值是:ios  安卓端值是:android
     $cur_city_id = intval($GLOBALS['request']['cur_city_id']);
     if ($cur_city_id == 0) {
         //$deal_city = get_current_deal_city(false);//默认城市id
         require_once APP_ROOT_PATH . "system/model/city.php";
         $deal_city = City::locate_city();
         //print_r($deal_city); exit;
         $cur_city_id = $deal_city['id'];
         $city_name = $deal_city['name'];
     } else {
         $city_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_city where id = " . $cur_city_id);
     }
     $root = array();
     $root['return'] = 1;
     $root['session_id'] = es_session::id();
     $root['city_id'] = $cur_city_id;
     $root['city_name'] = $city_name;
     $root['catalog_id'] = intval($GLOBALS['m_config']['catalog_id']);
     //团购,优惠券默认分类id
     $root['catalog_id_name'] = $GLOBALS['m_config']['catalog_id_name'];
     $root['shop_cate_id'] = intval($GLOBALS['m_config']['shop_cate_id']);
     //商城默认分类id
     $root['shop_cate_id_name'] = $GLOBALS['m_config']['shop_cate_id_name'];
     $root['event_cate_id'] = intval($GLOBALS['m_config']['event_cate_id']);
     //活动默认分类id
     $root['event_cate_id_name'] = $GLOBALS['m_config']['event_cate_id_name'];
     $root['citylist'] = getCityArray();
     //$root['cataloglist'] = getCatalogArray();
     //$root['cataloglistsearch'] = getCatalogArraySearch();
     $root['region_version'] = intval($GLOBALS['m_config']['region_version']);
     //当前配送地区的数据版本(如果大于客户端的版本号,则客户端在选择,配送地区时会提示升级),int 数字类型
     $root['only_one_delivery'] = intval($GLOBALS['m_config']['only_one_delivery']);
     //1:会员只有一个配送地址;0:会员可以有多个配送地址
     $root['kf_phone'] = $GLOBALS['m_config']['kf_phone'];
     //客服电话
     $root['kf_email'] = $GLOBALS['m_config']['kf_email'];
     //客服邮箱
     $root['about_info'] = $GLOBALS['m_config']['about_info'];
     $root['version'] = VERSION;
     //接口版本号int
     $root['page_size'] = PAGE_SIZE;
     //默认分页大小
     $root['has_region'] = intval($GLOBALS['m_config']['has_region']);
     $root['newslist'] = $GLOBALS['m_config']['newslist'];
     $root['program_title'] = $GLOBALS['m_config']['program_title'];
     $root['addr_tlist'] = $GLOBALS['m_config']['addr_tlist'];
     //保存地址标题
     //$root['adv_youhui'] = m_adv_youhui($cur_city_id);
     $root['quanlist'] = getQuanArray($cur_city_id);
     //商圈列表
     $root['deal_cate_list'] = getDealCateArray();
     //优惠券分类
     $root['index_logo'] = get_abs_img_root($GLOBALS['m_config']['index_logo']);
     //新浪  分享,登陆 功能
     if (strim($GLOBALS['m_config']['sina_app_key']) != "" && strim($GLOBALS['m_config']['sina_app_secret']) != "") {
         $root['api_sina'] = 1;
         $root['sina_app_key'] = $GLOBALS['m_config']['sina_app_key'];
         $root['sina_app_secret'] = $GLOBALS['m_config']['sina_app_secret'];
         $root['sina_bind_url'] = $GLOBALS['m_config']['sina_bind_url'];
     }
     /*
     		//无效,删除
     		if(strim($GLOBALS['m_config']['tencent_app_key'])!=""&&strim($GLOBALS['m_config']['tencent_app_secret'])!="")
     		{
     			$root['api_tencent'] = 1;
     			$root['tencent_app_key'] = $GLOBALS['m_config']['tencent_app_key'];
     			$root['tencent_app_secret'] = $GLOBALS['m_config']['tencent_app_secret'];
     			$root['tencent_bind_url'] = $GLOBALS['m_config']['tencent_bind_url'];
     		}*/
     //QQ登陆
     if (strim($GLOBALS['m_config']['qq_app_key']) != "" && strim($GLOBALS['m_config']['qq_app_secret']) != "") {
         $root['api_qq'] = 1;
         $root['qq_app_key'] = $GLOBALS['m_config']['qq_app_key'];
         $root['qq_app_secret'] = $GLOBALS['m_config']['qq_app_secret'];
     }
     //微信分享功能
     if (strim($GLOBALS['m_config']['wx_app_key']) != "" && strim($GLOBALS['m_config']['wx_app_secret']) != "") {
         $root['api_wx'] = 1;
         $root['wx_app_key'] = $GLOBALS['m_config']['wx_app_key'];
         $root['wx_app_secret'] = $GLOBALS['m_config']['wx_app_secret'];
     }
     $start_page = array();
     if ($GLOBALS['m_config']['start_page1']) {
         $start_page_item = array("img" => $GLOBALS['m_config']['start_page1'] ? get_abs_img_root($GLOBALS['m_config']['start_page1']) : "", "url" => $GLOBALS['m_config']['start_page1_url'] ? get_abs_img_root($GLOBALS['m_config']['start_page1_url']) : "");
         $start_page[] = $start_page_item;
     }
     if ($GLOBALS['m_config']['start_page2']) {
         $start_page_item = array("img" => $GLOBALS['m_config']['start_page2'] ? get_abs_img_root($GLOBALS['m_config']['start_page2']) : "", "url" => $GLOBALS['m_config']['start_page2_url'] ? get_abs_img_root($GLOBALS['m_config']['start_page2_url']) : "");
         $start_page[] = $start_page_item;
     }
     if ($GLOBALS['m_config']['start_page3']) {
         $start_page_item = array("img" => $GLOBALS['m_config']['start_page3'] ? get_abs_img_root($GLOBALS['m_config']['start_page3']) : "", "url" => $GLOBALS['m_config']['start_page3_url'] ? get_abs_img_root($GLOBALS['m_config']['start_page3_url']) : "");
         $start_page[] = $start_page_item;
     }
     $rk = rand(0, count($start_page) - 1);
     $start_page_item = $start_page[$rk];
     $root['start_page'] = $start_page_item;
     output($root);
 }
示例#4
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");
 }
示例#5
0
文件: functions.php 项目: macall/jsd
function m_search_event_list($limit, $cate_id = 0, $city_id = 0, $where = '', $orderby = '', $field_append = "")
{
    $count_sql = "select count(*) from " . DB_PREFIX . "event ";
    $sql = "select * {$field_append} from " . DB_PREFIX . "event ";
    $count_sql .= " where is_effect = 1 ";
    $sql .= " where is_effect = 1  ";
    if ($cate_id > 0) {
        $sql .= " and cate_id = " . $cate_id . " ";
        $count_sql .= " and cate_id = " . $cate_id . " ";
    }
    if ($city_id == 0) {
        require_once APP_ROOT_PATH . "system/model/city.php";
        $city = City::locate_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) . ")";
        }
    }
    $merchant_id = intval($GLOBALS['request']['merchant_id']);
    if ($merchant_id > 0) {
        $event_ids = $GLOBALS['db']->getOne("select group_concat(event_id) from " . DB_PREFIX . "event_location_link where location_id = " . $merchant_id);
        if ($event_ids) {
            $sql .= " and id in (" . $event_ids . ")";
            $count_sql .= " and id in (" . $event_ids . ")";
        } else {
            $sql .= " and id = 0 ";
            $count_sql .= " and id = 0 ";
        }
    }
    if ($where != '') {
        $sql .= " and " . $where;
        $count_sql .= " and " . $where;
    }
    if ($orderby == '') {
        $sql .= " order by is_recommend desc,sort desc,id desc limit " . $limit;
    } else {
        $sql .= " order by " . $orderby . " limit " . $limit;
    }
    $events = $GLOBALS['db']->getAll($sql);
    $events_count = $GLOBALS['db']->getOne($count_sql);
    $res = array('list' => $events, 'count' => $events_count);
    return $res;
}
示例#6
0
文件: index.php 项目: macall/jishida
    $api_log['parms'] = print_r($request, true);
    $GLOBALS['db']->autoExecute(DB_PREFIX . "api_log", $api_log, 'INSERT');
}
$sessid = $request['session_id'];
if (empty($sessid)) {
    $session_id = es_session::id();
    $request['session_id'] = $sessid;
}
es_session::set_sessid($sessid);
require_once APP_ROOT_PATH . "system/model/user.php";
$city_id = intval($request['city_id']);
if ($city_id > 0) {
    $_GET['city'] = $city_id;
}
require_once APP_ROOT_PATH . "system/model/city.php";
$GLOBALS['city'] = City::locate_city();
$GLOBALS['user_info'] = es_session::get("user_info");
if (empty($GLOBALS['user_info']) && $class != 'login') {
    $cookie_uname = strim($request['email']);
    //用户名或邮箱
    $cookie_upwd = strim($request['pwd']);
    //密码
    if ($cookie_uname != '' && $cookie_upwd != '') {
        $cookie_uname = strim($cookie_uname);
        if (strlen($cookie_upwd) != 32) {
            $cookie_upwd = md5($cookie_upwd);
        }
        $cookie_upwd = md5($cookie_upwd . "_EASE_COOKIE");
        auto_do_login_user($cookie_uname, $cookie_upwd);
        $GLOBALS['user_info'] = es_session::get('user_info');
    }
示例#7
0
文件: main_lib.php 项目: macall/jsd
/**
 * 前端全运行函数,生成系统前台使用的全局变量
 * 1. 定位城市 GLOBALS['city'];
 * 2. 加载会员 GLOBALS['user_info'];
 * 3. 生成语言包
 * 4. 加载推荐人与来路
 * 5. 更新购物车
 */
function global_run()
{
    if (app_conf("SHOP_OPEN") == 0) {
        app_redirect(url("index", "close"));
    }
    //处理城市
    global $city;
    require_once APP_ROOT_PATH . "system/model/city.php";
    $city = City::locate_city();
    global $geo;
    $geo = City::locate_geo(floatval($_REQUEST['xpoint']), floatval($_REQUEST['ypoint']));
    //输出语言包的js
    if (!file_exists(get_real_path() . "public/runtime/app/lang.js")) {
        $str = "var LANG = {";
        foreach ($GLOBALS['lang'] as $k => $lang_row) {
            $str .= "\"" . $k . "\":\"" . str_replace("nbr", "\\n", addslashes($lang_row)) . "\",";
        }
        $str = substr($str, 0, -1);
        $str .= "};";
        @file_put_contents(get_real_path() . "public/runtime/app/lang.js", $str);
    }
    //会员自动登录及输出
    global $user_info;
    global $user_logined;
    require_once APP_ROOT_PATH . "system/model/user.php";
    $user_info = es_session::get('user_info');
    if (empty($user_info)) {
        $cookie_uname = es_cookie::get("user_name") ? es_cookie::get("user_name") : '';
        $cookie_upwd = es_cookie::get("user_pwd") ? es_cookie::get("user_pwd") : '';
        if ($cookie_uname != '' && $cookie_upwd != '' && !es_session::get("user_info")) {
            $cookie_uname = strim($cookie_uname);
            $cookie_upwd = strim($cookie_upwd);
            auto_do_login_user($cookie_uname, $cookie_upwd);
            $user_info = es_session::get('user_info');
        }
    }
    refresh_user_info();
    //刷新购物车
    require_once APP_ROOT_PATH . "system/model/cart.php";
    refresh_cart_list();
    global $ref_uid;
    //保存返利的cookie
    if ($_REQUEST['r']) {
        $rid = intval(base64_decode($_REQUEST['r']));
        $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval($rid)));
        es_cookie::set("REFERRAL_USER", intval($ref_uid));
    } else {
        //获取存在的推荐人ID
        if (intval(es_cookie::get("REFERRAL_USER")) > 0) {
            $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval(es_cookie::get("REFERRAL_USER"))));
        }
    }
    global $referer;
    //保存来路
    // 	es_cookie::delete("referer_url");
    if (!es_cookie::get("referer_url")) {
        if (!preg_match("/" . urlencode(SITE_DOMAIN . APP_ROOT) . "/", urlencode($_SERVER["HTTP_REFERER"]))) {
            $ref_url = $_SERVER["HTTP_REFERER"];
            if (substr($ref_url, 0, 7) == "http://" || substr($ref_url, 0, 8) == "https://") {
                preg_match("/http[s]*:\\/\\/[^\\/]+/", $ref_url, $ref_url);
                $referer = $ref_url[0];
                if ($referer) {
                    es_cookie::set("referer_url", $referer);
                }
            }
        }
    } else {
        $referer = es_cookie::get("referer_url");
    }
    $referer = strim($referer);
}
示例#8
0
 public function load_business_address()
 {
     $city_id = intval($_REQUEST['city_id']);
     //城市ID
     require_once APP_ROOT_PATH . "system/model/city.php";
     $city = City::locate_city();
     if ($city_id == 0) {
         $city_id = $city['id'];
     }
     $aid = intval($_REQUEST['aid']);
     //行政区ID
     $qid = intval($_REQUEST['qid']);
     //商圈ID
     $deal_id = intval($_REQUEST['deal_id']);
     //商品ID
     $event_id = intval($_REQUEST['event_id']);
     //活动ID
     $youhui_id = intval($_REQUEST['youhui_id']);
     //优惠券ID
     $supplier_id = intval($_REQUEST['supplier_id']);
     //商家ID
     if ($deal_id > 0) {
         $join = " left join " . DB_PREFIX . "deal_location_link as l on sl.id = l.location_id ";
         $where = " sl.supplier_id = " . $supplier_id . " and l.deal_id = " . $deal_id . " ";
     } elseif ($event_id > 0) {
         $join = " left join " . DB_PREFIX . "event_location_link as l on sl.id = l.location_id ";
         $where = " sl.supplier_id = " . $supplier_id . " and l.event_id = " . $event_id . " ";
     } elseif ($youhui_id > 0) {
         $join = " left join " . DB_PREFIX . "youhui_location_link as l on sl.id = l.location_id ";
         $where = " sl.supplier_id = " . $supplier_id . " and l.youhui_id = " . $youhui_id . " ";
     } else {
         $join = "";
         $where = " sl.supplier_id = " . $supplier_id . " ";
     }
     //$join = "";
     //$where = "";
     $page_size = 3;
     require_once APP_ROOT_PATH . "system/model/supplier.php";
     require_once APP_ROOT_PATH . "app/Lib/page.php";
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $location_list = get_location_list($limit, array("city_id" => $city_id, "aid" => $aid, "qid" => $qid), $join, $where);
     if ($join) {
         $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location as sl " . $join . " where " . $location_list['condition']);
     } else {
         $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location as sl where " . $location_list['condition']);
     }
     $page = new Page($total, $page_size, "", "short");
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     //获取城市列表
     $city_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_city where is_effect = 1 order by sort asc");
     foreach ($city_list as $k => $v) {
         if ($v['id'] == $city_id) {
             $city_list[$k]['current'] = true;
         }
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     //获取地区
     if ($city_id > 0) {
         $area_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "area WHERE pid=0 AND city_id=" . $city_id . " ORDER BY `sort` asc ");
     }
     foreach ($area_list as $k => $v) {
         if ($v['id'] == $aid) {
             $area_list[$k]['current'] = true;
         }
     }
     $GLOBALS['tmpl']->assign("area_list", $area_list);
     //获取商圈
     if ($city_id > 0 && $aid > 0) {
         $quan_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "area WHERE pid=" . $aid . " AND city_id=" . $city_id . " ORDER BY `sort` asc ");
     }
     foreach ($quan_list as $k => $v) {
         if ($v['id'] == $qid) {
             $quan_list[$k]['current'] = true;
         }
     }
     $GLOBALS['tmpl']->assign("quan_list", $quan_list);
     $GLOBALS['tmpl']->assign("supplier_id", $supplier_id);
     $GLOBALS['tmpl']->assign("location_list", $location_list['list']);
     $GLOBALS['tmpl']->assign("sellall", url("index", "stores", array("supplier_id" => $supplier_id)));
     $data['html'] = $GLOBALS['tmpl']->fetch("inc/business_address.html");
     ajax_return($data);
 }