function add_order($orderInfo) { $orderInfo = GetDefaultOrderInfo($orderInfo); $dbh = new PDOConnection(); $order_id = AddOrderFromInfo($dbh, $orderInfo); if (isset($orderInfo['lines'])) { add_order_detail($dbh, $order_id, $orderInfo['lines']); } //return all order data to display on the order confirmation page $orderConf = get_order_detail(array('details' => 1, 'order_id' => $order_id)); return $orderConf; }
$response['order_status'] = 4; } $business_account = $cart['business_account']; $order_sn = add_order($cart['total_integral'], $cart['total_product_amount'], $cart['total_delivery_fee'], $cart['delivery_id'], $business_account, $cart['total_integral_given'], $payment_id, $address_id, $cart['total_reward'], $_SESSION['account'], $cart['integral_paid'], $cart['reward_paid'], $cart['balance_paid'], $status, 0, $cart['remark']); if ($order_sn) { if ($status == 4) { $order_data = array('pay_time' => time()); $db->autoUpdate('order', $order_data, '`order_sn`=\'' . $order_sn . '\''); add_order_log($order_sn, $_SESSION['account'], 4, "使用余额/佣金/积分支付"); } if ($cart['balance_paid'] || $cart['reward_paid'] || $cart['integral_paid']) { add_memeber_exchange_log($_SESSION['account'], -1 * $cart['balance_paid'], -1 * $cart['reward_paid'], -1 * $cart['integral_paid'], 0, 0, $_SESSION['account'], "抵扣订单金额"); } $flag = true; foreach ($cart['products'] as $od) { if (!add_order_detail($od['product_sn'], $od['product_name'], $od['product_attributes'], $od['attributes'], $od['product_price'], $od['integral'], $od['integral_given'], $od['reward'], $od['count'], $business_account, $order_sn, $od['is_virtual'])) { $flag = false; } else { if ($status == 4) { //扣减库存 consume_inventory($od['product_sn'], $od['attributes'], $od['count']); if ($od['is_virtual']) { //如果是虚拟产品,则生成预约券 $get_virtual_contents = 'select `content`,`count`,`total` from ' . $db->table('virtual_content') . ' where `product_sn`=\'' . $od['product_sn'] . '\''; $virtual_contents = $db->fetchAll($get_virtual_contents); $virtual_content = ''; if ($virtual_contents) { $virtual_content = serialize($virtual_contents); } add_order_content($cart['business_account'], $_SESSION['account'], $address_info['mobile'], $order_sn, $od['product_sn'], $od['product_name'], $virtual_content, 2); }