Exemplo n.º 1
0
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');
    }
}
Exemplo n.º 2
0
        }
        /* 调用相应的支付方式文件 */
        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');
    }
} elseif ($action == 'add_tag') {
    include_once 'includes/cls_json.php';
    include_once 'includes/lib_clips.php';
    $result = array('error' => 0, 'message' => '', 'content' => '');
    $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
    $tag = isset($_POST['tag']) ? json_str_iconv(trim($_POST['tag'])) : '';
    if ($user_id == 0) {
        /* 用户没有登录 */
        $result['error'] = 1;
        $result['message'] = $_LANG['tag_anonymous'];
    } else {
Exemplo n.º 3
0
 /**
  * 余额充值
  */
 public function deposit()
 {
     $memberinfo = $this->memberinfo;
     $payment = get_online_payment_list();
     $show_validator = 1;
     include template('member', 'deposit');
 }