function action_pay() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_clips.php'; include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; // 变量初始化 $surplus_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $payment_id = isset($_GET['pid']) ? intval($_GET['pid']) : 0; if ($surplus_id == 0) { ecs_header("Location: user.php?act=account_log\n"); exit; } // 如果原来的支付方式已禁用或者已删除, 重新选择支付方式 if ($payment_id == 0) { ecs_header("Location: user.php?act=account_deposit&id=" . $surplus_id . "\n"); exit; } // 获取单条会员帐目信息 $order = array(); $order = get_surplus_info($surplus_id); // 支付方式的信息 $payment_info = array(); $payment_info = payment_info($payment_id); /* 如果当前支付方式没有被禁用,进行支付的操作 */ if (!empty($payment_info)) { // 取得支付信息,生成支付代码 $payment = unserialize_config($payment_info['pay_config']); // 生成伪订单号 $order['order_sn'] = $surplus_id; // 获取需要支付的log_id $order['log_id'] = get_paylog_id($surplus_id, $pay_type = PAY_SURPLUS); $order['user_name'] = $_SESSION['user_name']; $order['surplus_amount'] = $order['amount']; // 计算支付手续费用 $payment_info['pay_fee'] = pay_fee($payment_id, $order['surplus_amount'], 0); // 计算此次预付款需要支付的总金额 $order['order_amount'] = $order['surplus_amount'] + $payment_info['pay_fee']; // 如果支付费用改变了,也要相应的更改pay_log表的order_amount $order_amount = $db->getOne("SELECT order_amount FROM " . $ecs->table('pay_log') . " WHERE log_id = '{$order['log_id']}'"); if ($order_amount != $order['order_amount']) { $db->query("UPDATE " . $ecs->table('pay_log') . " SET order_amount = '{$order['order_amount']}' WHERE log_id = '{$order['log_id']}'"); } /* 调用相应的支付方式文件 */ include_once ROOT_PATH . 'includes/modules/payment/' . $payment_info['pay_code'] . '.php'; /* 取得在线支付方式的支付按钮 */ $pay_obj = new $payment_info['pay_code'](); $payment_info['pay_button'] = $pay_obj->get_code($order, $payment); /* 模板赋值 */ $smarty->assign('payment', $payment_info); $smarty->assign('order', $order); $smarty->assign('pay_fee', price_format($payment_info['pay_fee'], false)); $smarty->assign('amount', price_format($order['surplus_amount'], false)); $smarty->assign('action', 'act_account'); $smarty->display('user_transaction.dwt'); } else { include_once ROOT_PATH . 'includes/lib_clips.php'; $smarty->assign('payment', get_online_payment_list()); $smarty->assign('order', $order); $smarty->assign('action', 'account_deposit'); $smarty->display('user_transaction.dwt'); } }
include_once ROOT_PATH . 'includes/lib_order.php'; //变量初始化 $surplus_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $payment_id = isset($_GET['pid']) ? intval($_GET['pid']) : 0; if ($surplus_id == 0) { ecs_header("Location: user.php?act=account_log\n"); exit; } //如果原来的支付方式已禁用或者已删除, 重新选择支付方式 if ($payment_id == 0) { ecs_header("Location: user.php?act=account_deposit&id=" . $surplus_id . "\n"); exit; } //获取单条会员帐目信息 $order = array(); $order = get_surplus_info($surplus_id); //支付方式的信息 $payment_info = array(); $payment_info = payment_info($payment_id); /* 如果当前支付方式没有被禁用,进行支付的操作 */ if (!empty($payment_info)) { //取得支付信息,生成支付代码 $payment = unserialize_config($payment_info['pay_config']); //生成伪订单号 $order['order_sn'] = $surplus_id; //获取需要支付的log_id $order['log_id'] = get_paylog_id($surplus_id, $pay_type = PAY_SURPLUS); $order['user_name'] = $_SESSION['user_name']; $order['surplus_amount'] = $order['amount']; //计算支付手续费用 $payment_info['pay_fee'] = pay_fee($payment_id, $order['surplus_amount'], 0);
$smarty->assign('order', $order); $smarty->assign('pay_fee', price_format($payment_info['pay_fee'], false)); $smarty->assign('amount', price_format($order['surplus_amount'], false)); $smarty->assign('act', 'act_account'); $smarty->display('account.dwt'); } else { include_once ROOT_PATH . 'includes/lib_clips.php'; $smarty->assign('payment', get_online_payment_list()); $smarty->assign('order', $order); $smarty->assign('act', 'account_deposit'); $smarty->display('account.dwt'); } } elseif ($act == 'account_deposit') { include_once ROOT_PATH . 'includes/lib_clips.php'; $surplus_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $account = get_surplus_info($surplus_id); //获取剩余余额 $surplus_amount = get_user_surplus($user_id); if (empty($surplus_amount)) { $surplus_amount = 0; } $smarty->assign('surplus_amount', price_format($surplus_amount, false)); $smarty->assign('payment', get_online_payment_list(false)); $smarty->assign('order', $account); $smarty->assign('act', 'account_deposit'); $smarty->display('account.dwt'); } elseif ($act == 'act_account') { include_once ROOT_PATH . 'includes/lib_clips.php'; include_once ROOT_PATH . 'includes/lib_order.php'; $amount = isset($_POST['amount']) ? floatval($_POST['amount']) : 0; if ($amount <= 0) {