protected function _orderleft($smarty) { //全部订单链接 $all_url = url('admin', 'adminorder::all'); $smarty->assign("all_url", $all_url); //无效链接 $unorder_url = url('admin', 'adminorder::unorder'); $smarty->assign('unorder_url', $unorder_url); //未确认链接 $unconfirm_url = url('admin', 'adminorder::unconfirm'); $smarty->assign('unconfirm_url', $unconfirm_url); //已确认链接 $confirm_url = url('admin', 'adminorder::confirm'); $smarty->assign('confirm_url', $confirm_url); //配货中链接 $ready_url = url('admin', 'adminorder::ready'); $smarty->assign('ready_url', $ready_url); //已发货链接 $shipping_url = url('admin', 'adminorder::shipping'); $smarty->assign('shipping_url', $shipping_url); //已收货链接 $receive_url = url('admin', 'adminorder::receive'); $smarty->assign('receive_url', $receive_url); //用户名 $username = LuS::get('admin_order_username'); $smarty->assign('username', $username); //退出登录 $admin_outlogin_url = url('admin', 'adminorder::outlogin'); $smarty->assign('admin_outlogin_url', $admin_outlogin_url); }
public function prompt() { $smarty = get_smarty(); $smarty->assign('url', LuS::get('email_save_url')); $smarty->assign("msg", LuS::get('email_save_msg')); $smarty->display('login/password_prompt.html'); }
public function show() { $smarty = get_smarty(); $smarty->assign('url', LuS::get('email_save_url')); $smarty->assign("show", LuS::get('email_save_msg')); $smarty->display('myweb/findpassword/password_prompt.html'); }
public function _login() { if (!LuS::get('admin_order_uid')) { $login_url = url('admin', 'adminorder::login'); header('Location:' . $login_url); throw new Exception('exit'); } }
public function _login() { if (!LuS::get('admin_goods_uid')) { $url = url('admin', 'admingoods::login'); header('Location:' . $url); throw new Exception('exit'); } }
public function __construct() { $uid = LuS::get('admin_goods_uid'); if (!$uid) { $url = url('admin', 'admingoods::login'); header('Location:' . $url); throw new Exception('exit'); } }
public function _show($smarty) { $uid = LuS::get('uid'); if ($uid) { $is_login = true; } else { $is_login = false; } $smarty->assign('is_login', $is_login); //首页 $home_url = HOMEURL; $smarty->assign('home_url', $home_url); //登录 $login_url = url('login', 'login::index'); $smarty->assign('login_url', $login_url); //注册 $reg_url = url('reg', 'reg::index'); $smarty->assign('reg_url', $reg_url); //退出登录 $outlogin_url = url('home', 'home::outlogin'); $smarty->assign('outlogin_url', $outlogin_url); //个人中心 $usercenter_url = url('usercenter', 'usercenter::index'); $smarty->assign('usercenter_url', $usercenter_url); $my_order_url = url('usercenter', 'usercenter::orderlist'); $smarty->assign('my_order_url', $my_order_url); //用户名 $username = LuS::get('username'); $smarty->assign('username', $username); //购物车数量 $cart_num = Cart::getCount($uid); $smarty->assign('cart_num', $cart_num); //购物车 $cart_url = url('goods', 'goods::cart'); $smarty->assign('cart_url', $cart_url); }
public function login() { var_dump(LuS::get()); }
protected function getaddrdata() { $msg = array(); //名字 $data['consignee'] = empty($_POST['consignee']) ? '' : htmlspecialchars(trim($_POST['consignee'])); if (!$data['consignee']) { // $msg = '请输入姓名!\r\n'; $msg['error'] = '-1'; $msg['msg'] = '请输入姓名!'; echo json_encode($msg); throw new Exception('exit'); } //手机 $data['mobile'] = empty($_POST['mobile']) ? 0 : htmlspecialchars(trim($_POST['mobile'])); if ($data['mobile']) { $exp = "/^1\\d{10}\$/"; if (!preg_match($exp, $data['mobile'])) { // $msg .= '输入的手机格式错误!\r\n'; $msg['error'] = '-2'; $msg['msg'] = '输入的手机格式错误!'; echo json_encode($msg); throw new Exception('exit'); } } else { // $msg .= '请输入手机号码!\r\n'; $msg['error'] = '-3'; $msg['msg'] = '请输入手机号码!'; echo json_encode($msg); throw new Exception('exit'); } //电话 $tel_area = empty($_POST['tel_area']) ? '' : htmlspecialchars(trim($_POST['tel_area'])); $data['tel'] = empty($_POST['tel']) ? '' : htmlspecialchars(trim($_POST['tel'])); if ($data['tel']) { //填写了区号 if ($tel_area) { $data['tel'] = $tel_area . $data['tel']; } $exp = '/^(0?(([1-9]\\d)|([3-9]\\d{2}))-?)?\\d{7,8}$/'; if (!preg_match($exp, $data['tel'])) { // $msg .= '输入的固定电话错误!\r\n'; $msg['error'] = '-4'; $msg['msg'] = '输入的固定电话错误!'; echo json_encode($msg); throw new Exception('exit'); } } //省份 $data['province'] = empty($_POST['province']) ? 0 : htmlspecialchars(trim($_POST['province'])); if (!$data['province']) { // $msg .= '省不能为空!\r\n'; // $msg['error'] = '-5'; // $msg['msg'] = '省不能为空!'; // echo json_encode( $msg ); // throw new Exception('exit'); } // Assert::num_gt_zero($data['province'], '省份不能为空'); //城市 $data['city'] = empty($_POST['city']) ? 0 : htmlspecialchars(trim($_POST['city'])); if (!$data['city']) { // $msg .= '市不能为空!\r\n'; // $msg['error'] = '-6'; // $msg['msg'] = '市不能为空!'; // echo json_encode( $msg ); // throw new Exception('exit'); } // Assert::num_gt_zero($data['city'], '城市不能为空'); //地区 $data['district'] = empty($_POST['district']) ? 0 : htmlspecialchars(trim($_POST['district'])); // if( !$data['district'] ){ // // $msg .= '区不能为空!\r\n'; // $msg['error'] = '-7'; // $msg['msg'] = '区不能为空!'; // echo json_encode( $msg ); // throw new Exception('exit'); // } // Assert::num_gt_zero($data['district'], '区县不能为空'); //详细地址 $data['address'] = empty($_POST['address']) ? '' : htmlspecialchars(trim($_POST['address'])); if (!$data['address']) { // $msg .= '请输入详细地址!\r\n'; $msg['error'] = '-8'; $msg['msg'] = '请输入详细地址!'; echo json_encode($msg); throw new Exception('exit'); } //是否默认地址 $data['is_default'] = isset($_POST['is_default']) && !empty($_POST['is_default']) ? "yes" : 'no'; //用户id $data['uid'] = User::getLoginUid(); //如果有跳转地址,用户下单的时候添加地址,默认设置为默认地址 $addr_jump_url = LuS::get('addr_jump_url'); if (isset($addr_jump_url) && !empty($addr_jump_url)) { UserAddress::setDefaultAddressToNull($data['uid']); //去掉默认地址 $data['is_default'] = 'yes'; //设置当前为默认地址 } if ($msg) { // echo "$msg"; $msg['error'] = '-9'; $msg['msg'] = $msg; echo json_encode($msg); throw new Exception('exit'); } return $data; }
public static function modify($uid) { //没有登录 $data['uid'] = $uid; if (!$data['uid']) { return false; } //从购物车取出没有对应用户的商品 $sid_where['sid'] = session_id(); $sid_where['uid'] = '0'; $sid_cart_goods_info = self::_list($sid_where); if (!$sid_cart_goods_info) { return false; } //检查用户是否已经存在商品,如果存在添加数量,并删除该条没有对应用户的数据 foreach ($sid_cart_goods_info as $key => $value) { $goods_id = $value['goods_id']; $rs = Cart::getCartGoodsInfoByGoodsId($uid, $goods_id); if ($rs) { $add_data['goods_id'] = $goods_id; $add_data['goods_num'] = $value['goods_num']; Cart::add($uid, $add_data); //删除没有登录情况下的购物车商品 $del_where['sid'] = session_id(); $del_where['uid'] = '0'; $del_where['goods_id'] = $goods_id; Cart::delete($del_where); } } $data['username'] = LuS::get('username'); $where['sid'] = session_id(); $where['uid'] = '0'; return Cart::update($data, $where); }
public function addtoorder() { //是否已经登录 User::isLogin(); if (!$_POST) { $url = url('goods', 'goods::balance'); header('Location:' . $url); throw new Exception('exit'); } $default_address_id = isset($_POST['shipping']) ? htmlspecialchars($_POST['shipping']) : 0; $payment = isset($_POST['payment']) ? htmlspecialchars($_POST['payment']) : ''; $is_mobile = isset($_POST['mobile']) ? htmlspecialchars($_POST['mobile']) : ''; $uid = LuS::get('uid'); $username = LuS::get('username'); $order_id = Cart::addOrder($uid, $username, $payment, $default_address_id); //订单详情页 $order_detail_url = url('usercenter', 'usercenter::detail', $order_id); //首页 $home_url = HOMEURL; //订单号 $order_info = OrderInfo::getUserOrderInfoByOrderId($uid, $order_id); //获取支付链接 $pay = GoodsM::getPayList($order_info['sn']); //货到付款 $hdfkpay_url = $order_detail_url; $smarty = get_smarty(); $smarty->assign('order_detail_url', $order_detail_url); $smarty->assign('home_url', $home_url); $str = $smarty->fetch('goods/order_success.html'); //增加一个订单id $return_arr = array(true, $str, $pay['alipay'], $pay['wxpay'], $pay['wxsaomapay'], $hdfkpay_url, $order_id); echo json_encode($return_arr); throw new Exception('exit'); }
public static function getUserInfo() { $getUserInfo = "https://graph.qq.com/user/get_user_info?" . "access_token=" . LuS::get('access_token') . "&oauth_consumer_key=" . LuS::get("appid") . "&openid=" . LuS::get("openid") . "&format=json"; $info = file_get_contents($getUserInfo); $arr = json_decode($info, true); return $arr; }
public static function getUserLoginJumpUrl() { //跳回点击登录页面 $last_url = LuS::get('last_url'); if (isset($last_url) && $last_url) { $url = $last_url; LuS::del('last_url'); } else { $url = HOMEURL; } return $url; }