$smarty->assign('account_log', $account_log); $smarty->assign('pager', $pager); $smarty->display('user_transaction.dwt'); } elseif ($action == '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) { 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');
$is_paid = isset($_POST['is_paid']) ? intval($_POST['is_paid']) : 0; $admin_note = isset($_POST['admin_note']) ? trim($_POST['admin_note']) : ''; /* 如果参数不合法,返回 */ if ($id == 0 || empty($admin_note)) { ecs_header("Location: user_account.php?act=list\n"); exit; } /* 查询当前的预付款信息 */ $account = array(); $account = $db->getRow("SELECT * FROM " . $ecs->table('user_account') . " WHERE id = '{$id}'"); $amount = $account['amount']; //如果状态为未确认 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') {
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'); } }
$bank_name = $_POST['bank_name']; //开户行 $bank_account = $_POST['bank_account']; //银行账户 $mobile_phone = $_POST['mobile_phone']; //开户行 $user_note = $_POST['user_note']; //留言 $tianxin100 = "真实姓名:【" . $real_name . "】开户行:【" . $bank_name . "】银行账户:【" . $bank_account . "】手机:【" . $mobile_phone . "】留言:【" . $user_note . "】"; /*甜心100分销微分销优化提现流程*/ /* 变量初始化 */ $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' => $tianxin100, 'amount' => $amount); /* 退款申请的处理 */ if ($surplus['process_type'] == 1) { /* 判断是否有足够的余额的进行退款的操作 */ $sur_amount = get_user_surplus($_SESSION['user_id']); //$sql = "SELECT user_money FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '{$user_id}'"; //$sur_amount= $GLOBALS['db']->getOne($sql); if ($amount > $sur_amount) { $content = $_LANG['surplus_amount_error']; show_message($content, $_LANG['back_page_up'], '', 'info'); } $user_yishenqing = $db->getOne("select sum(amount) from " . $ecs->table('user_account') . " where process_type=1 and is_paid=0 and user_id = '{$user_id}' "); $user_yishenqing = $user_yishenqing * -1; $all_amout = $amount + $user_yishenqing; if ($all_amout > $sur_amount) { $content = "申请提醒总金额大于自己的余额"; show_message($content, $_LANG['back_page_up'], '', 'info'); } //插入会员账目明细