public function ignoreall() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $GLOBALS['db']->query("update " . DB_PREFIX . "user_notify set is_read = 1 where user_id = " . intval($GLOBALS['user_info']['id'])); app_redirect_preview(); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['user_login_status'] = 1; $id = intval($_REQUEST['id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and user_id = " . intval($GLOBALS['user_info']['id'])); if ($deal_item) { $root['page_title'] = $deal_item['name']; $region_pid = 0; $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 foreach ($region_lv2 as $k => $v) { if ($v['name'] == $deal_item['province']) { $region_lv2[$k]['selected'] = 1; $region_pid = $region_lv2[$k]['id']; break; } } $root['region_lv2'] = $region_lv2; if ($region_pid > 0) { $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid = " . $region_pid . " order by py asc"); //三级地址 foreach ($region_lv3 as $k => $v) { if ($v['name'] == $deal_item['city']) { $region_lv3[$k]['selected'] = 1; break; } } $root['region_lv3'] = $region_lv3; } $deal_item['faq_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_faq where deal_id = " . $deal_item['id'] . " order by sort asc"); $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc"); $root['cate_list'] = $cate_list; $root['deal_item'] = $deal_item; } else { app_redirect_preview(); } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function do_api_login() { $api_info = es_session::get("api_user_info"); if (!$api_info) { app_redirect_preview(); } if (!$_POST) { app_redirect(APP_ROOT . "/"); } foreach ($_POST as $k => $v) { $_POST[$k] = strim($v); } $ajax = intval($_REQUEST['ajax']); if (!check_ipop_limit(get_client_ip(), "user_do_api_login", 5)) { showErr("提交太快", $ajax); } require_once APP_ROOT_PATH . "system/libs/user.php"; $result = do_login_user($_POST['email'], $_POST['user_pwd']); if ($result['status']) { $s_user_info = es_session::get("user_info"); $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $api_info['field'] . " = '" . $api_info['id'] . "'," . $api_info['token_field'] . " = '" . $api_info['token'] . "'," . $api_info['secret_field'] . " = '" . $api_info['secret'] . "'," . $api_info['url_field'] . " = '" . $api_info['url'] . "' where id = " . $s_user_info['id']); $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_weibo where user_id = " . intval($s_user_info['id']) . " and weibo_url = '" . $api_info['url'] . "'"); update_user_weibo(intval($s_user_info['id']), $api_info['url']); if ($ajax == 0 && trim(app_conf("INTEGRATE_CODE")) == '') { $redirect = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index"); app_redirect($redirect); } else { $jump_url = get_gopreview(); if ($ajax == 1) { $return['status'] = 1; $return['info'] = "登录成功"; $return['data'] = $result['msg']; $return['jump'] = $jump_url; ajax_return($return); } else { $GLOBALS['tmpl']->assign('integrate_result', $result['msg']); showSuccess("登录成功", $ajax, $jump_url); } } } else { if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) { $err = "会员不存在"; } if ($result['data'] == ACCOUNT_PASSWORD_ERROR) { $err = "密码错误"; } showErr($err, $ajax); } }
public function edit_item() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $id = intval($_REQUEST['id']); $item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_edit = 1 and is_delete = 0 and id = " . $item['deal_id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); if ($deal_item && $item) { $deal_item_images = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item_image where deal_id = " . $deal_item['id'] . " and deal_item_id = " . $item['id']); $GLOBALS['tmpl']->assign("deal_item_images", $deal_item_images); $GLOBALS['tmpl']->assign("deal_item", $deal_item); $GLOBALS['tmpl']->assign("item", $item); $GLOBALS['tmpl']->assign("page_title", "回报设置 - " . $deal_item['name']); $GLOBALS['tmpl']->display("project_edit_item.html"); } else { app_redirect_preview(); } }
public function paid() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $deal_id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id . " and is_delete = 0 and is_effect = 1 and is_success = 1 and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$deal_info) { app_redirect_preview(); } $GLOBALS['tmpl']->assign("deal_info", $deal_info); $page_size = ACCOUNT_PAGE_SIZE; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $paid_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_pay_log where deal_id = " . $deal_id . " order by create_time desc limit " . $limit); $paid_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_pay_log where deal_id = " . $deal_id); $GLOBALS['tmpl']->assign("paid_list", $paid_list); $page = new Page($paid_count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->display("account_paid.html"); }
public function callback() { es_session::start(); require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php'; OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']); $code = strim($_REQUEST['code']); $openid = strim($_REQUEST['openid']); $openkey = strim($_REQUEST['openkey']); if ($this->api['config']['app_url'] == "") { $app_url = get_domain() . APP_ROOT . "/api_callback.php?c=Tencent"; } else { $app_url = $this->api['config']['app_url']; } $token_url = OAuth::getAccessToken($code, $app_url); $result = Http::request($token_url); $result = preg_replace('/[^\\x20-\\xff]*/', "", $result); //清除不可见字符 $result = iconv("utf-8", "utf-8//ignore", $result); //UTF-8转码 parse_str($result, $result_arr); $access_token = $result_arr['access_token']; $refresh_token = $result_arr['refresh_token']; $name = $result_arr['name']; $nick = $result_arr['nick']; es_session::set("t_access_token", $access_token); es_session::set("t_openid", $openid); es_session::set("t_openkey", $openkey); if (es_session::get("t_access_token") || es_session::get("t_openid") && es_session::get("t_openkey")) { $r = Tencent::api('user/info'); $r = json_decode($r, true); if ($r['errcode'] != 0) { showErr("腾讯微博返回出错"); } //name,url,province,city,avatar,token,field,token_field(授权的字段),sex,secret_field(授权密码的字段),scret,url_field(微博地址的字段) $api_data['name'] = $r['data']['name']; $api_data['url'] = "http://t.qq.com/" . $r['data']['name']; $location = $r['data']['location']; $location = explode(" ", $location); $api_data['province'] = $location[1]; $api_data['city'] = $location[2]; $api_data['avatar'] = $r['data']['head']; $api_data['field'] = 'tencent_id'; $api_data['token'] = $access_token; $api_data['token_field'] = "tencent_token"; $api_data['secret'] = $openkey; $api_data['secret_field'] = "tencent_secret"; $api_data['url_field'] = "tencent_url"; if ($r['data']['sex'] == '1') { $api_data['sex'] = 1; } else { if ($r['data']['sex'] == '2') { $api_data['sex'] = 0; } else { $api_data['sex'] = -1; } } if ($api_data['name'] != "") { es_session::set("api_user_info", $api_data); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where tencent_id = '" . $openid . "' and tencent_id <> ''"); if ($user_data) { es_session::delete("api_user_info"); $GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_token = '" . $api_data['token'] . "',tencent_secret = '" . $api_data['secret'] . "',login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",tencent_url = '" . $api_data['url'] . "' where id =" . $user_data['id']); update_user_weibo($user_data['id'], $api_data['url']); //更新微博 es_session::set("user_info", $user_data); app_redirect_preview(); } else { if ($GLOBALS['user_info']) { update_user_weibo($GLOBALS['user_info']['id'], $api_data['url']); //更新微博 $GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_id = '" . $openid . "',tencent_token = '" . $api_data['token'] . "',tencent_secret = '" . $api_data['secret'] . "',tencent_url = '" . $api_data['url'] . "' where id =" . intval($GLOBALS['user_info']['id'])); app_redirect(url("settings#bind")); } else { app_redirect(url("user#api_register")); } } } }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); $id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/event.php"; $event = get_event($id); if ($event) { set_view_history("event", $event['id']); $history_ids = get_view_history("event"); //浏览历史 if ($history_ids) { $ids_conditioin = " e.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } $event['content'] = format_html_content_image($event['content'], 720); $event['submitted_data'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where event_id = " . $event['id'] . " and user_id = '" . $GLOBALS['user_info']['id'] . "'"); $GLOBALS['tmpl']->assign("event", $event); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他优惠券 $side_event_list = get_event_list(app_conf("SIDE_DEAL_COUNT"), array(EVENT_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "", " e.submit_count desc "); $GLOBALS['tmpl']->assign("side_event_list", $side_event_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($event['supplier_info']['name']) { $page_title .= "[" . $event['supplier_info']['name'] . "]"; $page_keyword .= $event['supplier_info']['name'] . ","; $page_description .= $event['supplier_info']['name'] . ","; } $page_title .= $event['name']; $page_keyword .= $event['name'] . ","; $page_description .= $event['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($event['cate_id']) { $event['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "event_cate where id = " . $event['cate_id']); $event['cate_url'] = url("index", "events", array("cid" => $event['cate_id'])); } if ($event['cate_name']) { $page_title .= " - " . $event['cate_name']; $page_keyword .= $event['cate_name'] . ","; $page_description .= $event['cate_name'] . ","; $site_nav[] = array('name' => $event['cate_name'], 'url' => $event['cate_url']); } $site_nav[] = array('name' => $event['name'], 'url' => $event['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("event.html"); } else { app_redirect_preview(); } }
public function store() { global_run(); init_app_page(); $id = intval($_REQUEST['id']); $type = intval($_REQUEST['type']); //0主表 1提交表 require_once APP_ROOT_PATH . "system/model/supplier.php"; if ($type == 0) { $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($store_info) { //开始输出商户图库数据json $store_images = $GLOBALS['db']->getAll("select brief,image from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $store_info['id'] . " and status = 1 order by sort limit " . MAX_SP_IMAGE); foreach ($store_images as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v['image'], 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); } } else { $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_biz_submit where id = " . $id); if ($store_info) { //开始输出商户图库数据json $store_images_rs = unserialize($store_info['cache_supplier_location_images']); foreach ($store_images_rs as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v, 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); } } if ($store_info) { if (!$this->is_manage()) { $account_info = es_session::get('account_info'); if ($store_info['supplier_id'] != $account_info['supplier_id']) { app_redirect(url("index")); } } $store_info['good_rate_precent'] = round($store_info['good_rate'] * 100, 1); $store_info['ref_avg_price'] = round($store_info['ref_avg_price'], 2); $store_info['brief'] = format_html_content_image($store_info['brief'], 720); $GLOBALS['tmpl']->assign("store_info", $store_info); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; $page_title .= $store_info['name']; $page_keyword .= $store_info['name'] . ","; $page_description .= $store_info['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($store_info['deal_cate_id']) { $store_info['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $store_info['deal_cate_id']); $store_info['cate_url'] = url("index", "stores", array("cid" => $store_info['deal_cate_id'])); } if ($store_info['cate_name']) { $page_title .= " - " . $store_info['cate_name']; $page_keyword .= $store_info['cate_name'] . ","; $page_description .= $store_info['cate_name'] . ","; $site_nav[] = array('name' => $store_info['cate_name'], 'url' => $store_info['cate_url']); } $site_nav[] = array('name' => $store_info['name'], 'url' => $store_info['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); if ($store_info['seo_title']) { $page_title = $store_info['seo_title']; } if ($store_info['seo_keyword']) { $page_keyword = $store_info['seo_keyword']; } if ($store_info['seo_description']) { $page_description = $store_info['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); } else { app_redirect_preview(); } $GLOBALS['tmpl']->assign("preview", true); $GLOBALS['tmpl']->display("store.html"); }
public function index() { global_run(); init_app_page(); $deal_key = strim($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal = get_deal($deal_key); if ($deal) { if ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $GLOBALS['tmpl']->assign("cate_tree_type", 2); } else { set_view_history("shop", $deal['id']); $history_ids = get_view_history("shop"); $GLOBALS['tmpl']->assign("cate_tree_type", 1); } $GLOBALS['tmpl']->assign("search_type", 5); } else { set_view_history("deal", $deal['id']); $history_ids = get_view_history("deal"); } //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; if ($deal['is_shop'] == 0) { $history_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 0) { $history_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } } //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //$GLOBALS['tmpl']->assign("drop_nav","no_drop"); //首页下拉菜单不输出 //$GLOBALS['tmpl']->assign("wrap_type","1"); //首页宽屏展示 $deal['description'] = format_html_content_image($deal['description'], 720); $deal['notes'] = format_html_content_image($deal['notes'], 720); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他团购 if ($deal['is_shop'] == 0) { $side_deal_list = get_deal_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 and d.id<>" . $deal['id']); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type = 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } else { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } } //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($deal['supplier_info']['name']) { $page_title .= "[" . $deal['supplier_info']['name'] . "]"; $page_keyword .= $deal['supplier_info']['name'] . ","; $page_description .= $deal['supplier_info']['name'] . ","; } $page_title .= $deal['sub_name']; $page_keyword .= $deal['sub_name'] . ","; $page_description .= $deal['sub_name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($deal['cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id']); $deal['cate_url'] = url("index", "tuan", array("cid" => $deal['cate_id'])); } elseif ($deal['shop_cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "shop_cate where id = " . $deal['shop_cate_id']); if ($deal['buy_type'] == 1) { $deal['cate_url'] = url("index", "scores", array("cid" => $deal['shop_cate_id'])); } else { $deal['cate_url'] = url("index", "cate", array("cid" => $deal['shop_cate_id'])); } } if ($deal['cate_name']) { $page_title .= " - " . $deal['cate_name']; $page_keyword .= $deal['cate_name'] . ","; $page_description .= $deal['cate_name'] . ","; $site_nav[] = array('name' => $deal['cate_name'], 'url' => $deal['cate_url']); } $site_nav[] = array('name' => $deal['sub_name'], 'url' => $deal['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出促销 if ($deal['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } if ($deal['seo_title']) { $page_title = $deal['seo_title']; } if ($deal['seo_keyword']) { $page_keyword = $deal['seo_keyword']; } if ($deal['seo_description']) { $page_description = $deal['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("deal.html"); } else { app_redirect_preview(); } }
public function callback() { require_once APP_ROOT_PATH . 'system/api_login/sina/saetv2.ex.class.php'; es_session::start(); //$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 = get_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; } } $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获取用户等基本信息 //name,url,province,city,avatar,token,field,token_field(授权的字段),sex,secret_field(授权密码的字段),scret,url_field(微博地址的字段) $api_data['name'] = $msg['name']; $api_data['url'] = "http://weibo.com/" . $msg['profile_url']; $location = $msg['location']; $location = explode(" ", $location); $api_data['province'] = $location[0]; $api_data['city'] = $location[1]; $api_data['avatar'] = $msg['http://tp2.sinaimg.cn/3048107865/180/0/1']; $api_data['field'] = 'sina_id'; $api_data['token'] = $token['access_token']; $api_data['token_field'] = "sina_token"; $api_data['secret'] = ""; $api_data['secret_field'] = "sina_secret"; $api_data['url_field'] = "sina_url"; if ($msg['gender'] == 'm') { $api_data['sex'] = 1; } else { if ($msg['gender'] == 'f') { $api_data['sex'] = 0; } else { $api_data['sex'] = -1; } } if ($msg['name'] != "") { es_session::set("api_user_info", $api_data); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where sina_id = '" . $api_data['name'] . "' and sina_id <> ''"); if ($user_data) { es_session::delete("api_user_info"); $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_token = '" . $api_data['token'] . "',login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",sina_url = '" . $api_data['url'] . "' where id =" . $user_data['id']); update_user_weibo($user_data['id'], $api_data['url']); //更新微博 es_session::set("user_info", $user_data); app_redirect_preview(); } else { if ($GLOBALS['user_info']) { update_user_weibo($GLOBALS['user_info']['id'], $api_data['url']); //更新微博 $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_id = '" . $api_data['name'] . "',sina_token = '" . $api_data['token'] . "',sina_url = '" . $api_data['url'] . "' where id =" . intval($GLOBALS['user_info']['id'])); app_redirect(url("settings#bind")); } else { app_redirect(url("user#api_register")); } } }
public function bank() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } if ($GLOBALS['user_info']['ex_real_name'] != "" || $GLOBALS['user_info']['ex_account_info'] != "" || $GLOBALS['user_info']['ex_contact'] != "") { app_redirect_preview(); } $GLOBALS['tmpl']->display("settings_bank.html"); }
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(); } }
public function index() { global_run(); init_app_page(); $store_id = intval($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/supplier.php"; $store_info = get_location($store_id); if ($store_info) { set_view_history("store", $store_info['id']); $history_ids = get_view_history("store"); //浏览历史 if ($history_ids) { $ids_conditioin = " sl.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_location_list(app_conf("SIDE_DEAL_COUNT"), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } $store_info['good_rate_precent'] = round($store_info['good_rate'] * 100, 1); $store_info['ref_avg_price'] = round($store_info['ref_avg_price'], 2); $store_info['brief'] = format_html_content_image($store_info['brief'], 720); $GLOBALS['tmpl']->assign("store_info", $store_info); //开始输出商户图库数据json $store_images = $GLOBALS['db']->getAll("select brief,image from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $store_info['id'] . " and status = 1 order by sort limit " . MAX_SP_IMAGE); foreach ($store_images as $k => $v) { $store_images[$k]['image'] = format_image_path(get_spec_image($v['image'], 600, 450, 1)); } $GLOBALS['tmpl']->assign("store_images_json", json_encode($store_images)); $GLOBALS['tmpl']->assign("store_images_count", count($store_images)); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; $page_title .= $store_info['name']; $page_keyword .= $store_info['name'] . ","; $page_description .= $store_info['name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($store_info['deal_cate_id']) { $store_info['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $store_info['deal_cate_id']); $store_info['cate_url'] = url("index", "stores", array("cid" => $store_info['deal_cate_id'])); } if ($store_info['cate_name']) { $page_title .= " - " . $store_info['cate_name']; $page_keyword .= $store_info['cate_name'] . ","; $page_description .= $store_info['cate_name'] . ","; $site_nav[] = array('name' => $store_info['cate_name'], 'url' => $store_info['cate_url']); } $site_nav[] = array('name' => $store_info['name'], 'url' => $store_info['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); if ($store_info['seo_title']) { $page_title = $store_info['seo_title']; } if ($store_info['seo_keyword']) { $page_keyword = $store_info['seo_keyword']; } if ($store_info['seo_description']) { $page_description = $store_info['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); //输出右侧的其他团购 require_once APP_ROOT_PATH . "system/model/deal.php"; $side_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $store_info['deal_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 "); //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); } else { app_redirect_preview(); } $GLOBALS['tmpl']->display("store.html"); }
public function clear() { require_once APP_ROOT_PATH . 'system/model/city.php'; City::clear_geo(); app_redirect_preview(); }
public function callback() { es_session::start(); 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; } $msg = json_decode($response, 1); //file_put_contents(APP_ROOT_PATH."/public/qqv2_user_info.php",print_r($msg,1)); //name,province,city,avatar,token,field,token_field(授权的字段),sex $api_data['id'] = $openid; $api_data['field'] = 'qq_id'; $api_data['token'] = $access_token; $api_data['token_field'] = "qq_token"; $api_data['name'] = $msg['nickname']; $api_data['province'] = $msg['province']; $api_data['city'] = $msg['city']; $api_data['avatar'] = $msg['figureurl_2']; //100*100 if ($msg['gender'] == '女') { $api_data['sex'] = 0; } else { if ($msg['gender'] == '男') { $api_data['sex'] = 1; } else { $api_data['sex'] = -1; } } if ($api_data['id'] != "") { es_session::set("api_user_info", $api_data); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where qq_id = '" . $openid . "' and qq_id <> '' and is_effect=1"); if ($user_data) { es_session::delete("api_user_info"); $GLOBALS['db']->query("update " . DB_PREFIX . "user set qq_token = '" . $api_data['token'] . "',login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . " where id =" . $user_data['id']); es_session::set("user_info", $user_data); app_redirect_preview(); } else { if ($GLOBALS['user_info']) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set qq_token = '" . $api_data['id'] . "',qq_token = '" . $api_data['token'] . "' where id =" . intval($GLOBALS['user_info']['id'])); app_redirect(url("settings#bind")); } else { app_redirect(url("user#api_register")); } } }