Beispiel #1
0
function action_act_account()
{
    $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_order.php';
    $amount = isset($_POST['amount']) ? floatval($_POST['amount']) : 0;
    if ($amount <= 0) {
        show_message($_LANG['amount_gt_zero']);
    }
    /* 变量初始化 */
    $surplus = array('user_id' => $user_id, 'rec_id' => !empty($_POST['rec_id']) ? intval($_POST['rec_id']) : 0, 'process_type' => isset($_POST['surplus_type']) ? intval($_POST['surplus_type']) : 0, 'payment_id' => isset($_POST['payment_id']) ? intval($_POST['payment_id']) : 0, 'user_note' => isset($_POST['user_note']) ? trim($_POST['user_note']) : '', 'amount' => $amount);
    /* 退款申请的处理 */
    if ($surplus['process_type'] == 1) {
        /* 判断是否有足够的余额的进行退款的操作 */
        $sur_amount = get_user_surplus($user_id);
        if ($amount > $sur_amount) {
            $content = $_LANG['surplus_amount_error'];
            show_message($content, $_LANG['back_page_up'], '', 'info');
        }
        // 插入会员账目明细
        $amount = '-' . $amount;
        $surplus['payment'] = '';
        $surplus['rec_id'] = insert_user_account($surplus, $amount);
        /* 如果成功提交 */
        if ($surplus['rec_id'] > 0) {
            $content = $_LANG['surplus_appl_submit'];
            show_message($content, $_LANG['back_account_log'], 'user.php?act=account_log', 'info');
        } else {
            $content = $_LANG['process_false'];
            show_message($content, $_LANG['back_page_up'], '', 'info');
        }
    } else {
        if ($surplus['payment_id'] <= 0) {
            show_message($_LANG['select_payment_pls']);
        }
        include_once ROOT_PATH . 'includes/lib_payment.php';
        // 获取支付方式名称
        $payment_info = array();
        $payment_info = payment_info($surplus['payment_id']);
        $surplus['payment'] = $payment_info['pay_name'];
        if ($surplus['rec_id'] > 0) {
            // 更新会员账目明细
            $surplus['rec_id'] = update_user_account($surplus);
        } else {
            // 插入会员账目明细
            $surplus['rec_id'] = insert_user_account($surplus, $amount);
        }
        // 取得支付信息,生成支付代码
        $payment = unserialize_config($payment_info['pay_config']);
        // 生成伪订单号, 不足的时候补0
        $order = array();
        $order['order_sn'] = $surplus['rec_id'];
        $order['user_name'] = $_SESSION['user_name'];
        $order['surplus_amount'] = $amount;
        // 计算支付手续费用
        $payment_info['pay_fee'] = pay_fee($surplus['payment_id'], $order['surplus_amount'], 0);
        // 计算此次预付款需要支付的总金额
        $order['order_amount'] = $amount + $payment_info['pay_fee'];
        // 记录支付log
        $order['log_id'] = insert_pay_log($surplus['rec_id'], $order['order_amount'], $type = PAY_SURPLUS, 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('pay_fee', price_format($payment_info['pay_fee'], false));
        $smarty->assign('amount', price_format($amount, false));
        $smarty->assign('order', $order);
        $smarty->display('user_transaction.dwt');
    }
}
Beispiel #2
0
     } else {
         $content = $_LANG['process_false'];
         show_message($content, $_LANG['back_page_up'], '', 'info');
     }
 } else {
     if ($surplus['payment_id'] <= 0) {
         show_message($_LANG['select_payment_pls']);
     }
     include_once ROOT_PATH . 'includes/lib_payment.php';
     //获取支付方式名称
     $payment_info = array();
     $payment_info = payment_info($surplus['payment_id']);
     $surplus['payment'] = $payment_info['pay_name'];
     if ($surplus['rec_id'] > 0) {
         //更新会员账目明细
         $surplus['rec_id'] = update_user_account($surplus);
     } else {
         //插入会员账目明细
         $surplus['rec_id'] = insert_user_account($surplus, $amount);
     }
     //取得支付信息,生成支付代码
     $payment = unserialize_config($payment_info['pay_config']);
     //生成伪订单号, 不足的时候补0
     $order = array();
     $order['order_sn'] = $surplus['rec_id'];
     $order['user_name'] = $_SESSION['user_name'];
     $order['surplus_amount'] = $amount;
     //计算支付手续费用
     $payment_info['pay_fee'] = pay_fee($surplus['payment_id'], $order['surplus_amount'], 0);
     //计算此次预付款需要支付的总金额
     $order['order_amount'] = $amount + $payment_info['pay_fee'];
Beispiel #3
0
    if ($account['is_paid'] == 0) {
        //如果是退款申请, 并且已完成,更新此条记录,扣除相应的余额
        if ($is_paid == '1' && $account['process_type'] == '1') {
            $user_account = get_user_surplus($account['user_id']);
            $fmt_amount = str_replace('-', '', $amount);
            //如果扣除的余额多于此会员拥有的余额,提示
            if ($fmt_amount > $user_account) {
                $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)');
                sys_msg($_LANG['surplus_amount_error'], 0, $link);
            }
            update_user_account($id, $amount, $admin_note, $is_paid);
            //更新会员余额数量
            log_account_change($account['user_id'], $amount, 0, 0, 0, $_LANG['surplus_type_1'], ACT_DRAWING);
        } elseif ($is_paid == '1' && $account['process_type'] == '0') {
            //如果是预付款,并且已完成, 更新此条记录,增加相应的余额
            update_user_account($id, $amount, $admin_note, $is_paid);
            //更新会员余额数量
            log_account_change($account['user_id'], $amount, 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING);
        } elseif ($is_paid == '0') {
            /* 否则更新信息 */
            $sql = "UPDATE " . $ecs->table('user_account') . " SET " . "admin_user    = '******'admin_name']}', " . "admin_note    = '{$admin_note}', " . "is_paid       = 0 WHERE id = '{$id}'";
            $db->query($sql);
        }
        /* 记录管理员日志 */
        admin_log('(' . addslashes($_LANG['check']) . ')' . $admin_note, 'edit', 'user_surplus');
        /* 提示信息 */
        $link[0]['text'] = $_LANG['back_list'];
        $link[0]['href'] = 'user_account.php?act=list&' . list_link_postfix();
        sys_msg($_LANG['attradd_succed'], 0, $link);
    }
} elseif ($_REQUEST['act'] == 'query') {