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 function detail($order_id) { $order_id = (int) $order_id; $uid = LuS::get('uid'); if (!$order_id || !$uid) { $url = url('usercenter', 'usercenter::index'); header('Location:' . $url); throw new Exception('exit'); } //获取订单信息 $order_info = OrderInfo::getUserOrderInfoByOrderId($uid, $order_id); $smarty = get_smarty(); $smarty->assign('order_info', $order_info); $smarty->display('usercenter/usercenter_order_detail.html'); }
public static function receiveUserOrderByOrderId($uid, $order_id) { if (!$uid || !$order_id) { return false; } //根据order_id获取订单信息 $order_info = OrderInfo::getUserOrderInfoByOrderId($uid, $order_id); if ($order_info && $order_info['receive_status'] == 'no') { $data['receive_status'] = 'yes'; $data['receive_time'] = time(); $where['uid'] = $uid; $where['order_id'] = $order_id; return self::_update($data, $where); } else { return false; } }