public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . "system_article" . trim($_REQUEST['act']));
     if (!$GLOBALS['tmpl']->is_cached('system_article.html', $cache_id)) {
         $id = intval($_REQUEST['act']);
         if ($id == 0) {
             app_redirect(APP_ROOT . "/");
         }
         $article = $GLOBALS['db']->getRow("select a.*,ac.type_id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on a.cate_id = ac.id where a.id = " . $id . " and a.is_effect = 1 and a.is_delete = 0");
         if (!$article || $article['type_id'] != 3) {
             app_redirect(APP_ROOT . "/");
         }
         $GLOBALS['tmpl']->assign("article", $article);
         $seo_title = $article['seo_title'] != '' ? $article['seo_title'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_title", $seo_title);
         $seo_keyword = $article['seo_keyword'] != '' ? $article['seo_keyword'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
         $seo_description = $article['seo_description'] != '' ? $article['seo_description'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_description", $seo_description . ",");
     }
     $GLOBALS['tmpl']->display("system_article.html", $cache_id);
 }
Exemple #2
0
 public function index()
 {
     global_run();
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     //首页缓存10分钟
     $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['city']['id']);
     if (!$GLOBALS['tmpl']->is_cached('mall.html', $cache_id)) {
         init_app_page();
         //获取商城公告
         $notice_list = get_notice(0, array(0, 2));
         $GLOBALS['tmpl']->assign("notice_list", $notice_list);
         //输出首页推荐的分类
         $index_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_delete = 0 and is_effect = 1 and recommend = 1 and pid = 0 order by sort");
         foreach ($index_cates as $k => $v) {
             $index_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate  where pid = " . $v['id'] . " order by sort limit 8");
             require_once APP_ROOT_PATH . "system/model/deal.php";
             $deal_result = get_goods_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.is_recommend = 1 ");
             $index_cates[$k]['deal_list'] = $deal_result['list'];
         }
         $GLOBALS['tmpl']->assign("index_cates", $index_cates);
         $GLOBALS['tmpl']->assign("drop_nav", "no_drop");
         //首页下拉菜单不输出
         $GLOBALS['tmpl']->assign("wrap_type", "1");
         //首页宽屏展示
     }
     $GLOBALS['tmpl']->display("mall.html", $cache_id);
 }
Exemple #3
0
 public function 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('link_index.html', $cache_id)) {
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
         $site_nav[] = array('name' => $GLOBALS['lang']['FRIEND_LINK'], 'url' => url("index", "acate"));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $p_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc");
         foreach ($p_link_group as $k => $v) {
             $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and group_id = " . $v['id'] . " order by sort desc");
             if ($g_links) {
                 foreach ($g_links as $kk => $vv) {
                     if (substr($vv['url'], 0, 7) == 'http://') {
                         $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']);
                     }
                 }
                 $p_link_group[$k]['links'] = $g_links;
             } else {
                 unset($p_link_group[$k]);
             }
         }
         $GLOBALS['tmpl']->assign("click_url", url('index', 'link#go'));
         $GLOBALS['tmpl']->assign("p_link_data", $p_link_group);
         $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['FRIEND_LINK']);
     }
     $GLOBALS['tmpl']->display("link_index.html", $cache_id);
 }
 public function do_exchange()
 {
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         $result['status'] = 2;
         ajax_return($result);
     }
     $id = intval($_REQUEST['id']);
     $ecv_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ecv_type where id = " . $id);
     if (!$ecv_type) {
         showErr($GLOBALS['lang']['INVALID_VOUCHER'], 1);
     } else {
         $exchange_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ecv where ecv_type_id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id']));
         if ($ecv_type['exchange_limit'] > 0 && $exchange_count >= $ecv_type['exchange_limit']) {
             $msg = sprintf($GLOBALS['lang']['EXCHANGE_VOUCHER_LIMIT'], $ecv_type['exchange_limit']);
             showErr($msg, 1);
         } elseif ($ecv_type['exchange_score'] > intval($GLOBALS['db']->getOne("select score from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])))) {
             showErr($GLOBALS['lang']['INSUFFCIENT_SCORE'], 1);
         } else {
             require_once APP_ROOT_PATH . "system/libs/voucher.php";
             $rs = send_voucher($ecv_type['id'], $GLOBALS['user_info']['id'], 1);
             if ($rs) {
                 require_once APP_ROOT_PATH . "system/model/user.php";
                 $msg = sprintf($GLOBALS['lang']['EXCHANGE_VOUCHER_USE_SCORE'], $ecv_type['name'], $ecv_type['exchange_score']);
                 modify_account(array('money' => 0, 'score' => "-" . $ecv_type['exchange_score']), $GLOBALS['user_info']['id'], $msg);
                 showSuccess($GLOBALS['lang']['EXCHANGE_SUCCESS'], 1);
             } else {
                 showSuccess($GLOBALS['lang']['EXCHANGE_FAILED'], 1, url('index', 'uc_voucher'));
             }
         }
     }
 }
Exemple #5
0
 public function __construct()
 {
     if (file_exists(APP_ROOT_PATH . "public/uc_config.php")) {
         require_once APP_ROOT_PATH . "public/uc_config.php";
     }
     if (app_conf("INTEGRATE_CODE") == 'Ucenter' && UC_CONNECT == 'mysql') {
         if (file_exists(APP_ROOT_PATH . "public/uc_data/creditsettings.php")) {
             require_once APP_ROOT_PATH . "public/uc_data/creditsettings.php";
             $this->creditsettings = $_CACHE['creditsettings'];
             if (count($this->creditsettings) > 0) {
                 foreach ($this->creditsettings as $k => $v) {
                     $this->creditsettings[$k]['srctitle'] = $this->credits_CFG[$v['creditsrc']]['title'];
                 }
                 $this->allow_exchange = true;
             }
         }
     }
     $GLOBALS['tmpl']->assign("allow_exchange", $this->allow_exchange);
     parent::__construct();
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         app_redirect(url("index", "user#login"));
     }
     init_app_page();
 }
Exemple #6
0
 public function biz_register()
 {
     global_run();
     $msg = $this->upload("biz_register", true);
     $msg['origin_img'] = $msg['url'];
     $msg['url'] = get_spec_image($msg['url'], 88, 75, 1);
     $msg['url_path'] = $msg['url'];
     ajax_return($msg);
 }
Exemple #7
0
 public function do_reply_dp()
 {
     global_run();
     $s_account_info = $GLOBALS['account_info'];
     $account_id = intval($s_account_info['id']);
     $dp_id = intval($_REQUEST['dp_id']);
     $reply_content = strim($_REQUEST['reply_content']);
     require_once APP_ROOT_PATH . 'system/model/review.php';
     ajax_return(biz_do_reply_dp($account_id, $dp_id, $reply_content));
 }
Exemple #8
0
 public function send()
 {
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         $data['status'] = 1000;
         ajax_return($data);
     } else {
         $t = strim($_REQUEST['t']);
         $id = intval($_REQUEST['id']);
         $youhui_log = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_log where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']);
         $youhui_info = load_auto_cache("youhui", array("id" => $youhui_log['youhui_id']));
         if ($youhui_log) {
             if ($youhui_log['confirm_time'] > 0) {
                 $data['status'] = 0;
                 $data['info'] = "优惠券已使用";
                 ajax_return($data);
             } elseif ($youhui_log['expire_time'] > 0 && $youhui_log['expire_time'] < NOW_TIME) {
                 $data['status'] = 0;
                 $data['info'] = "优惠券已过期";
                 ajax_return($data);
             } else {
                 if ($t == "sms") {
                     if (app_conf("SMS_ON") == 0 || $youhui_info['is_sms'] == 0) {
                         $data['status'] = 0;
                         $data['info'] = "不支持短信发送";
                         ajax_return($data);
                     } elseif ($youhui_log['sms_count'] >= app_conf("SMS_COUPON_LIMIT")) {
                         $data['status'] = 0;
                         $data['info'] = "短信发送已超过" . app_conf("SMS_COUPON_LIMIT") . "次";
                         ajax_return($data);
                     } elseif ($GLOBALS['user_info']['mobile'] == "") {
                         $data['status'] = 0;
                         $data['info'] = "请先设置手机号";
                         $data['jump'] = url("index", "uc_account");
                         ajax_return($data);
                     } else {
                         send_youhui_log_sms($id);
                         $GLOBALS['db']->query("update " . DB_PREFIX . "youhui_log set sms_count = sms_count + 1 where id = " . $id);
                         $data['status'] = 1;
                         $data['info'] = "短信成功发送到" . $GLOBALS['user_info']['mobile'] . ",请注意查收。";
                         ajax_return($data);
                     }
                 } else {
                     $data['status'] = 0;
                     $data['info'] = "非法操作";
                     ajax_return($data);
                 }
             }
         } else {
             $data['status'] = 0;
             $data['info'] = "优惠券不存在";
             ajax_return($data);
         }
     }
 }
Exemple #9
0
 public function submit()
 {
     global_run();
     $m_name = strim($_REQUEST['m_name']);
     $a_name = strim($_REQUEST['a_name']);
     $id = intval($_REQUEST['id']);
     $change = intval($_REQUEST['op_change']);
     $reason = strim($_REQUEST['reason']);
     $func = "op_" . $m_name . "_" . $a_name;
     $res = $this->{$func}($id, $change, $reason);
     ajax_return($res);
 }
Exemple #10
0
 public function callback()
 {
     global_run();
     require_once APP_ROOT_PATH . "system/api_login/qqv2/qqConnectAPI.php";
     $qc = new QC();
     $access_token = $qc->qq_callback();
     $openid = $qc->get_openid();
     $use_info_keysArr = array("access_token" => $access_token, "openid" => $openid, "oauth_consumer_key" => $this->api['config']['app_key']);
     $use_info_url = "https://graph.qq.com/user/get_user_info";
     $graph_use_info_url = $qc->urlUtils->combineURL($use_info_url, $use_info_keysArr);
     $response = $qc->urlUtils->get_contents($graph_use_info_url);
     if ($response['ret'] != 0) {
         showErr("授权失败,错误信息:" . $response['msg']);
         die;
     }
     $response = json_decode($response, 1);
     $msg['field'] = 'qqv2_id';
     $msg['id'] = $openid;
     $msg['name'] = $response["nickname"];
     es_session::set("api_user_info", $msg);
     $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where qqv2_id = '" . $openid . "' and qqv2_id <> '' and is_effect=1 and is_delete=0");
     $is_bind = intval(es_session::get("is_bind"));
     if ($user_data) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set qq_token = '" . $access_token . "',login_ip = '" . CLIENT_IP . "',login_time= " . NOW_TIME . " where id =" . $user_data['id']);
         es_session::delete("api_user_info");
         if ($is_bind) {
             if (intval($user_data['id']) != intval($GLOBALS['user_info']['id'])) {
                 showErr("该帐号已经被别的会员绑定过,请直接用帐号登录", 0, url("index", "uc_account"));
             } else {
                 require_once APP_ROOT_PATH . "system/model/user.php";
                 load_user($user_data['id'], true);
                 es_session::set("user_info", $user_data);
                 app_redirect(url("index", "uc_account"));
             }
         } else {
             require_once APP_ROOT_PATH . "system/model/user.php";
             auto_do_login_user($user_data['user_name'], $user_data['user_pwd'], $from_cookie = false);
             app_redirect(url("index", "index"));
         }
     } elseif ($is_bind == 1 && $GLOBALS['user_info']) {
         //当有用户身份且要求绑定时
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set qqv2_id= '" . $msg['id'] . "', qq_token ='" . $access_token . "' where id =" . $GLOBALS['user_info']['id']);
         require_once APP_ROOT_PATH . "system/model/user.php";
         load_user($GLOBALS['user_info']['id'], true);
         app_redirect(url("index", "uc_account"));
     } else {
         $user_info = $this->create_user();
         require_once APP_ROOT_PATH . "system/model/user.php";
         auto_do_login_user($user_info['user_name'], $user_info['user_pwd'], $from_cookie = false);
         app_redirect(url("index", "index"));
     }
 }
Exemple #11
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         app_redirect(url("index", "user#login"));
     }
     $GLOBALS['tmpl']->assign("page_title", "我的点评");
     assign_uc_nav_list();
     //begin review
     require_once APP_ROOT_PATH . "system/model/review.php";
     require_once APP_ROOT_PATH . "app/Lib/page.php";
     //分页
     $page_size = 10;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $dp_res = get_dp_list($limit, "", " user_id = " . $GLOBALS['user_info']['id']);
     $dp_list = $dp_res['list'];
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location_dp  where " . $dp_res['condition']);
     $page = new Page($total, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     foreach ($dp_list as $k => $v) {
         if ($v['deal_id'] > 0) {
             $data_info = load_auto_cache("deal", array("id" => $v['deal_id']));
         } elseif ($v['youhui_id'] > 0) {
             $data_info = load_auto_cache("youhui", array("id" => $v['youhui_id']));
         } elseif ($v['event_id'] > 0) {
             $data_info = load_auto_cache("event", array("id" => $v['event_id']));
         }
         if (empty($data_info)) {
             $data_info = load_auto_cache("store", array("id" => $v['supplier_location_id']));
         }
         $dp_list[$k]['data_info'] = $data_info;
     }
     $GLOBALS['tmpl']->assign('dp_list', $dp_list);
     require_once APP_ROOT_PATH . "system/model/topic.php";
     global $no_lazy;
     $no_lazy = true;
     $review_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/uc_review_list.html"));
     $GLOBALS['tmpl']->assign("review_html", $review_html);
     //end review
     $no_lazy = false;
     $GLOBALS['tmpl']->display("uc/uc_review_index.html");
 }
Exemple #12
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['act']));
     if (!$GLOBALS['tmpl']->is_cached('notice_list.html', $cache_id)) {
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
         $site_nav[] = array('name' => $GLOBALS['lang']['SITE_NOTICE_LIST'], 'url' => url("index", "news"));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $id = intval($_REQUEST['act']);
         $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "article_cate where id = " . $id . " and is_effect = 1 and is_delete = 0");
         if ($id > 0 && !$cate_item) {
             app_redirect(APP_ROOT . "/");
         } elseif ($cate_item && $cate_item['type_id'] != 2) {
             if ($cate_item['type_id'] == 1) {
                 app_redirect(url("index", "help"));
             }
             if ($cate_item['type_id'] == 0) {
                 app_redirect(url("index", "acate"));
             }
             if ($cate_item['type_id'] == 3) {
                 app_redirect(APP_ROOT . "/");
             }
         }
         $cate_id = intval($cate_item['id']);
         $cate_tree = get_acate_tree('', 2, "news");
         $GLOBALS['tmpl']->assign("acate_tree", $cate_tree);
         //分页
         $page = intval($_REQUEST['p']);
         if ($page <= 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
         $result = get_article_list($limit, $cate_id, 'ac.type_id = 2', '', false);
         $GLOBALS['tmpl']->assign("list", $result['list']);
         $page = new Page($result['count'], app_conf("PAGE_SIZE"));
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         $GLOBALS['tmpl']->assign("cur_id", $cate_id);
         $GLOBALS['tmpl']->assign("cur_title", $GLOBALS['lang']['SITE_NOTICE_LIST']);
         $GLOBALS['tmpl']->assign("page_title", $cate_item['title']);
         $GLOBALS['tmpl']->assign("page_keyword", $cate_item['title'] . ",");
         $GLOBALS['tmpl']->assign("page_description", $cate_item['title'] . ",");
     }
     $GLOBALS['tmpl']->display("notice_list.html", $cache_id);
 }
Exemple #13
0
 /**
  * 通用上传,上传到attachments目录,按日期划分
  * 错误返回 error!=0,message错误消息, error=1000表示未登录
  * 正确时返回 error=0, url: ./public格式的文件相对路径  path:物理路径 name:文件名
  */
 public function upload()
 {
     global_run();
     if (empty($GLOBALS['account_info'])) {
         $data['error'] = 1000;
         //未登录
         $data['msg'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
         ajax_return($data);
     }
     //上传处理
     //创建comment目录
     if (!is_dir(APP_ROOT_PATH . "public/attachment")) {
         @mkdir(APP_ROOT_PATH . "public/attachment");
         @chmod(APP_ROOT_PATH . "public/attachment", 0777);
     }
     $dir = to_date(NOW_TIME, "Ym");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "d");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     $dir = $dir . "/" . to_date(NOW_TIME, "H");
     if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
         @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
         @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
     }
     if (app_conf("IS_WATER_MARK") == 1) {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 1, 1);
     } else {
         $img_result = save_image_upload($_FILES, "file", "attachment/" . $dir, $whs = array(), 0, 1);
     }
     if (intval($img_result['error']) != 0) {
         ajax_return($img_result);
     } else {
         if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != 'NONE') {
             syn_to_remote_image_server($img_result['file']['url']);
         }
     }
     $data_result['error'] = 0;
     $data_result['url'] = $img_result['file']['url'];
     $data_result['web_40'] = get_spec_image($data_result['url'], 40, 40, 1);
     $data_result['path'] = $img_result['file']['path'];
     $data_result['name'] = $img_result['file']['name'];
     ajax_return($data_result);
 }
Exemple #14
0
 /**
  * 智能跳转
  * 用于热门关键词的智能检索,优先搜团购->商品->优惠券->活动->商家->分享,如都没有提示没有相关数据
  */
 public function jump()
 {
     $kw = strim($_REQUEST['kw']);
     if ($kw) {
         $param['kw'] = $kw;
         $condition_param['city_id'] = $GLOBALS['city']['id'];
         global_run();
         //先验证团购
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $ext_condition = "  d.buy_type <> 1 and d.is_shop = 0 ";
         $ext_condition .= " and d.name like '%" . $kw . "%' ";
         if (get_deal_count(array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition)) {
             app_redirect(url("index", "tuan", $param));
         } else {
             //商品
             $ext_condition = "  d.buy_type <> 1 and d.is_shop = 1 ";
             $ext_condition .= " and d.name like '%" . $kw . "%' ";
             if (get_goods_count(array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition)) {
                 app_redirect(url("index", "cate", $param));
             } else {
                 //优惠券
                 require_once APP_ROOT_PATH . "system/model/youhui.php";
                 $ext_condition = " y.name like '%" . $kw . "%' ";
                 if (get_youhui_count(array(YOUHUI_NOTICE, YOUHUI_ONLINE), $condition_param, "", $ext_condition)) {
                     app_redirect(url("index", "youhuis", $param));
                 } else {
                     //活动
                     require_once APP_ROOT_PATH . "system/model/event.php";
                     $ext_condition = " e.name like '%" . $kw . "%' ";
                     if (get_event_count(array(EVENT_NOTICE, EVENT_ONLINE), $condition_param, "", $ext_condition)) {
                         app_redirect(url("index", "events", $param));
                     } else {
                         //商家
                         require_once APP_ROOT_PATH . "system/model/supplier.php";
                         $ext_condition = " sl.name like '%" . $kw . "%' ";
                         $rs = get_location_list(1, $condition_param, "", $ext_condition);
                         if ($rs['list']) {
                             app_redirect(url("index", "stores", $param));
                         } else {
                             app_redirect(url("index", "discover", $param));
                         }
                     }
                 }
             }
         }
     } else {
         app_redirect(url("index"));
     }
 }
Exemple #15
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['act']));
     if (!$GLOBALS['tmpl']->is_cached('notice_index.html', $cache_id)) {
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
         $site_nav[] = array('name' => $GLOBALS['lang']['SITE_NOTICE_LIST'], 'url' => url("index", "news"));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $id = intval($_REQUEST['act']);
         if ($id == 0) {
             app_redirect(url("index", "news"));
         }
         $article = $GLOBALS['db']->getRow("select a.*,ac.type_id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on a.cate_id = ac.id where a.id = " . $id . " and a.is_effect = 1 and a.is_delete = 0");
         $cate_tree = get_acate_tree('', 2, "news");
         $GLOBALS['tmpl']->assign("acate_tree", $cate_tree);
         if (!$article || $article['type_id'] != 2) {
             app_redirect(APP_ROOT . "/");
         } else {
             if ($article['rel_url'] != '') {
                 if (!preg_match("/http:\\/\\//i", $article['rel_url'])) {
                     if (substr($article['rel_url'], 0, 2) == 'u:') {
                         app_redirect(parse_url_tag($article['rel_url']));
                     } else {
                         app_redirect(APP_ROOT . "/" . $article['rel_url']);
                     }
                 } else {
                     app_redirect($article['rel_url']);
                 }
             }
         }
         $GLOBALS['tmpl']->assign("article", $article);
         $GLOBALS['tmpl']->assign("cur_id", $article['cate_id']);
         $GLOBALS['tmpl']->assign("cur_title", $GLOBALS['lang']['SITE_NOTICE_LIST']);
         $seo_title = $article['seo_title'] != '' ? $article['seo_title'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_title", $seo_title);
         $seo_keyword = $article['seo_keyword'] != '' ? $article['seo_keyword'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
         $seo_description = $article['seo_description'] != '' ? $article['seo_description'] : $article['title'];
         $GLOBALS['tmpl']->assign("page_description", $seo_description . ",");
     }
     $GLOBALS['tmpl']->display("notice_index.html", $cache_id);
 }
Exemple #16
0
 public function send()
 {
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         $data['status'] = 1000;
         ajax_return($data);
     } else {
         $t = strim($_REQUEST['t']);
         $id = intval($_REQUEST['id']);
         $lottery = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "lottery where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']);
         $deal = load_auto_cache("deal", array("id" => $lottery['deal_id']));
         if ($lottery) {
             if ($t == "sms") {
                 if (app_conf("SMS_ON") == 0 || app_conf("LOTTERY_SN_SMS") == 0) {
                     $data['status'] = 0;
                     $data['info'] = "不支持短信发送";
                     ajax_return($data);
                 } elseif ($lottery['sms_count'] >= app_conf("SMS_COUPON_LIMIT")) {
                     $data['status'] = 0;
                     $data['info'] = "短信发送已超过" . app_conf("SMS_COUPON_LIMIT") . "次";
                     ajax_return($data);
                 } elseif ($GLOBALS['user_info']['mobile'] == "") {
                     $data['status'] = 0;
                     $data['info'] = "请先设置手机号";
                     $data['jump'] = url("index", "uc_account");
                     ajax_return($data);
                 } else {
                     send_lottery_sms($id);
                     $GLOBALS['db']->query("update " . DB_PREFIX . "lottery set sms_count = sms_count + 1 where id = " . $id);
                     $data['status'] = 1;
                     $data['info'] = "短信成功发送到" . $GLOBALS['user_info']['mobile'] . ",请注意查收。";
                     ajax_return($data);
                 }
             } else {
                 $data['status'] = 0;
                 $data['info'] = "非法操作";
                 ajax_return($data);
             }
         } else {
             $data['status'] = 0;
             $data['info'] = "抽奖号不存在";
             ajax_return($data);
         }
     }
 }
Exemple #17
0
 public function get_medal()
 {
     global_run();
     $id = intval($_REQUEST['id']);
     $medal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "medal where id = " . $id);
     $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php";
     $cls = $medal['class_name'] . "_medal";
     $result['status'] = 0;
     $result['info'] = "勋章不存在";
     if (file_exists($file)) {
         require_once $file;
         if (class_exists($cls)) {
             $o = new $cls();
             $result = $o->get_medal();
         }
     }
     ajax_return($result);
 }
Exemple #18
0
 public function reply()
 {
     $ajax = 1;
     global_run();
     if (!$GLOBALS['user_info']) {
         $result['status'] = -1000;
         $result['info'] = "未登录";
         ajax_return($result);
     }
     if ($_REQUEST['content'] == '') {
         showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
     }
     /*验证每天只允许评论5次*/
     $day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME);
     if ($day_send_count >= 8) {
         showErr('今天你已经发很多了哦~', $ajax);
     }
     if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
         showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
     }
     $topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
     if (!$topic_info) {
         showErr("主题不存在", $ajax);
     }
     $reply_data = array();
     $reply_data['topic_id'] = intval($_REQUEST['topic_id']);
     $reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
     $reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
     $reply_data['reply_id'] = intval($_REQUEST['reply_id']);
     $reply_data['create_time'] = NOW_TIME;
     $reply_data['is_effect'] = 1;
     $reply_data['is_delete'] = 0;
     $reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content'])));
     require_once APP_ROOT_PATH . 'system/model/topic.php';
     $reply_id = insert_topic_reply($reply_data);
     //返回页面的数据
     $reply_data['reply_id'] = $reply_id;
     $reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i");
     $reply_data['avatar'] = show_avatar($reply_data['user_id'], "small");
     $reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id']));
     $reply_data['status'] = 1;
     ajax_return($reply_data);
 }
Exemple #19
0
 public function remove_msg()
 {
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         $data['status'] = 1000;
         ajax_return($data);
     } else {
         $id = intval($_REQUEST['id']);
         $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_delete = 1 where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']);
         if ($GLOBALS['db']->affected_rows()) {
             $data['status'] = 1;
             ajax_return($data);
         } else {
             $data['status'] = 0;
             $data['info'] = "删除失败";
             ajax_return($data);
         }
     }
 }
Exemple #20
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
     $site_nav[] = array('name' => $GLOBALS['lang']['API_LIST'], 'url' => url("index", "dhapi"));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $directory = APP_ROOT_PATH . "dh/";
     $read_api = true;
     $dir = @opendir($directory);
     $apis = array();
     while (false !== ($file = @readdir($dir))) {
         if (preg_match("/^.*?\\.php\$/", $file)) {
             $tmp = (require_once $directory . $file);
             if ($tmp) {
                 $apis[] = $tmp;
             }
         }
     }
     @closedir($dir);
     unset($read_api);
     $contents_html = '<table>';
     foreach ($apis as $k => $v) {
         foreach ($v['info'] as $kk => $vv) {
             $contents_html .= "<tr><td style='padding:10px 25px 10px 5px;'>";
             $contents_html .= $vv['name'] . ":</td><td style='padding:10px 5px 10px 5px;'><input type='text' style='width:350px;' class='f-input' value='" . get_domain() . APP_ROOT . "/dh/" . $vv['url'] . "' /></td>";
             $contents_html .= "</tr>";
         }
     }
     $contents_html .= '</table>';
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['API_LIST']);
     $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['API_LIST']);
     $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['API_LIST']);
     $article['title'] = $GLOBALS['lang']['API_LIST'];
     $article['content'] = $contents_html;
     $GLOBALS['tmpl']->assign("article", $article);
     $GLOBALS['tmpl']->display("dhapi.html");
 }
Exemple #21
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);
 }
Exemple #22
0
 public function index()
 {
     require APP_ROOT_PATH . "system/model/uc_center_service.php";
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         app_redirect(url("index", "user#login"));
     }
     $page = intval($_REQUEST['p']);
     if ($page <= 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $user_id = intval($GLOBALS['user_info']['id']);
     $result = get_invite_list($limit, $user_id);
     $GLOBALS['tmpl']->assign("list", $result['list']);
     $page = new Page($result['count'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $total_referral_money = $GLOBALS['db']->getOne("select sum(money) from " . DB_PREFIX . "referrals where user_id = " . $GLOBALS['user_info']['id'] . " and pay_time > 0");
     $total_referral_score = $GLOBALS['db']->getOne("select sum(score) from " . DB_PREFIX . "referrals where user_id = " . $GLOBALS['user_info']['id'] . " and pay_time > 0");
     $GLOBALS['tmpl']->assign("total_referral_money", $total_referral_money);
     $GLOBALS['tmpl']->assign("total_referral_score", $total_referral_score);
     $share_url = get_domain() . APP_ROOT . "/";
     if ($GLOBALS['user_info']) {
         $share_url .= "?r=" . base64_encode(intval($GLOBALS['user_info']['id']));
     }
     $GLOBALS['tmpl']->assign("share_url", $share_url);
     $GLOBALS['tmpl']->assign("page_title", "我的邀请");
     assign_uc_nav_list();
     //左侧导航菜单
     $GLOBALS['tmpl']->display("uc/uc_invite.html");
 }
Exemple #23
0
 public function doprint()
 {
     global_run();
     init_app_page();
     if (empty($GLOBALS['user_info'])) {
         app_redirect(url("index", "user#login"));
     }
     $id = intval($_REQUEST['id']);
     $log = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_log where user_id = " . $GLOBALS['user_info']['id'] . " and id = " . $id);
     if ($log) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "youhui set print_count = print_count + 1 where id = " . $log['youhui_id']);
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $youhui_info = get_youhui($log['youhui_id']);
         if ($youhui_info) {
             $GLOBALS['tmpl']->assign("youhui_info", $youhui_info);
             $GLOBALS['tmpl']->assign("log", $log);
             $GLOBALS['tmpl']->display("youhui_print.html");
         } else {
             showErr("优惠券已下架");
         }
     } else {
         app_redirect_preview();
     }
 }
Exemple #24
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("wrap_type", "1");
     //宽屏展示
     //参数处理
     $shop_cate_id = intval($_REQUEST['cid']);
     if ($shop_cate_id) {
         $url_param['cid'] = $shop_cate_id;
     }
     $brand_id = intval($_REQUEST['bid']);
     if ($brand_id) {
         $url_param['bid'] = intval($_REQUEST['bid']);
     }
     $sort_name = strim($_REQUEST["sort"]);
     if ($sort_name != "return_score" && $sort_name != "buy_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;
     }
     //seo元素
     $page_title = "积分商城";
     $page_keyword = "积分商城";
     $page_description = "积分商城";
     //输出自定义的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")
     						)
     					)		
     				)
     			
     		); */
     $cate_cache = load_auto_cache("cache_shop_cate");
     //商城分类缓存
     //获取品牌
     if ($shop_cate_id > 0) {
         $cate_key = load_auto_cache("shop_cate_key", array("cid" => $shop_cate_id));
         $brand_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "brand where match(tag_match) against('" . $cate_key . "' IN BOOLEAN MODE)  order by sort limit 100");
         if ($brand_id > 0 && $brand_list) {
             $brand_info = $GLOBALS['db']->getRow("select id,name from " . DB_PREFIX . "brand where id = " . $brand_id);
         }
     }
     if ($shop_cate_id > 0 && $cate_cache[$shop_cate_id] || $brand_id > 0 && $brand_list) {
         $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "scores")));
     }
     //全部
     if ($shop_cate_id > 0 && $cate_cache[$shop_cate_id]) {
         if ($cate_cache[$shop_cate_id]['pid'] == 0) {
             //选中大分类
             $bcate_info = $cate_cache[$shop_cate_id];
             $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0));
             foreach ($bcate_list as $k => $v) {
                 $bcate_list[$k]['url'] = $v['score_url'];
             }
             $filter_row = array();
             unset($tmp_url_param['cid']);
             $filter_row['current'] = array("name" => $cate_cache[$shop_cate_id]['name'], "cancel" => url("index", "scores"));
             $filter_row['list'] = $bcate_list;
             $filter_row_data['nav_list'][] = $filter_row;
             $scate_list = load_auto_cache("cache_shop_cate", array("pid" => $shop_cate_id));
             foreach ($scate_list as $k => $v) {
                 $scate_list[$k]['url'] = $v['score_url'];
             }
         } else {
             //选中小分类
             $scate_info = $cate_cache[$shop_cate_id];
             $bcate_info = $cate_cache[$scate_info['pid']];
             $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0));
             foreach ($bcate_list as $k => $v) {
                 $bcate_list[$k]['url'] = $v['score_url'];
             }
             $filter_row = array();
             $filter_row['current'] = array("name" => $bcate_info['name'], "cancel" => url("index", "scores"));
             $filter_row['list'] = $bcate_list;
             $filter_row_data['nav_list'][] = $filter_row;
             $scate_list = load_auto_cache("cache_shop_cate", array("pid" => $bcate_info['id']));
             foreach ($scate_list as $k => $v) {
                 $scate_list[$k]['url'] = $v['score_url'];
             }
         }
         //输出小分类
         if ($scate_list) {
             $tmp_url_param = $url_param;
             $tmp_url_param['cid'] = $bcate_info['id'];
             if ($scate_info) {
                 $scate_list_out[] = array("name" => "全部", "url" => url("index", "scores", $tmp_url_param));
             } else {
                 $scate_list_out[] = array("name" => "全部", "url" => url("index", "scores", $tmp_url_param), "current" => true);
             }
             foreach ($scate_list as $k => $v) {
                 if ($v['id'] == $shop_cate_id) {
                     $v['current'] = true;
                 }
                 $scate_list_out[] = $v;
             }
             $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $scate_list_out);
         }
         if ($bcate_info) {
             $page_title = $bcate_info['name'] . " - " . $page_title;
             $page_keyword = $page_keyword . "," . $bcate_info['name'];
             $page_description = $page_description . "," . $bcate_info['name'];
         }
         if ($scate_info) {
             $page_title = $scate_info['name'] . " - " . $page_title;
             $page_keyword = $page_keyword . "," . $scate_info['name'];
             $page_description = $page_description . "," . $scate_info['name'];
         }
     } else {
         //输出大分类
         $bcate_list = load_auto_cache("cache_shop_cate", array("pid" => 0));
         foreach ($bcate_list as $k => $v) {
             $bcate_list[$k]['url'] = $v['score_url'];
         }
         $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $bcate_list);
     }
     //有分类结束
     //关于品牌筛选
     if ($brand_list) {
         $brand_list_bak = $brand_list;
         $brand_list = array();
         $tmp_url_param = $url_param;
         unset($tmp_url_param['bid']);
         $brand_list[] = array("name" => "全部", "url" => url("index", "scores", $tmp_url_param), "current" => true);
         foreach ($brand_list_bak as $k => $v) {
             $tmp_url_param = $url_param;
             $tmp_url_param['bid'] = $v['id'];
             $v['url'] = url("index", "scores", $tmp_url_param);
             $brand_list[] = $v;
         }
     }
     if ($brand_info) {
         //选中大分类
         $filter_row = array();
         $tmp_url_param = $url_param;
         unset($tmp_url_param['bid']);
         $filter_row['current'] = array("name" => $brand_info['name'], "cancel" => url("index", "scores", $tmp_url_param));
         $filter_row['list'] = $brand_list;
         $filter_row_data['nav_list'][] = $filter_row;
         $page_title = $brand_info['name'] . " - " . $page_title;
         $page_keyword = $page_keyword . "," . $brand_info['name'];
         $page_description = $page_description . "," . $brand_info['name'];
     } else {
         if ($brand_list) {
             //输出品牌
             $filter_row_data['filter_list'][] = array("name" => "品牌", "list" => $brand_list);
         }
     }
     //end 品牌
     $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", "scores", $tmp_url_param));
     //价格排序
     $tmp_url_param = $url_param;
     if ($tmp_url_param['sort'] == "return_score") {
         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'] = "return_score";
         $tmp_url_param['type'] = "desc";
         $c_sort_type = "desc";
         $current = false;
     }
     $sort_list[] = array("name" => "积分", "key" => "return_score", "type" => $c_sort_type, "current" => $current, "url" => url("index", "scores", $tmp_url_param));
     //销量排序
     $tmp_url_param = $url_param;
     if ($tmp_url_param['sort'] == "buy_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'] = "buy_count";
         $tmp_url_param['type'] = "desc";
         $c_sort_type = "desc";
         $current = false;
     }
     $sort_list[] = array("name" => "销量", "key" => "buy_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "scores", $tmp_url_param));
     $sort_row_data['sort'] = $sort_list;
     $ext_condition = "  d.buy_type = 1 and d.is_shop = 1 ";
     $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data);
     //开始获取商品
     //获取排序条件
     //积分商城积分排序相反
     if ($url_param['sort'] == "return_score") {
         $sort_type = $url_param['type'] == "desc" ? "asc" : "desc";
     } else {
         $sort_type = $url_param['type'];
     }
     if ($url_param['sort']) {
         $sort_field = "d." . $url_param['sort'] . " " . $sort_type;
     }
     require_once APP_ROOT_PATH . "system/model/deal.php";
     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'];
     $deal_result = get_goods_list($limit, array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition, $sort_field);
     $deal_list = $deal_result['list'];
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal as d where " . $deal_result['condition']);
     $page = new Page($total, app_conf("DEAL_PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('deal_list', $deal_list);
     $side_deal_result = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", " d.buy_type = 1 and d.is_shop = 1 ", " d.buy_count desc ");
     $side_deal_list = $side_deal_result['list'];
     $GLOBALS['tmpl']->assign('side_deal_list', $side_deal_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("scores.html");
 }
Exemple #25
0
 public function load_filter_box()
 {
     global_run();
     $edit_type = intval($_REQUEST['edit_type']);
     //1管理员发布 2商户发布
     $shop_cate_id = intval($_REQUEST['shop_cate_id']);
     $id = intval($_REQUEST['id']);
     $ids = $this->get_parent_ids($shop_cate_id);
     $filter_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter_group where cate_id in ('" . implode(",", $ids) . "')");
     foreach ($filter_group as $k => $v) {
         $filter_group[$k]['value'] = $GLOBALS['db']->getOne("select filter from " . DB_PREFIX . "deal_filter where filter_group_id=" . $v['id'] . " and deal_id=" . $id);
     }
     $GLOBALS['tmpl']->assign("filter_group", $filter_group);
     echo $GLOBALS['tmpl']->fetch("pages/project/filter_box.html");
 }
Exemple #26
0
 public function callback()
 {
     global_run();
     require_once APP_ROOT_PATH . 'system/api_login/sina/saetv2.ex.class.php';
     //$sina_keys = es_session::get("sina_keys");
     $o = new SaeTOAuthV2($this->api['config']['app_key'], $this->api['config']['app_secret']);
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         if ($this->api['config']['app_url'] == "") {
             $app_url = SITE_DOMAIN . APP_ROOT . "/api_callback.php?c=Sina";
         } else {
             $app_url = $this->api['config']['app_url'];
         }
         $keys['redirect_uri'] = $app_url;
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
             //print_r($e);exit;
             showErr("授权失败,错误信息:" . $e->getMessage());
             die;
         }
     }
     $c = new SaeTClientV2($this->api['config']['app_key'], $this->api['config']['app_secret'], $token['access_token']);
     $ms = $c->home_timeline();
     // done
     $uid_get = $c->get_uid();
     $uid = $uid_get['uid'];
     $msg = $c->show_user_by_id($uid);
     //根据ID获取用户等基本信息
     if (intval($msg['error_code']) != 0) {
         showErr("授权失败,错误代码:" . $msg['error_code']);
         die;
     }
     $msg['field'] = 'sina_id';
     $msg['sina_token'] = $token['access_token'];
     es_session::set("api_user_info", $msg);
     if (!$msg['name']) {
         app_redirect(url("index"));
         exit;
     }
     //print_r($msg);die();
     $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where sina_id = '" . $msg['id'] . "' and sina_id <> ''  and is_effect=1 and is_delete=0");
     $is_bind = intval(es_session::get("is_bind"));
     if ($user_data) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_token = '" . $token['access_token'] . "',login_ip = '" . CLIENT_IP . "',login_time= " . NOW_TIME . " where id =" . $user_data['id']);
         es_session::delete("api_user_info");
         if ($is_bind) {
             if (intval($user_data['id']) != intval($GLOBALS['user_info']['id'])) {
                 showErr("该帐号已经被别的会员绑定过,请直接用帐号登录", 0, url("index", "uc_account"));
             } else {
                 require_once APP_ROOT_PATH . "system/model/user.php";
                 load_user($user_data['id'], true);
                 es_session::set("user_info", $user_data);
                 app_redirect(url("index", "uc_account"));
             }
         } else {
             require_once APP_ROOT_PATH . "system/model/user.php";
             auto_do_login_user($user_data['user_name'], $user_data['user_pwd'], $from_cookie = false);
             app_redirect(url("index", "index"));
         }
     } elseif ($is_bind == 1 && $GLOBALS['user_info']) {
         //当有用户身份且要求绑定时
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_id= '" . $msg['id'] . "', sina_token ='" . $token['access_token'] . "' where id =" . $GLOBALS['user_info']['id']);
         require_once APP_ROOT_PATH . "system/model/user.php";
         load_user($GLOBALS['user_info']['id'], true);
         app_redirect(url("index", "uc_account"));
     } else {
         $user_info = $this->create_user();
         require_once APP_ROOT_PATH . "system/model/user.php";
         auto_do_login_user($user_info['user_name'], $user_info['user_pwd'], $from_cookie = false);
         app_redirect(url("index", "index"));
     }
 }
Exemple #27
0
 public function index()
 {
     global_run();
     init_app_page();
     require_once APP_ROOT_PATH . "system/model/youhui.php";
     //浏览历史
     $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);
     }
     //参数处理
     $deal_cate_id = intval($_REQUEST['cid']);
     if ($deal_cate_id) {
         $url_param['cid'] = $deal_cate_id;
     }
     $deal_type_id = intval($_REQUEST['tid']);
     if ($deal_type_id) {
         $url_param['tid'] = $deal_type_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 != "user_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 (isset($_REQUEST['ytype'])) {
         //2减免:满立减 1:代金券
         $ytype = intval($_REQUEST['ytype']);
         $url_param['ytype'] = $ytype;
     }
     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_deal_cate");
     //分类缓存
     $cache_param = array("cid" => $deal_cate_id, "tid" => $deal_type_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id']));
     $filter_nav_data = load_auto_cache("youhui_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", "youhuis")));
     }
     //全部
     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", "youhuis", $tmp_url_param));
         $filter_row['list'] = $filter_nav_data['bcate_list'];
         $filter_row_data['nav_list'][] = $filter_row;
         //输出小分类
         if ($filter_nav_data['scate_list']) {
             $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['scate_list']);
         }
         $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'];
         $type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id));
         if ($deal_type_id > 0 && $type_list[$deal_type_id]) {
             $page_title = $type_list[$deal_type_id]['name'] . " - " . $page_title;
             $page_keyword = $page_keyword . "," . $type_list[$deal_type_id]['name'];
             $page_description = $page_description . "," . $type_list[$deal_type_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", "youhuis", $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", "youhuis", $tmp_url_param));
     //价格排序
     $tmp_url_param = $url_param;
     if ($tmp_url_param['sort'] == "user_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'] = "user_count";
         $tmp_url_param['type'] = "desc";
         $c_sort_type = "desc";
         $current = false;
     }
     $sort_list[] = array("name" => "下载量", "key" => "user_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "youhuis", $tmp_url_param));
     $sort_row_data['sort'] = $sort_list;
     //标签筛选
     //0减免:满立减 1:代金券
     $tag_condition = "";
     for ($i = 0; $i <= 1; $i++) {
         $t = $i == 1 ? $i : 2;
         $checked = false;
         if (isset($url_param['ytype']) && $url_param['ytype'] == $t) {
             $checked = true;
         }
         $tmp_url_param = $url_param;
         if (isset($tmp_url_param['ytype']) && $tmp_url_param['ytype'] == $t) {
             unset($tmp_url_param['ytype']);
         } else {
             $tmp_url_param['ytype'] = $t;
         }
         $dtags[] = array("name" => lang("YOUHUI_TYPE" . $i), "checked" => $checked, "url" => url("index", "youhuis", $tmp_url_param));
     }
     if (isset($url_param['ytype'])) {
         if ($url_param['ytype'] == 1) {
             $ext_condition = " y.youhui_type = '" . $url_param['ytype'] . "' ";
         } else {
             $ext_condition = " y.youhui_type = 0 ";
         }
     }
     $sort_row_data['tag'] = $dtags;
     $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data);
     //开始获取优惠券
     //获取排序条件
     if ($url_param['sort']) {
         $sort_field = "y." . $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 .= " y.name like '%" . $GLOBALS['kw'] . "%' ";
     }
     $youhui_result = get_youhui_list($limit, array(YOUHUI_NOTICE, YOUHUI_ONLINE), $condition_param, "", $ext_condition, $sort_field);
     $youhui_list = $youhui_result['list'];
     foreach ($youhui_list as $k => $v) {
         $youhui_list[$k]['qrcode'] = gen_qrcode(SITE_DOMAIN . $v['url'], 3);
     }
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "youhui as y where " . $youhui_result['condition'], false);
     $page = new Page($total, app_conf("DEAL_PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('youhui_list', $youhui_list);
     $side_youhui_result = get_youhui_list(app_conf("SIDE_DEAL_COUNT"), array(YOUHUI_ONLINE, YOUHUI_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", "", " y.user_count desc ");
     $side_youhui_list = $side_youhui_result['list'];
     $GLOBALS['tmpl']->assign('side_youhui_list', $side_youhui_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("youhuis.html");
 }
Exemple #28
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/model/topic.php";
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("wrap_type", "1");
     //宽屏展示
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     convert_req($_REQUEST);
     $title = $GLOBALS['lang']['DISCOVER'];
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
     $site_nav[] = array('name' => $title, 'url' => url("index", "discover"));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $cid = intval($_REQUEST['cid']);
     $cate_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "topic_tag_cate where id = " . $cid);
     $GLOBALS['tmpl']->assign("cid", $cid);
     $tag = strim($_REQUEST['tag']);
     if ($tag) {
         $GLOBALS['tmpl']->assign("tag", $tag);
     }
     if ($GLOBALS['kw']) {
         $GLOBALS['tmpl']->assign("tag", $GLOBALS['kw']);
     }
     if ($cate_name) {
         $title = $title . $cate_name;
     }
     if ($tag) {
         $title = $title . $tag;
     }
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     if ($cid == 0) {
         $tag_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc limit 10");
     } else {
         $tag_list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic_tag as t left join " . DB_PREFIX . "topic_tag_cate_link as l on l.tag_id = t.id where l.cate_id = " . $cid . " order by t.sort desc limit 10");
     }
     $GLOBALS['tmpl']->assign("tag_list", $tag_list);
     $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_tag_cate where showin_web = 1 order by sort desc limit 7");
     $GLOBALS['tmpl']->assign("cate_list", $cate_list);
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $GLOBALS['tmpl']->assign("page", $page);
     $condition = ' is_effect = 1 and is_delete = 0 ';
     $param['cid'] = $cid;
     $param['tag'] = $tag;
     $param_condition = build_topic_filter_condition($param);
     $condition .= " " . $param_condition;
     $condition .= " and fav_id = 0 and relay_id = 0 and has_image = 1 and type in ('share','sharedeal','shareyouhui','shareevent') ";
     $sql = "select count(*) from " . DB_PREFIX . "topic where " . $condition;
     $count = $GLOBALS['db']->getOne($sql);
     $page_size = PIN_PAGE_SIZE;
     $page = new Page($count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $remain_count = $count - ($page - 1) * $page_size;
     //从当前页算起剩余的数量
     $remain_page = ceil($remain_count / $page_size);
     //剩余的页数
     if ($remain_page == 1) {
         //末页
         $step_size = ceil($remain_count / PIN_SECTOR);
     } else {
         $step_size = ceil(PIN_PAGE_SIZE / PIN_SECTOR);
     }
     $GLOBALS['tmpl']->assign('step_size', $step_size);
     $GLOBALS['tmpl']->display("discover.html");
 }
Exemple #29
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");
 }
 public function set_default()
 {
     global_run();
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         $result['status'] = 2;
         ajax_return($result);
     }
     $id = intval($_REQUEST['id']);
     $GLOBALS['db']->query("update " . DB_PREFIX . "user_consignee set is_default=0 where user_id=" . intval($GLOBALS['user_info']['id']));
     $GLOBALS['db']->query("update " . DB_PREFIX . "user_consignee set is_default=1 where id=" . $id . " and user_id=" . intval($GLOBALS['user_info']['id']));
     if ($GLOBALS['db']->affected_rows()) {
         showSuccess("设置成功", 1);
     } else {
         showErr("操作失败", 1);
     }
 }