//密码 if ($cookie_uname != '' && $cookie_upwd != '') { $cookie_uname = strim($cookie_uname); if (strlen($cookie_upwd) != 32) { $cookie_upwd = md5($cookie_upwd); } $cookie_upwd = md5($cookie_upwd . "_EASE_COOKIE"); auto_do_login_user($cookie_uname, $cookie_upwd); $GLOBALS['user_info'] = es_session::get('user_info'); } } require_once APP_ROOT_PATH . "app/Lib/main/core/main_lib.php"; refresh_user_info(); //刷新购物车 require_once APP_ROOT_PATH . "system/model/cart.php"; refresh_cart_list(); require APP_ROOT_PATH . 'app/Lib/common.php'; require APP_ROOT_PATH . 'sjmapi/lib/functions.php'; //缓存的名称以MAPI_开头 require APP_ROOT_PATH . 'sjmapi/lib/logUtils.php'; define('AS_LOG_DIR', APP_ROOT_PATH . 'sjmapi/log/'); define('AS_DEBUG', true); //$domain = app_conf("PUBLIC_DOMAIN_ROOT")==''?get_domain().APP_ROOT:app_conf("PUBLIC_DOMAIN_ROOT"); //file_put_contents(APP_ROOT_PATH. "sjmapi/log/bm_".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($domain,true)); $m_config = getMConfig(); //初始化手机端配置 define('VERSION', 1); //接口版本号,float 类型 define("CACHE_TIME", 60); //动态数据缓存时间,300秒 if (intval($m_config['page_size']) == 0) {
/** * 前端全运行函数,生成系统前台使用的全局变量 * 1. 定位城市 GLOBALS['city']; * 2. 加载会员 GLOBALS['user_info']; * 3. 生成语言包 * 4. 加载推荐人与来路 * 5. 更新购物车 */ function global_run() { if (app_conf("SHOP_OPEN") == 0) { app_redirect(url("index", "close")); } //处理城市 global $city; require_once APP_ROOT_PATH . "system/model/city.php"; $city = City::locate_city(); global $geo; $geo = City::locate_geo(floatval($_REQUEST['xpoint']), floatval($_REQUEST['ypoint'])); //输出语言包的js if (!file_exists(get_real_path() . "public/runtime/app/lang.js")) { $str = "var LANG = {"; foreach ($GLOBALS['lang'] as $k => $lang_row) { $str .= "\"" . $k . "\":\"" . str_replace("nbr", "\\n", addslashes($lang_row)) . "\","; } $str = substr($str, 0, -1); $str .= "};"; @file_put_contents(get_real_path() . "public/runtime/app/lang.js", $str); } //会员自动登录及输出 global $user_info; global $user_logined; require_once APP_ROOT_PATH . "system/model/user.php"; $user_info = es_session::get('user_info'); if (empty($user_info)) { $cookie_uname = es_cookie::get("user_name") ? es_cookie::get("user_name") : ''; $cookie_upwd = es_cookie::get("user_pwd") ? es_cookie::get("user_pwd") : ''; if ($cookie_uname != '' && $cookie_upwd != '' && !es_session::get("user_info")) { $cookie_uname = strim($cookie_uname); $cookie_upwd = strim($cookie_upwd); auto_do_login_user($cookie_uname, $cookie_upwd); $user_info = es_session::get('user_info'); } } refresh_user_info(); //刷新购物车 require_once APP_ROOT_PATH . "system/model/cart.php"; refresh_cart_list(); global $ref_uid; //保存返利的cookie if ($_REQUEST['r']) { $rid = intval(base64_decode($_REQUEST['r'])); $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval($rid))); es_cookie::set("REFERRAL_USER", intval($ref_uid)); } else { //获取存在的推荐人ID if (intval(es_cookie::get("REFERRAL_USER")) > 0) { $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval(es_cookie::get("REFERRAL_USER")))); } } global $referer; //保存来路 // es_cookie::delete("referer_url"); if (!es_cookie::get("referer_url")) { if (!preg_match("/" . urlencode(SITE_DOMAIN . APP_ROOT) . "/", urlencode($_SERVER["HTTP_REFERER"]))) { $ref_url = $_SERVER["HTTP_REFERER"]; if (substr($ref_url, 0, 7) == "http://" || substr($ref_url, 0, 8) == "https://") { preg_match("/http[s]*:\\/\\/[^\\/]+/", $ref_url, $ref_url); $referer = $ref_url[0]; if ($referer) { es_cookie::set("referer_url", $referer); } } } } else { $referer = es_cookie::get("referer_url"); } $referer = strim($referer); }