} /* 检查订单用户跟当前用户是否一致 */ if ($_SESSION['user_id'] != $order['user_id']) { ecs_header("Location: ./\n"); exit; } /* 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变*/ if ($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id) { ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n"); exit; } if ($pay_id != 2) { //dump($pay_id); include_once 'includes/modules/payment/payment.php'; $pay_obj = new payment(); $pay_obj->pay_set($order['order_id'], $pay_id, $order['goods_amount']); } elseif ($pay_id == 2) { $db->query("update " . $ecs->table('order_info') . " set pay_name = '货到付款',pay_num = {$pay_id} where order_id = {$order['order_id']}"); } ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n"); exit; } elseif ($action == 'save_order_address') { include_once ROOT_PATH . 'includes/lib_transaction.php'; $address = array('consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '', 'tel' => isset($_POST['tel']) ? compile_str(trim($_POST['tel'])) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(trim($_POST['mobile'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0); if (save_order_address($address, $user_id)) { ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n"); exit; } else { $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list'); } } elseif ($action == 'bonus') {
/*if ($payment['is_cod'] == 1) { $order = order_info($order_id); $region_id_list = array( $order['country'], $order['province'], $order['city'], $order['district'] ); $shipping = shipping_area_info($order['shipping_id'], $region_id_list); $pay_fee = pay_fee($pay_id, $order_amount, $shipping['pay_fee']); } else { $pay_fee = pay_fee($pay_id, $order_amount); }*/ include_once '../includes/modules/payment/payment.php'; $pay_obj = new payment(); $order['pay_num'] = $pay_obj->pay_set($order_id, $pay_id, $order_amount); /* 保存订单 */ /* $order = array( 'pay_id' => $pay_id, 'pay_name' => addslashes($payment['pay_name']), 'pay_fee' => $pay_fee ); update_order($order_id, $order);*/ update_order_amount($order_id); /* 更新 pay_log */ update_pay_log($order_id); /* todo 记录日志 */ $sn = $old_order['order_sn']; $new_order = order_info($order_id); if ($old_order['total_fee'] != $new_order['total_fee']) { $sn .= ',' . sprintf($_LANG['order_amount_change'], $old_order['total_fee'], $new_order['total_fee']);
include_once('includes/modules/payment/' . $payment['pay_code'] . '.php'); $pay_obj = new $payment['pay_code']; $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config'])); $order['pay_desc'] = $payment['pay_desc']; $smarty->assign('pay_online', $pay_online); } */ if ($order['order_amount'] > 0) { if ($order['pay_num'] != 2) { include_once 'includes/modules/payment/payment.php'; $pay_obj = new payment(); $order['pay_num'] = $pay_obj->pay_set($order['order_id'], $order['pay_num'], $order['goods_amount']); $pay_online = $pay_obj->get_code($order); $smarty->assign('pay_online', $pay_online); } } elseif ($order['order_amount'] <= 0 && $order['pay_num'] == 1) { $sign_message = 'order_id=' . $order['order_id'] . '&payprice=' . $order['order_amount'] . '&email=0&user_id=' . $order['user_id'] . '&datetime=' . gmtime() . '&ip_addr=' . real_ip(); $key_value = 'untx'; $sign_message_md = md5($sign_message . $key_value); $smarty->assign('sign_message', $sign_message); // 地址栏相关参数链接 $smarty->assign('sign_message_md', $sign_message_md); // 地址栏md5加密之后传递的参数 $smarty->assign('lucky_draw', 1); } /* ccx 2014-12-14 判断如果是货到付款的情况,也有抽奖机会 结束*/ /*end*/