当前位置: 首页>>代码示例>>PHP>>正文


PHP es_session::id方法代码示例

本文整理汇总了PHP中es_session::id方法的典型用法代码示例。如果您正苦于以下问题:PHP es_session::id方法的具体用法?PHP es_session::id怎么用?PHP es_session::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在es_session的用法示例。


在下文中一共展示了es_session::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: count_buy_total

 public function count_buy_total()
 {
     require_once APP_ROOT_PATH . "system/libs/cart.php";
     $region_id = intval($_REQUEST['region_id']);
     //配送地区
     $delivery_id = intval($_REQUEST['delivery_id']);
     //配送方式
     $account_money = floatval($_REQUEST['account_money']);
     //余额
     $ecvsn = $_REQUEST['ecvsn'] ? addslashes(trim($_REQUEST['ecvsn'])) : '';
     $ecvpassword = $_REQUEST['ecvpassword'] ? addslashes(trim($_REQUEST['ecvpassword'])) : '';
     $payment = intval($_REQUEST['payment']);
     $all_account_money = intval($_REQUEST['all_account_money']);
     $bank_id = addslashes(trim($_REQUEST['bank_id']));
     $user_id = intval($GLOBALS['user_info']['id']);
     $session_id = es_session::id();
     $goods_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cart where session_id='" . $session_id . "' and user_id=" . $user_id);
     $result = count_buy_total($region_id, $delivery_id, $payment, $account_money, $all_account_money, $ecvsn, $ecvpassword, $goods_list, 0, 0, $bank_id);
     $GLOBALS['tmpl']->assign("result", $result);
     $html = $GLOBALS['tmpl']->fetch("inc/inc_cart_total.html");
     $data = $result;
     $data['html'] = $html;
     ajax_return($data);
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:24,代码来源:ajaxModule.class.php

示例2: done

 public function done()
 {
     require_once APP_ROOT_PATH . "system/model/cart.php";
     require_once APP_ROOT_PATH . "system/model/deal.php";
     require_once APP_ROOT_PATH . "system/model/deal_order.php";
     global_run();
     $ajax = 1;
     $region4_id = intval($_REQUEST['region_lv4']);
     $region3_id = intval($_REQUEST['region_lv3']);
     $region2_id = intval($_REQUEST['region_lv2']);
     $region1_id = intval($_REQUEST['region_lv1']);
     if ($region4_id == 0) {
         if ($region3_id == 0) {
             if ($region2_id == 0) {
                 $region_id = $region1_id;
             } else {
                 $region_id = $region2_id;
             }
         } else {
             $region_id = $region3_id;
         }
     } else {
         $region_id = $region4_id;
     }
     $delivery_id = intval($_REQUEST['delivery']);
     $payment = intval($_REQUEST['payment']);
     $account_money = floatval($_REQUEST['account_money']);
     $all_account_money = intval($_REQUEST['all_account_money']);
     $ecvsn = $_REQUEST['ecvsn'] ? strim($_REQUEST['ecvsn']) : '';
     $ecvpassword = $_REQUEST['ecvpassword'] ? strim($_REQUEST['ecvpassword']) : '';
     $user_id = intval($GLOBALS['user_info']['id']);
     $session_id = es_session::id();
     $cart_result = load_cart_list();
     $goods_list = $cart_result['cart_list'];
     if (!$goods_list) {
         showErr($GLOBALS['lang']['CART_EMPTY_TIP'], $ajax);
     }
     //验证购物车
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax, url("index", "user#login"));
     }
     $deal_ids = array();
     foreach ($goods_list as $k => $v) {
         $data = check_cart($v['id'], $v['number']);
         if (!$data['status']) {
             showErr($data['info'], $ajax, url("index", "cart#index"));
         }
         $deal_ids[$v['deal_id']]['deal_id'] = $v['deal_id'];
     }
     foreach ($deal_ids as $row) {
         //验证支付方式的支持
         if ($GLOBALS['db']->getOne("select define_payment from " . DB_PREFIX . "deal where id = " . $row['deal_id']) == 1) {
             if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_payment where deal_id = " . $row['deal_id'] . " and payment_id = " . $payment)) {
                 showErr($GLOBALS['lang']['INVALID_PAYMENT'], $ajax, url("index", "cart#index"));
             }
         }
     }
     //结束验证购物车
     //开始验证订单接交信息
     $data = count_buy_total($region_id, $delivery_id, $payment, $account_money, $all_account_money, $ecvsn, $ecvpassword, $goods_list);
     if ($data['is_delivery'] == 1) {
         //配送验证
         if (!$data['region_info'] || $data['region_info']['region_level'] != 4) {
             showErr($GLOBALS['lang']['FILL_CORRECT_CONSIGNEE_ADDRESS'], $ajax);
         }
         if (trim($_REQUEST['consignee']) == '') {
             showErr($GLOBALS['lang']['FILL_CORRECT_CONSIGNEE'], $ajax);
         }
         if (trim($_REQUEST['address']) == '') {
             showErr($GLOBALS['lang']['FILL_CORRECT_ADDRESS'], $ajax);
         }
         if (trim($_REQUEST['zip']) == '') {
             showErr($GLOBALS['lang']['FILL_CORRECT_ZIP'], $ajax);
         }
         if (trim($_REQUEST['mobile']) == '') {
             showErr($GLOBALS['lang']['FILL_MOBILE_PHONE'], $ajax);
         }
         if (!check_mobile(trim($_REQUEST['mobile']))) {
             showErr($GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'], $ajax);
         }
         if (!$data['delivery_info']) {
             showErr($GLOBALS['lang']['PLEASE_SELECT_DELIVERY'], $ajax);
         }
     }
     if (round($data['pay_price'], 4) > 0 && !$data['payment_info']) {
         showErr($GLOBALS['lang']['PLEASE_SELECT_PAYMENT'], $ajax);
     }
     //结束验证订单接交信息
     //开始生成订单
     $now = NOW_TIME;
     $order['type'] = 0;
     //普通订单
     $order['user_id'] = $user_id;
     $order['create_time'] = $now;
     $order['total_price'] = $data['pay_total_price'];
     //应付总额  商品价 - 会员折扣 + 运费 + 支付手续费
     $order['pay_amount'] = 0;
     $order['pay_status'] = 0;
     //新单都为零, 等下面的流程同步订单状态
     $order['delivery_status'] = $data['is_delivery'] == 0 ? 5 : 0;
//.........这里部分代码省略.........
开发者ID:macall,项目名称:jsd,代码行数:101,代码来源:cartModule.class.php

示例3: index

 public function index()
 {
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $money = floatval($user['money']);
     $root = array();
     $root['return'] = 1;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         //已登录
         $region4_id = intval($GLOBALS['request']['region_lv4']);
         $region3_id = intval($GLOBALS['request']['region_lv3']);
         $region2_id = intval($GLOBALS['request']['region_lv2']);
         $region1_id = intval($GLOBALS['request']['region_lv1']);
         if ($region4_id == 0) {
             if ($region3_id == 0) {
                 if ($region2_id == 0) {
                     $region_id = $region1_id;
                 } else {
                     $region_id = $region2_id;
                 }
             } else {
                 $region_id = $region3_id;
             }
         } else {
             $region_id = $region4_id;
         }
         $payment = $GLOBALS['request']['payment_id'] ? intval($GLOBALS['request']['payment_id']) : 17;
         $account_money = floatval($GLOBALS['request']['use_user_money']);
         $address = strim($GLOBALS['request']['delivery_detail']);
         $consignee_mobile = strim($GLOBALS['request']['phone']);
         $zip = strim($GLOBALS['request']['postcode']);
         $consignee = strim($GLOBALS['request']['consignee']);
         $ecvsn = $GLOBALS['request']['ecv_sn'] ? strim($GLOBALS['request']['ecv_sn']) : '';
         $ecvpassword = $GLOBALS['request']['ecv_pwd'] ? strim($GLOBALS['request']['ecv_pwd']) : '';
         $order_memo = strim($GLOBALS['request']['content']);
         $send_mobile = strim($GLOBALS['request']['send_mobile']);
         $delivery_id = intval($GLOBALS['request']['delivery_id']);
         $order_time = $GLOBALS['request']['order_time'];
         $technician_id = $GLOBALS['request']['tech_id'];
         if (empty($order_time)) {
             $root['status'] = 0;
             $root['info'] = '请选择预约时间';
             output($root);
         }
         $order_time .= ':00';
         $order_time = strtotime($order_time);
         //$delivery_id = intval($GLOBALS['m_config']['delivery_id']);
         $coupon_mobile = htmlspecialchars($send_mobile);
         if ($coupon_mobile != '') {
             $i = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $coupon_mobile . "' and id != " . intval($user_id)));
             if ($i > 0) {
                 $root['status'] = 0;
                 $root['info'] = '该手机号码,已经被占用';
                 output($root);
             }
         }
         $account_pay = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where class_name = 'Account'");
         if ($account_pay) {
             $all_account_money = 1;
         } else {
             $all_account_money = 0;
         }
         if ($GLOBALS['request']['from'] == "wap") {
             $cartdata = unserialize(base64_decode($GLOBALS['request']['cartdata']));
             $res = insertCartData($user_id, es_session::id(), $cartdata);
         } else {
             $cartdata = $GLOBALS['request']['cartdata'];
             $res = insertCartData($user_id, es_session::id(), $cartdata);
         }
         if ($res['info'] != '') {
             //失败有错误
             $root['status'] = 0;
             $root['info'] = $res['info'];
             output($root);
         } else {
             //可以提交订单
             $goods_list = $res['data'];
             require_once APP_ROOT_PATH . "system/model/cart.php";
             $GLOBALS['user_info']['id'] = $user_id;
             $ids = array();
             foreach ($goods_list as $cart_goods) {
                 array_push($ids, $cart_goods['deal_id']);
             }
             $ids_str = implode(",", $ids);
             $is_delivery = intval($GLOBALS['db']->getOne("select is_delivery from " . DB_PREFIX . "deal where is_delivery = 1 and id in (" . $ids_str . ")"));
             if ($is_delivery == 0) {
                 $delivery_id = 0;
             }
             $data = count_buy_total($region_id, $delivery_id, $payment, $account_money, $all_account_money, $ecvsn, $ecvpassword, $goods_list);
             if ($data['is_delivery'] == 1) {
                 //配送验证
                 if (!$data['region_info'] || $data['region_info']['region_level'] != 4) {
                     $root['info'] = $GLOBALS['lang']['FILL_CORRECT_CONSIGNEE_ADDRESS'];
                     $root['status'] = 0;
                     output($root);
                 } elseif ($consignee == '') {
                     $root['info'] = $GLOBALS['lang']['FILL_CORRECT_CONSIGNEE'];
                     $root['status'] = 0;
//.........这里部分代码省略.........
开发者ID:macall,项目名称:jishida,代码行数:101,代码来源:done_cart.action.php

示例4: count_buy_total

 /**
  * 计算购物车总价
  */
 public function count_buy_total()
 {
     global_run();
     require_once APP_ROOT_PATH . "system/model/cart.php";
     $region_id = intval($_REQUEST['region_id']);
     //配送地区
     $delivery_id = intval($_REQUEST['delivery_id']);
     //配送方式
     $account_money = floatval($_REQUEST['account_money']);
     //余额
     $ecvsn = $_REQUEST['ecvsn'] ? addslashes(trim($_REQUEST['ecvsn'])) : '';
     $ecvpassword = $_REQUEST['ecvpassword'] ? addslashes(trim($_REQUEST['ecvpassword'])) : '';
     $payment = intval($_REQUEST['payment']);
     $all_account_money = intval($_REQUEST['all_account_money']);
     $bank_id = strim(trim($_REQUEST['bank_id']));
     $user_id = intval($GLOBALS['user_info']['id']);
     $session_id = es_session::id();
     $cart_result = load_cart_list();
     $goods_list = $cart_result['cart_list'];
     $result = count_buy_total($region_id, $delivery_id, $payment, $account_money, $all_account_money, $ecvsn, $ecvpassword, $goods_list, 0, 0, $bank_id);
     $GLOBALS['tmpl']->assign("result", $result);
     $html = $GLOBALS['tmpl']->fetch("inc/cart_total.html");
     $data = $result;
     $data['html'] = $html;
     $data['expire'] = empty($goods_list) ? true : false;
     if ($data['expire']) {
         $data['jump'] = url("index", "cart");
     }
     ajax_return($data);
 }
开发者ID:macall,项目名称:jsd,代码行数:33,代码来源:ajaxModule.class.php

示例5: strtolower

}
if (isset($request_param['act'])) {
    $act2 = strtolower(strim($request_param['act'])) ? strtolower(strim($request_param['act'])) : "";
} else {
    $act2 = 'index';
}
if (empty($act2)) {
    $act2 = 'index';
}
$is_weixin = isWeixin();
$m_config = getMConfig();
//初始化手机端配置
//用户登陆处理;
user_login();
$user_info = es_session::get('user_info');
$request_param['session_id'] = es_session::id();
require_once APP_ROOT_PATH . 'system/utils/weixin.php';
if ($_REQUEST['code'] && $_REQUEST['state'] == 1 && $m_config['wx_app_key'] && $m_config['wx_app_secret'] && !$user_info) {
    require_once APP_ROOT_PATH . 'system/model/user.php';
    $weixin = new weixin($m_config['wx_app_key'], $m_config['wx_app_secret'], get_domain() . APP_ROOT . "/wap/index.php");
    global $wx_info;
    $wx_info = $weixin->scope_get_userinfo($_REQUEST['code']);
    $GLOBALS['tmpl']->assign('wx_info', $wx_info);
    //用户未登陆
    if ($wx_info['openid']) {
        $wx_user_info = get_user_has('wx_openid', $wx_info['openid']);
        if ($wx_user_info) {
            //如果会员存在,直接登录
            do_login_user($wx_user_info['mobile'], $wx_user_info['user_pwd']);
        } else {
            //会员不存在进入登录流程
开发者ID:macall,项目名称:baikec_jsd,代码行数:31,代码来源:index.php

示例6: callback

 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 = trim(addslashes($_REQUEST['code']));
     $openid = trim(addslashes($_REQUEST['openid']));
     $openkey = trim(addslashes($_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'];
     $is_bind = intval(es_session::get("is_bind"));
     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")) {
         $msg['field'] = 'tencent_id';
         $msg['id'] = $name;
         $msg['name'] = $name;
         $msg['t_access_token'] = $access_token;
         $msg['t_openid'] = $access_token;
         $msg['t_openkey'] = $openkey;
         es_session::set("api_user_info", $msg);
         if (!$msg['name']) {
             app_redirect(url("index"));
         }
         $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where tencent_id = '" . $name . "' and tencent_id <> ''");
         if ($user_data) {
             $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
             $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
             if ($user_current_group['score'] < $user_group['score']) {
                 $user_data['group_id'] = intval($user_group['id']);
             }
             $GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
             $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'");
             require_once APP_ROOT_PATH . "system/libs/user.php";
             auto_do_login_user($user_data['user_name'], $user_data['user_pwd'], $from_cookie = false);
             es_session::delete("api_user_info");
             app_recirect_preview();
         } else {
             $this->create_user();
             app_redirect(url("shop", "user#stepone"));
         }
     }
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:58,代码来源:Tencent_api.php

示例7: do_login_user

/**
 * 处理会员登录
 * @param $user_name_or_email 用户名或邮箱地址
 * @param $user_pwd 密码
 * 
 */
function do_login_user($phone, $user_pwd)
{
    $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where mobile= " . $phone . "  and is_delete = 0");
    if (!$user_data) {
        $result['status'] = 0;
        $result['data'] = ACCOUNT_NO_EXIST_ERROR;
        return $result;
    } else {
        $result['user'] = $user_data;
        if ($user_data['is_effect'] != 1) {
            $result['status'] = 0;
            $result['data'] = ACCOUNT_NO_VERIFY_ERROR;
            return $result;
        } else {
            if (intval($result['status']) == 0) {
                $result['status'] = 1;
            }
            //登录成功自动检测关于会员等级以及自动登录商家
            $account_name = $user_data['merchant_name'];
            $account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and is_effect = 1 and is_delete = 0");
            if ($account) {
                /*$account_locations = $GLOBALS['db']->getAll("select location_id from ".DB_PREFIX."supplier_account_location_link where account_id = ".$account['id']);
                 * 
                 */
                $account_locations = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "supplier_location where supplier_id = " . $account['supplier_id']);
                $account_location_ids = array(0);
                foreach ($account_locations as $row) {
                    $account_location_ids[] = $row['id'];
                }
                $account['location_ids'] = $account_location_ids;
                es_session::set("account_info", $account);
                $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_ip = '" . get_client_ip() . "' where id=" . $account['id']);
            }
            $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
            $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
            if ($user_current_group['score'] < $user_group['score']) {
                $user_data['group_id'] = intval($user_group['id']);
                $GLOBALS['db']->query("update " . DB_PREFIX . "user set group_id = " . $user_data['group_id'] . " where id = " . $user_data['id']);
                $pm_title = "您已经成为" . $user_group['name'] . "";
                $pm_content = "恭喜您,您已经成为" . $user_group['name'] . "。";
                if ($user_group['discount'] < 1) {
                    $pm_content .= "您将享有" . $user_group['discount'] * 10 . "折的购物优惠";
                }
                send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true);
            }
            $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($user_data['level_id']));
            $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($user_data['point']) . " order by point desc");
            if ($user_current_level['point'] < $user_level['point']) {
                $user_data['level_id'] = intval($user_level['id']);
                $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']);
                $pm_title = "您已经成为" . $user_level['name'] . "";
                $pm_content = "恭喜您,您已经成为" . $user_level['name'] . "。";
                send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true);
            }
            if ($user_current_level['point'] > $user_level['point']) {
                $user_data['level_id'] = intval($user_level['id']);
                $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']);
                $pm_title = "您已经降为" . $user_level['name'] . "";
                $pm_content = "很报歉,您已经降为" . $user_level['name'] . "。";
                send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true);
            }
            es_session::set("user_info", $user_data);
            $GLOBALS['user_info'] = $user_data;
            //检测勋章
            $medal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "medal where is_effect = 1 and allow_check = 1");
            foreach ($medal_list as $medal) {
                $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php";
                $cls = $medal['class_name'] . "_medal";
                if (file_exists($file)) {
                    require_once $file;
                    if (class_exists($cls)) {
                        $o = new $cls();
                        $check_result = $o->check_medal();
                        if ($check_result['status'] == 0) {
                            send_user_msg($check_result['info'], $check_result['info'], 0, $user_data['id'], get_gmtime(), 0, true, true);
                        }
                    }
                }
            }
            $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
            //更新购物车
            $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'");
            $s_api_user_info = es_session::get("api_user_info");
            if ($s_api_user_info) {
                $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $s_api_user_info['field'] . " = '" . $s_api_user_info['id'] . "' where id = " . $user_data['id'] . " and (" . $s_api_user_info['field'] . " = 0 or " . $s_api_user_info['field'] . "='')");
                es_session::delete("api_user_info");
            }
            $result['step'] = intval($user_data["step"]);
            return $result;
        }
    }
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:98,代码来源:user.php

示例8: syn_cart

/**
* 
1. 如果购物车中有禁用(3), 如果禁用项最后加入,保留禁用项,反之,删除禁用项
2. 如购物车中有按商户禁用(2), 如果加入商户禁用是最后加入,删除与之不相同的商户的商品,反之删除需商户禁用的所有相关的商品
3. 如购物车中有按商品禁用(1), 如果加入商品禁用是最后加入,删除与之不相同的商品,反之删除该商品
*/
function syn_cart()
{
    $first_row = $GLOBALS['db']->getRow("select dc.*,d.cart_type as cart_type from " . DB_PREFIX . "deal_cart as dc left join " . DB_PREFIX . "deal as d on dc.deal_id = d.id where dc.session_id = '" . es_session::id() . "' and dc.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dc.create_time desc");
    //1. 处理禁用全部的状态 cart_type 3
    $result = $GLOBALS['db']->getAll("select dc.id,dc.deal_id,dc.supplier_id from " . DB_PREFIX . "deal_cart as dc left join " . DB_PREFIX . "deal as d on dc.deal_id = d.id where dc.session_id = '" . es_session::id() . "' and dc.user_id = " . intval($GLOBALS['user_info']['id']) . " and d.cart_type = 3");
    if ($result) {
        if ($first_row['cart_type'] == 3) {
            //保留禁用购物车的产品,其他删除
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and id <> " . $first_row['id']);
            return;
        } else {
            $ids = array(0);
            foreach ($result as $row) {
                array_push($ids, $row['id']);
            }
            //删除禁用购物车的产品
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and id in (" . implode(",", $ids) . ")");
            return;
        }
    }
    //2. 处理按商户禁用的状态 cart_type 2
    $result = $GLOBALS['db']->getAll("select dc.id,dc.deal_id,dc.supplier_id from " . DB_PREFIX . "deal_cart as dc left join " . DB_PREFIX . "deal as d on dc.deal_id = d.id where dc.session_id = '" . es_session::id() . "' and dc.user_id = " . intval($GLOBALS['user_info']['id']) . " and d.cart_type = 2");
    if ($result) {
        if ($first_row['cart_type'] == 2) {
            //保留禁用商户的产品以及同商户商品,其他删除
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and supplier_id <> " . $first_row['supplier_id']);
            return;
        } else {
            $ids = array(0);
            foreach ($result as $row) {
                array_push($ids, $row['supplier_id']);
            }
            //删除禁用商户的产品以及同商户商品
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and supplier_id in (" . implode(",", $ids) . ")");
            return;
        }
    }
    //3. 处理按商品禁用的状态 cart_type 1
    $result = $GLOBALS['db']->getAll("select dc.id,dc.deal_id,dc.supplier_id from " . DB_PREFIX . "deal_cart as dc left join " . DB_PREFIX . "deal as d on dc.deal_id = d.id where dc.session_id = '" . es_session::id() . "' and dc.user_id = " . intval($GLOBALS['user_info']['id']) . " and d.cart_type = 1");
    if ($result) {
        if ($first_row['cart_type'] == 1) {
            //保留禁用商品以及其他款式的商品,其他删除
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and deal_id <> " . $first_row['deal_id']);
            return;
        } else {
            $ids = array(0);
            foreach ($result as $row) {
                array_push($ids, $row['deal_id']);
            }
            //删除禁用商户的产品以及同款商品
            $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and deal_id in (" . implode(",", $ids) . ")");
            return;
        }
    }
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:61,代码来源:cart.php

示例9: get_gopreview

function get_gopreview()
{
    $gopreview = es_session::get("gopreview");
    if (!isset($gopreview) || $gopreview == "") {
        $has_cart = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "'"));
        if ($has_cart > 0) {
            $gopreview = url("index", "cart");
        } else {
            $gopreview = es_session::get('before_login') ? es_session::get('before_login') : url("index");
        }
    }
    es_session::delete("before_login");
    es_session::delete("gopreview");
    return $gopreview;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:15,代码来源:common.php

示例10: callback

 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);
     $arr = array();
     $arr = json_decode($response, true);
     $msg['field'] = 'qq_id';
     $msg['id'] = $openid;
     $msg['name'] = $arr["nickname"];
     es_session::set("api_user_info", $msg);
     $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where qq_id = '" . $openid . "' and qq_id <> '' and is_effect=1 and is_delete=0");
     if ($user_data) {
         $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
         $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
         if ($user_current_group['score'] < $user_group['score']) {
             $user_data['group_id'] = intval($user_group['id']);
         }
         es_session::set("user_info", $user_data);
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'");
         es_session::delete("api_user_info");
         app_recirect_preview();
     } else {
         $this->create_user();
         app_redirect(APP_ROOT . "/");
     }
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:34,代码来源:Qqv2_api.php

示例11: loginout

 public function loginout()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $result = loginout_user();
     if ($result['status']) {
         $s_user_info = es_session::get("user_info");
         //更新购物车
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($s_user_info['id']) . " where session_id = '" . es_session::id() . "'");
         es_cookie::delete("user_name");
         es_cookie::delete("user_pwd");
         $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
         $before_loginout = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index");
         if (trim(app_conf("INTEGRATE_CODE")) == '') {
             app_redirect($before_loginout);
         } else {
             showSuccess($GLOBALS['lang']['LOGINOUT_SUCCESS'], 0, $before_loginout);
         }
     } else {
         app_redirect(url("index"));
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:21,代码来源:userModule.class.php

示例12: addcart

 public function addcart()
 {
     if (empty($_REQUEST['id'])) {
         $res = array('ret' => '102', 'msg' => '参数不得为空');
         ajax_return($res);
     }
     $id = intval($_REQUEST['id']);
     save_debug_log("addcart", 'post:' . json_encode($_POST));
     save_debug_log("addcart", 'get:' . json_encode($_GET));
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id=" . $id);
     $session_id = "app";
     if (!$deal_info) {
         $res = array('ret' => '-1', 'msg' => '该商品不存在');
         ajax_return($res);
     } else {
         $attr_str = '0';
         $verify_code = md5($id . "_" . $attr_str);
         $cart_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cart where session_id='" . $session_id . "' and user_id = " . intval($GLOBALS['user_info']['id']) . " and verify_code = '" . $verify_code . "'");
         $add_number = $number = intval($_REQUEST['number']) <= 0 ? 1 : intval($_REQUEST['number']);
         //开始运算购物车的验证
         if ($cart_item) {
             $check = check_deal_time($cart_item['deal_id']);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => "商品:" . $check['info'] . "不在可购买时间内");
                 ajax_return($res);
             }
             $check = check_user_bought_day($cart_item['deal_id'], $add_number, $session_id);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => $check['info']);
                 ajax_return($res);
             }
             $check = check_deal_number($cart_item['deal_id'], $add_number);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => "商品:" . $check['info'] . "库存不足");
                 ajax_return($res);
             }
         } else {
             $check = check_deal_time($cart_item['deal_id']);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => "商品:" . $check['info'] . "不在可购买时间内");
                 ajax_return($res);
             }
             $check = check_user_bought_day($deal_info['id'], $add_number);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => $check['info']);
                 ajax_return($res);
             }
             $check = check_deal_number($deal_info['id'], $add_number);
             if ($check['status'] == 0) {
                 $res = array('ret' => '-1', 'msg' => "商品:" . $check['info'] . "库存不足");
                 ajax_return($res);
             }
         }
         if ($deal_info['return_score'] < 0) {
             //需要积分兑换
             $user_score = intval($GLOBALS['db']->getOne("select score from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])));
             if ($user_score < abs(intval($deal_info['return_score']) * $add_number)) {
                 $res['err'] = 1;
                 $res['open_win'] = 1;
                 $res['html'] = $check['info'] . " " . $GLOBALS['lang']['NOT_ENOUGH_SCORE'];
                 $res['number'] = $GLOBALS['db']->getOne("select sum(number) from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']));
                 ajax_return($res);
             }
         }
         //验证over
         if (!$cart_item) {
             $attr_price = $GLOBALS['db']->getOne("select sum(price) from " . DB_PREFIX . "deal_attr where id in({$attr_str})");
             $cart_item['session_id'] = $session_id;
             $cart_item['user_id'] = intval($GLOBALS['user_info']['id']);
             $cart_item['deal_id'] = $id;
             //属性
             if ($attr_name != '') {
                 $cart_item['name'] = $deal_info['name'] . " [" . $attr_name . "]";
                 $cart_item['sub_name'] = $deal_info['sub_name'] . " [" . $attr_name . "]";
             } else {
                 $cart_item['name'] = $deal_info['name'];
                 $cart_item['sub_name'] = $deal_info['sub_name'];
             }
             $cart_item['name'] = addslashes($cart_item['name']);
             $cart_item['sub_name'] = addslashes($cart_item['sub_name']);
             $cart_item['attr'] = $attr_str;
             $cart_item['unit_price'] = $deal_info['current_price'] + $attr_price;
             $cart_item['number'] = $number;
             $cart_item['total_price'] = $cart_item['unit_price'] * $cart_item['number'];
             $cart_item['verify_code'] = $verify_code;
             $cart_item['create_time'] = get_gmtime();
             $cart_item['update_time'] = get_gmtime();
             $cart_item['return_score'] = $deal_info['return_score'];
             $cart_item['return_total_score'] = $deal_info['return_score'] * $cart_item['number'];
             $cart_item['return_money'] = $deal_info['return_money'];
             $cart_item['return_total_money'] = $deal_info['return_money'] * $cart_item['number'];
             $cart_item['buy_type'] = $deal_info['buy_type'];
             $cart_item['supplier_id'] = $deal_info['supplier_id'];
             $cart_item['attr_str'] = $attr_name_str;
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_cart", $cart_item);
         } else {
             if ($number > 0) {
                 $cart_item['number'] += $number;
                 $cart_item['total_price'] = $cart_item['unit_price'] * $cart_item['number'];
                 $cart_item['return_total_score'] = $deal_info['return_score'] * $cart_item['number'];
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:appcartModule.class.php

示例13: strtolower

$class = strtolower(strim($request['act']));
$act2 = strtolower(strim($request['act_2'])) ? strtolower(strim($request['act_2'])) : "";
define('ACT', $class);
//act常量
define('ACT_2', $act2);
if (true) {
    $url = get_domain() . APP_ROOT . "/" . APP_INDEX . "/index.php?requestData=" . $_REQUEST['requestData'] . "&r_type=2";
    $api_log = array();
    $api_log['api'] = $url;
    $api_log['act'] = $class;
    $api_log['parms'] = print_r($request, true);
    $GLOBALS['db']->autoExecute(DB_PREFIX . "api_log", $api_log, 'INSERT');
}
$sessid = $request['session_id'];
if (empty($sessid)) {
    $session_id = es_session::id();
    $request['session_id'] = $sessid;
}
es_session::set_sessid($sessid);
require_once APP_ROOT_PATH . "system/model/user.php";
$city_id = intval($request['city_id']);
if ($city_id > 0) {
    $_GET['city'] = $city_id;
}
require_once APP_ROOT_PATH . "system/model/city.php";
$GLOBALS['city'] = City::locate_city();
$GLOBALS['user_info'] = es_session::get("user_info");
if (empty($GLOBALS['user_info']) && $class != 'login') {
    $cookie_uname = strim($request['email']);
    //用户名或邮箱
    $cookie_upwd = strim($request['pwd']);
开发者ID:macall,项目名称:jishida,代码行数:31,代码来源:index.php

示例14: set_view_history

function set_view_history($type, $id)
{
    load_auto_cache("cache_history", array("type" => $type, "rel_id" => $id, "session_id" => es_session::id(), "uid" => $GLOBALS['user_info']['id'], "city_id" => $GLOBALS['city']['id']));
}
开发者ID:macall,项目名称:jsd,代码行数:4,代码来源:main_lib.php

示例15: index

 public function index()
 {
     //		$email = strim($GLOBALS['request']['email']);//用户名或邮箱
     //		$pwd = strim($GLOBALS['request']['pwd']);//密码
     //
     //		//检查用户,用户密码
     //		$user = user_check($email,$pwd);
     //		$user_id  = intval($user['id']);
     //
     //		$cartdata = $GLOBALS['request']['cartdata'];
     //		$res = insertCartData($user_id,session_id(),$cartdata);
     //
     //		$root = array();
     //		if($res['info']=='')
     //		{
     //			$root['return'] = 1;
     //			$root['info'] = "提交成功";
     //		}
     //		else
     //		{
     //			$root['return'] = 0;
     //			$root['info'] = $res['info'];
     //		}
     $root = array();
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['is_binding'] = 0;
     $root['user_id'] = $user_id;
     $root['mobile'] = $root['mobile'];
     if ($user_id > 0) {
         $isMobile = preg_match("/^(13\\d{9}|14\\d{9}|18\\d{9}|15\\d{9})|(0\\d{9}|9\\d{8})\$/", $user['mobile']);
         if ($isMobile) {
             $root['is_binding'] = 1;
             $root['mobile'] = $user['mobile'];
         }
     }
     //下单时需要绑定手机号码
     $root['order_has_bind_mobile'] = intval($GLOBALS['m_config']['order_has_bind_mobile']);
     if ($GLOBALS['request']['from'] == 'wap') {
         $cartdata = unserialize(base64_decode($GLOBALS['request']['cartdata']));
         //print_r($cartdata);die;
         //删除购物车中其他商品,开始
         $session_cart_data = es_session::get("cart_data");
         foreach ($session_cart_data as $k => $v) {
             if ($v['goods_id'] != $GLOBALS['request']['id']) {
                 unset($session_cart_data[$k]);
                 es_session::set("cart_data", $session_cart_data);
             }
         }
         foreach ($cartdata as $k => $v) {
             if ($GLOBALS['request']['id'] != $v['goods_id']) {
                 unset($cartdata[$k]);
             }
         }
         //删除购物车中其他商品,结束
         //file_put_contents(APP_ROOT_PATH."tmapi/log/postcart1".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($cartdata,true));
         $res = insertCartData($user_id, es_session::id(), $cartdata);
         //file_put_contents(APP_ROOT_PATH."tmapi/log/postcart2".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($res,true));
         $cart_info = $res['data'];
         foreach ($cart_info as $k => $v) {
             //查询数据库,获取商品信息
             $deal = $GLOBALS['db']->getRow("select img,max_bought,buy_count from " . DB_PREFIX . "deal where id=" . $v['deal_id']);
             $left_num = $GLOBALS['request']['left_number'];
             $cart_info[$k]['id'] = $v['id'];
             $cart_info[$k]['current_price_format'] = format_price($v['unit_price']);
             $cart_info[$k]['img'] = get_abs_img_root($deal['img']);
             $cart_info[$k]['current_price'] = round($v['unit_price'], 2);
             if (isset($left_num)) {
                 $cart_info[$k]['stock'] = intval($deal['max_bought']) - intval($deal['buy_count']);
             } else {
                 $cart_info[$k]['stock'] = $left_num;
             }
         }
         $root['postcart_info'] = $cart_info;
         //统计所有的价格
         $root['cartinfo'] = $GLOBALS['m_config']['yh'];
         //$root['f_link_data']=get_link_list();
         //$root['email']=$email;
         //$root['city_name']=$city_name;
         $root['page_title'] = '提交订单';
     } else {
         $root['cartinfo'] = $GLOBALS['m_config']['yh'];
     }
     $root['nowtime'] = date("Y-m-d H:i", time() + 36400);
     output($root);
 }
开发者ID:macall,项目名称:jishida,代码行数:87,代码来源:postcart.action.php


注:本文中的es_session::id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。