Пример #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');
    }
}
Пример #2
0
     }
 } 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);
     /* 调用相应的支付方式文件 */
Пример #3
0
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'act_account') {
    include_once ROOT_PATH . 'includes/lib_clips.php';
    include_once ROOT_PATH . 'includes/lib_order.php';
    $amount = isset($_REQUEST['surplus_amount']) ? floatval($_REQUEST['surplus_amount']) : 0;
    $user_id = intval($_REQUEST['user_id']);
    $res['req_msg'] = true;
    $res['timeout'] = 2000;
    if ($amount <= 0) {
        $res['message'] = '添加失败';
        die($json->encode($res));
    }
    $surplus = array('user_id' => $user_id, 'rec_id' => !empty($_REQUEST['rec_id']) ? intval($_REQUEST['rec_id']) : 0, 'process_type' => isset($_REQUEST['surplus_type']) ? intval($_REQUEST['surplus_type']) : 0, 'payment' => isset($_REQUEST['payment_id']) ? intval($_REQUEST['payment_id']) : 0, 'user_note' => isset($_REQUEST['user_note']) ? trim($_REQUEST['user_note']) : '', 'amount' => $amount);
    //充值
    if ($process_type == 0) {
        $res['insert_id'] = insert_user_account($surplus, $amount);
        if ($res['insert_id']) {
            $sql_update = 'UPDATE ' . $GLOBALS['ecs']->table('user_account') . " SET admin_user='******'admin_name']}'";
            $GLOBALS['db']->query($sql_update);
            $res['message'] = '添加成功';
        } else {
            $res['message'] = '添加失败';
        }
    }
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'del_user_inte') {
    $res = array();
    $res['row_id'] = intval($_REQUEST['row_id']);
    $user_inte_id = intval($_REQUEST['user_inte_id']);
    $res['req_msg'] = true;
    $res['timeout'] = 2000;