当前位置: 首页>>代码示例>>PHP>>正文


PHP pay_fee函数代码示例

本文整理汇总了PHP中pay_fee函数的典型用法代码示例。如果您正苦于以下问题:PHP pay_fee函数的具体用法?PHP pay_fee怎么用?PHP pay_fee使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pay_fee函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ecs_header

    if (empty($order)) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单用户跟当前用户是否一致 */
    if ($_SESSION['user_id'] != $order['user_id']) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变*/
    if ($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id) {
        ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
        exit;
    }
    $order_amount = $order['order_amount'] - $order['pay_fee'];
    $pay_fee = pay_fee($pay_id, $order_amount);
    $order_amount += $pay_fee;
    $sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}'" . " WHERE order_id = '{$order_id}'";
    $db->query($sql);
    /* 跳转 */
    ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
    exit;
} elseif ($action == 'save_order_address') {
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    $address = array('consignee' => isset($_POST['consignee']) ? trim($_POST['consignee']) : '', 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'address' => isset($_POST['address']) ? trim($_POST['address']) : '', 'zipcode' => isset($_POST['zipcode']) ? make_semiangle(trim($_POST['zipcode'])) : '', 'tel' => isset($_POST['tel']) ? trim($_POST['tel']) : '', 'mobile' => isset($_POST['mobile']) ? trim($_POST['mobile']) : '', 'sign_building' => isset($_POST['sign_building']) ? trim($_POST['sign_building']) : '', 'best_time' => isset($_POST['best_time']) ? trim($_POST['best_time']) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0);
    if (save_order_address($address, $user_id)) {
        ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n");
        exit;
    } else {
        $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list');
    }
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:user.php

示例2: edit_payment

 /**
  * 更改支付方式的处理
  */
 public function edit_payment()
 {
     // 检查支付方式
     $pay_id = intval($_POST['pay_id']);
     if ($pay_id <= 0) {
         ecs_header("Location: " . url('index/index') . "\n");
         exit;
     }
     $payment_info = model('Order')->payment_info($pay_id);
     if (empty($payment_info)) {
         ecs_header("Location: " . url('index/index') . "\n");
         exit;
     }
     // 检查订单号
     $order_id = intval($_POST['order_id']);
     if ($order_id <= 0) {
         ecs_header("Location: " . url('index/index') . "\n");
         exit;
     }
     // 取得订单
     $order = model('Order')->order_info($order_id);
     if (empty($order)) {
         ecs_header("Location: " . url('index/index') . "\n");
         exit;
     }
     // 检查订单用户跟当前用户是否一致
     if ($_SESSION['user_id'] != $order['user_id']) {
         ecs_header("Location: " . url('index/index') . "\n");
         exit;
     }
     // 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变
     if ($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id) {
         $url = url('order_detail', array('order_id' => $order_id));
         ecs_header("Location: {$url}\n");
         exit;
     }
     $order_amount = $order['order_amount'] - $order['pay_fee'];
     $pay_fee = pay_fee($pay_id, $order_amount);
     $order_amount += $pay_fee;
     $data['pay_id'] = $pay_id;
     $data['pay_name'] = $payment_info['pay_name'];
     $data['pay_fee'] = $pay_fee;
     $data['order_amount'] = $order_amount;
     $where['order_id'] = $order_id;
     $this->model->table('order_info')->data($data)->where($where)->update();
     // 跳转
     $url = url('order_detail', array('order_id' => $order_id));
     ecs_header("Location: {$url}\n");
     exit;
 }
开发者ID:ChanHarold,项目名称:ecshop,代码行数:53,代码来源:UserController.class.php

示例3: action_act_edit_payment

function action_act_edit_payment()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 检查是否登录 */
    if ($_SESSION['user_id'] <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    $sql = "SELECT pay_id FROM " . $ecs->table('payment') . " WHERE pay_code = '" . $_POST['pay_code'] . "'";
    $row = $db->getRow($sql);
    /* 检查支付方式 */
    $pay_id = $row['pay_id'];
    if ($pay_id <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    include_once ROOT_PATH . 'includes/lib_order.php';
    $payment_info = payment_info($pay_id);
    if (empty($payment_info)) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单号 */
    $order_id = intval($_POST['order_id']);
    if ($order_id <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 取得订单 */
    $order = order_info($order_id);
    if (empty($order)) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单用户跟当前用户是否一致 */
    if ($_SESSION['user_id'] != $order['user_id']) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变 */
    if ($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id) {
        ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
        exit;
    }
    $order_amount = $order['order_amount'] - $order['pay_fee'];
    $pay_fee = pay_fee($pay_id, $order_amount);
    $order_amount += $pay_fee;
    if ($_POST['pay_code'] == 'alipay_bank') {
        $defaultbank = $_POST['www_68ecshop_com_bank'];
        $sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}', defaultbank='{$defaultbank}'" . " WHERE order_id = '{$order_id}'";
    } else {
        $sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}'" . " WHERE order_id = '{$order_id}'";
    }
    $db->query($sql);
    /* 跳转 */
    ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
    exit;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:64,代码来源:user.php

示例4: order_fee

 /**
  * 获得订单中的费用信息
  *
  * @access  public
  * @param   array   $order
  * @param   array   $goods
  * @param   array   $consignee
  * @param   bool    $is_gb_deposit  是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral)
  * @return  array
  */
 function order_fee($order, $goods, $consignee)
 {
     /* 初始化订单的扩展code */
     if (!isset($order['extension_code'])) {
         $order['extension_code'] = '';
     }
     if ($order['extension_code'] == 'group_buy') {
         $group_buy = model('GroupBuyBase')->group_buy_info($order['extension_id']);
     }
     $total = array('real_goods_count' => 0, 'gift_amount' => 0, 'goods_price' => 0, 'market_price' => 0, 'discount' => 0, 'pack_fee' => 0, 'card_fee' => 0, 'shipping_fee' => 0, 'shipping_insure' => 0, 'integral_money' => 0, 'bonus' => 0, 'surplus' => 0, 'cod_fee' => 0, 'pay_fee' => 0, 'tax' => 0);
     $weight = 0;
     /* 商品总价 */
     foreach ($goods as $val) {
         /* 统计实体商品的个数 */
         if ($val['is_real']) {
             $total['real_goods_count']++;
         }
         $total['goods_price'] += $val['goods_price'] * $val['goods_number'];
         $total['market_price'] += $val['market_price'] * $val['goods_number'];
     }
     $total['saving'] = $total['market_price'] - $total['goods_price'];
     $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0;
     $total['goods_price_formated'] = price_format($total['goods_price'], false);
     $total['market_price_formated'] = price_format($total['market_price'], false);
     $total['saving_formated'] = price_format($total['saving'], false);
     /* 折扣 */
     if ($order['extension_code'] != 'group_buy') {
         $discount = model('Order')->compute_discount();
         $total['discount'] = $discount['discount'];
         if ($total['discount'] > $total['goods_price']) {
             $total['discount'] = $total['goods_price'];
         }
     }
     $total['discount_formated'] = price_format($total['discount'], false);
     /* 税额 */
     if (!empty($order['need_inv']) && $order['inv_type'] != '') {
         /* 查税率 */
         $rate = 0;
         $invoice_type = C('invoice_type');
         foreach ($invoice_type['type'] as $key => $type) {
             if ($type == $order['inv_type']) {
                 $rate = floatval($invoice_type['rate'][$key]) / 100;
                 break;
             }
         }
         if ($rate > 0) {
             $total['tax'] = $rate * $total['goods_price'];
         }
     }
     $total['tax_formated'] = price_format($total['tax'], false);
     /* 包装费用 */
     if (!empty($order['pack_id'])) {
         $total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']);
     }
     $total['pack_fee_formated'] = price_format($total['pack_fee'], false);
     /* 贺卡费用 */
     if (!empty($order['card_id'])) {
         $total['card_fee'] = card_fee($order['card_id'], $total['goods_price']);
     }
     $total['card_fee_formated'] = price_format($total['card_fee'], false);
     /* 红包 */
     if (!empty($order['bonus_id'])) {
         $bonus = model('Order')->bonus_info($order['bonus_id']);
         $total['bonus'] = $bonus['type_money'];
     }
     $total['bonus_formated'] = price_format($total['bonus'], false);
     /* 线下红包 */
     if (!empty($order['bonus_kill'])) {
         $bonus = model('Order')->bonus_info(0, $order['bonus_kill']);
         $total['bonus_kill'] = $order['bonus_kill'];
         $total['bonus_kill_formated'] = price_format($total['bonus_kill'], false);
     }
     /* 配送费用 */
     $shipping_cod_fee = NULL;
     if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) {
         $region['country'] = $consignee['country'];
         $region['province'] = $consignee['province'];
         $region['city'] = $consignee['city'];
         $region['district'] = $consignee['district'];
         $shipping_info = model('Shipping')->shipping_area_info($order['shipping_id'], $region);
         if (!empty($shipping_info)) {
             if ($order['extension_code'] == 'group_buy') {
                 $weight_price = model('Order')->cart_weight_price(CART_GROUP_BUY_GOODS);
             } else {
                 $weight_price = model('Order')->cart_weight_price();
             }
             // 查看购物车中是否全为免运费商品,若是则把运费赋为零
             $sql = 'SELECT count(*) as count FROM ' . $this->pre . "cart WHERE  `session_id` = '" . SESS_ID . "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
             $res = $this->row($sql);
             $shipping_count = $res['count'];
//.........这里部分代码省略.........
开发者ID:m7720647,项目名称:demo,代码行数:101,代码来源:UsersModel.class.php

示例5: merge_order

/**
 * 合并订单
 * @param   string  $from_order_sn  从订单号
 * @param   string  $to_order_sn    主订单号
 * @return  成功返回true,失败返回错误信息
 */
function merge_order($from_order_sn, $to_order_sn)
{
    /* 订单号不能为空 */
    if (trim($from_order_sn) == '' || trim($to_order_sn) == '') {
        return $GLOBALS['_LANG']['order_sn_not_null'];
    }
    /* 订单号不能相同 */
    if ($from_order_sn == $to_order_sn) {
        return $GLOBALS['_LANG']['two_order_sn_same'];
    }
    /* 取得订单信息 */
    $from_order = order_info(0, $from_order_sn);
    $to_order = order_info(0, $to_order_sn);
    /* 检查订单是否存在 */
    if (!$from_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $from_order_sn);
    } elseif (!$to_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $to_order_sn);
    }
    /* 检查合并的订单是否为普通订单,非普通订单不允许合并 */
    if ($from_order['extension_code'] != '' || $to_order['extension_code'] != 0) {
        return $GLOBALS['_LANG']['merge_invalid_order'];
    }
    /* 检查订单状态是否是已确认或未确认、未付款、未发货 */
    if ($from_order['order_status'] != OS_UNCONFIRMED && $from_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $from_order_sn);
    } elseif ($from_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $from_order_sn);
    } elseif ($from_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $from_order_sn);
    }
    if ($to_order['order_status'] != OS_UNCONFIRMED && $to_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $to_order_sn);
    } elseif ($to_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $to_order_sn);
    } elseif ($to_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $to_order_sn);
    }
    /* 检查订单用户是否相同 */
    if ($from_order['user_id'] != $to_order['user_id']) {
        return $GLOBALS['_LANG']['order_user_not_same'];
    }
    /* 合并订单 */
    $order = $to_order;
    $order['order_id'] = '';
    $order['add_time'] = gmtime();
    // 合并商品总额
    $order['goods_amount'] += $from_order['goods_amount'];
    // 合并折扣
    $order['discount'] += $from_order['discount'];
    if ($order['shipping_id'] > 0) {
        // 重新计算配送费用
        $weight_price = order_weight_price($to_order['order_id']);
        $from_weight_price = order_weight_price($from_order['order_id']);
        $weight_price['weight'] += $from_weight_price['weight'];
        $weight_price['amount'] += $from_weight_price['amount'];
        $weight_price['number'] += $from_weight_price['number'];
        $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
        $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list);
        $order['shipping_fee'] = shipping_fee($shipping_area['shipping_code'], unserialize($shipping_area['configure']), $weight_price['weight'], $weight_price['amount'], $weight_price['number']);
        // 如果保价了,重新计算保价费
        if ($order['insure_fee'] > 0) {
            $order['insure_fee'] = shipping_insure_fee($shipping_area['shipping_code'], $order['goods_amount'], $shipping_area['insure']);
        }
    }
    // 重新计算包装费、贺卡费
    if ($order['pack_id'] > 0) {
        $pack = pack_info($order['pack_id']);
        $order['pack_fee'] = $pack['free_money'] > $order['goods_amount'] ? $pack['pack_fee'] : 0;
    }
    if ($order['card_id'] > 0) {
        $card = card_info($order['card_id']);
        $order['card_fee'] = $card['free_money'] > $order['goods_amount'] ? $card['card_fee'] : 0;
    }
    // 红包不变,合并积分、余额、已付款金额
    $order['integral'] += $from_order['integral'];
    $order['integral_money'] = value_of_integral($order['integral']);
    $order['surplus'] += $from_order['surplus'];
    $order['money_paid'] += $from_order['money_paid'];
    // 计算应付款金额(不包括支付费用)
    $order['order_amount'] = $order['goods_amount'] - $order['discount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['bonus'] - $order['integral_money'] - $order['surplus'] - $order['money_paid'];
    // 重新计算支付费
    if ($order['pay_id'] > 0) {
        // 货到付款手续费
        $cod_fee = $shipping_area ? $shipping_area['pay_fee'] : 0;
        $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
        // 应付款金额加上支付费
        $order['order_amount'] += $order['pay_fee'];
    }
    /* 插入订单表 */
    do {
        $order['order_sn'] = get_order_sn();
        if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), addslashes_deep($order), 'INSERT')) {
            break;
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_order.php

示例6: log_account_change

     $db->query($sql);
 }
 // 更新会员余额数量
 if ($is_paid == 1) {
     $change_desc = $amount > 0 ? $_LANG['surplus_type_0'] : $_LANG['surplus_type_1'];
     $change_type = $amount > 0 ? ACT_SAVING : ACT_DRAWING;
     log_account_change($user_id, $amount, 0, 0, 0, $change_desc, $change_type);
 }
 //如果是预付款并且未确认,向pay_log插入一条记录
 if ($process_type == 0 && $is_paid == 0) {
     include_once ROOT_PATH . 'includes/lib_order.php';
     /* 取支付方式信息 */
     $payment_info = array();
     $payment_info = $db->getRow('SELECT * FROM ' . $ecs->table('payment') . " WHERE pay_name = '{$payment}' AND enabled = '1'");
     //计算支付手续费用
     $pay_fee = pay_fee($payment_info['pay_id'], $amount, 0);
     $total_fee = $pay_fee + $amount;
     /* 插入 pay_log */
     $sql = 'INSERT INTO ' . $ecs->table('pay_log') . " (order_id, order_amount, order_type, is_paid)" . " VALUES ('{$id}', '{$total_fee}', '" . PAY_SURPLUS . "', 0)";
     $db->query($sql);
 }
 /* 记录管理员操作 */
 if ($_REQUEST['act'] == 'update') {
     admin_log($user_name, 'edit', 'user_surplus');
 } else {
     admin_log($user_name, 'add', 'user_surplus');
 }
 /* 提示信息 */
 if ($_REQUEST['act'] == 'insert') {
     $href = 'user_account.php?act=list';
 } else {
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:user_account.php

示例7: order_info

 /* 取得订单信息 */
 $order = order_info($order_id);
 /* 判断订单是否有效:余额支付金额 + 已付款金额 >= 保证金 */
 if ($order['surplus'] + $order['money_paid'] >= $group_buy['deposit']) {
     /* 有效,设为已确认,更新订单 */
     // 更新商品总额
     $order['goods_amount'] = $goods_amount;
     // 如果保价,重新计算保价费用
     if ($order['insure_fee'] > 0) {
         $shipping = shipping_info($order['shipping_id']);
         $order['insure_fee'] = shipping_insure_fee($shipping['shipping_code'], $goods_amount, $shipping['insure']);
     }
     // 重算支付费用
     $order['order_amount'] = $order['goods_amount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['money_paid'] - $order['surplus'];
     if ($order['order_amount'] > 0) {
         $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount']);
     } else {
         $order['pay_fee'] = 0;
     }
     // 计算应付款金额
     $order['order_amount'] += $order['pay_fee'];
     // 计算付款状态
     if ($order['order_amount'] > 0) {
         $order['pay_status'] = PS_UNPAYED;
         $order['pay_time'] = 0;
     } else {
         $order['pay_status'] = PS_PAYED;
         $order['pay_time'] = gmtime();
     }
     // 如果需要退款,退到帐户余额
     if ($order['order_amount'] < 0) {
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:group_buy.php

示例8: change_payment

 /**
  * 更换支付方式
  */
 public function change_payment()
 {
     if ($_POST) {
         // 接收数据
         $payment_id = intval($_POST['payment']);
         $order_sn = $_POST['order_sn'];
         if ($order_sn) {
             // 订单信息
             $order_info = model('Order')->order_info(0, $order_sn);
             $payment_id = $payment_id ? $payment_id : $order_info['pay_id'];
             // 支付信息
             $payment_info = model('Order')->payment_info($payment_id);
             // 用户不对应
             if ($_SESSION['user_id'] != $order_info['user_id']) {
                 show_message('请选择对应的订单', '订单列表', url('user/order_list'));
                 exit;
             }
             $amount = $order_info['order_amount'] - $order_info['pay_fee'];
             $pay_fee = pay_fee($payment_id, $amount, 0);
             /* 如果全部使用余额支付,检查余额是否足够 */
             if ($payment_info['pay_code'] == 'balance' && $order_info['order_amount'] > 0) {
                 //用户信息
                 $user_info = model('Order')->user_info($_SESSION['user_id']);
                 if ($order_info['order_amount'] > $user_info['user_money'] + $user_info['credit_line']) {
                     show_message(L('balance_not_enough'));
                 } else {
                     $order['surplus'] = $order_info['order_amount'];
                     $order['order_amount'] = 0;
                 }
                 /* 如果订单金额为0(使用余额或积分或红包支付),修改订单状态为已确认、已付款 */
                 if ($order['order_amount'] <= 0) {
                     $order['order_status'] = OS_CONFIRMED;
                     $order['confirm_time'] = gmtime();
                     $order['pay_status'] = PS_PAYED;
                     $order['pay_time'] = gmtime();
                     $order['order_amount'] = 0;
                 }
                 /* 处理余额 */
                 if ($order_info['user_id'] > 0 && $order['surplus'] > 0) {
                     model('ClipsBase')->log_account_change($order_info['user_id'], $order['surplus'] * -1, 0, 0, 0, sprintf(L('pay_order'), $order_info['order_sn']));
                 }
                 $data['pay_id'] = $payment_info['pay_id'];
                 $data['pay_name'] = $payment_info['pay_name'];
                 $data['pay_fee'] = $pay_fee;
                 $data['surplus'] = $order['surplus'];
                 $data['order_amount'] = $order['order_amount'];
                 $data['order_status'] = $order['order_status'];
                 $data['confirm_time'] = $order['confirm_time'];
                 $data['pay_status'] = $order['pay_status'];
                 $data['pay_time'] = $order['pay_time'];
                 $this->model->table('order_info')->data($data)->where('order_id = ' . $order_info['order_id'])->update();
                 $info['order_amount'] = $order['order_amount'];
                 $this->model->table('pay_log')->data($info)->where('order_id = ' . $order_info['order_id'])->update();
                 $this->alert('支付成功', url('user/order_list'));
             } else {
                 // 最新总额
                 $order_amount = $amount + $pay_fee;
                 $data_order['pay_id'] = $payment_id;
                 $data_order['pay_name'] = $payment_info['pay_name'];
                 $data_order['pay_fee'] = $pay_fee;
                 $data_order['order_amount'] = $order_amount;
                 $this->model->table('order_info')->data($data_order)->where('order_id = ' . $order_info['order_id'])->update();
                 $data_pay['order_amount'] = $order_amount;
                 $this->model->table('pay_log')->data($data_pay)->where('order_id = ' . $order_info['order_id'])->update();
                 /* 调用相应的支付方式文件 */
                 include_once ROOT_PATH . 'plugins/payment/' . $payment_info['pay_code'] . '.php';
                 /* 取得在线支付方式的支付链接,直接跳转 */
                 $pay_obj = new $payment_info['pay_code']();
                 $pay_code = $pay_obj->get_code($order_info, $payment_info);
                 if (empty($pay_code)) {
                     $this->redirect('user/order_list');
                     exit;
                 }
                 echo $pay_code;
             }
             exit;
         } else {
             show_message('请重新选择支付方式', '订单列表', url('user/order_list'));
         }
     } else {
         $this->redirect(url('flow/index'));
     }
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:86,代码来源:FlowController.class.php

示例9: pay_recharge

	public function pay_recharge() {
		if(isset($_POST['dosubmit'])) {
			$code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER);
			if ($_SESSION['code'] != strtolower($code)) {
					showmessage(L('code_error'), HTTP_REFERER);
			}
			$pay_id = $_POST['pay_type'];
			if(!$pay_id) showmessage(L('illegal_pay_method'));
			$payment = $this->handle->get_payment($pay_id);
			$cfg = unserialize_config($payment['config']);
			$pay_name = ucwords($payment['pay_code']);
			if(!param::get_cookie('trade_sn')) {showmessage(L('illegal_creat_sn'));}
			
			$trade_sn	= param::get_cookie('trade_sn');
			$usernote = $_POST['info']['usernote'] ? $_POST['info']['name'].'['.$trade_sn.']'.'-'.new_html_special_chars(trim($_POST['info']['usernote'])) : $_POST['info']['name'].'['.$trade_sn.']';
			
			$surplus = array(
					'userid'      => $this->_userid,
					'username'    => $this->_username,
					'money'       => trim(floatval($_POST['info']['price'])),
					'quantity'    => $_POST['quantity'] ? trim(intval($_POST['quantity'])) : 1,
					'telephone'   => trim($_POST['info']['telephone']),
					'contactname' => $_POST['info']['name'] ? trim($_POST['info']['name']).L('recharge') : $this->_username.L('recharge'),
					'email'       => trim($_POST['info']['email']),
					'addtime'	  => SYS_TIME,
					'ip'	  => ip(),
					'pay_type'	  => 'recharge',
					'pay_id'     => $payment['pay_id'],		
					'payment'     => trim($payment['pay_name']),
					'ispay'		  => '1',
					'usernote'    => $usernote,
					'trade_sn'	  => $trade_sn,
			);
			
			$recordid = $this->handle->set_record($surplus);
			
			$factory_info = $this->handle->get_record($recordid);
			if(!$factory_info) showmessage(L('order_closed_or_finish'));
			$pay_fee = pay_fee($factory_info['money'],$payment['pay_fee'],$payment['pay_method']);
			$logistics_fee = $factory_info['logistics_fee'];
			$discount = $factory_info['discount'];
			
			// calculate amount
			$factory_info['price'] = $factory_info['money'] + $pay_fee + $logistics_fee + $discount;
			
			// add order info
			$order_info['id']	= $factory_info['trade_sn'];
			$order_info['quantity']	= $factory_info['quantity'];
			$order_info['buyer_email']	= $factory_info['email'];
			$order_info['order_time']	= $factory_info['addtime'];
			
			//add product info
			$product_info['name'] = $factory_info['contactname'];
			$product_info['body'] = $factory_info['usernote'];
			$product_info['price'] = $factory_info['price'];
			
			//add set_customerinfo
			$customerinfo['telephone'] = $factory_info['telephone'];
			if($payment['is_online'] === '1') {
				pc_base::load_app_class('pay_factory','',0);
				$payment_handler = new pay_factory($pay_name, $cfg);
				$payment_handler->set_productinfo($product_info)->set_orderinfo($order_info)->set_customerinfo($customer_info);
				$code = $payment_handler->get_code('value="'.L('confirm_pay').'" class="button"');	
			} else {
				$this->account_db->update(array('status'=>'waitting','pay_type'=>'offline'),array('id'=>$recordid));
				$code = '<div class="point">'.L('pay_tip').'</div>';
			}
		}
		include template('pay', 'payment_cofirm');		
	}	
开发者ID:hxzyzz,项目名称:ddc,代码行数:70,代码来源:deposit.php

示例10: act_account

 /**
  *  对会员余额申请的处理
  */
 public function act_account()
 {
     $amount = isset($_POST['amount']) ? floatval($_POST['amount']) : 0;
     if ($amount <= 0) {
         show_message($_LANG['amount_gt_zero']);
     }
     /* 变量初始化 */
     $surplus = array('user_id' => $this->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 = model('ClipsBase')->get_user_surplus($this->user_id);
         if ($amount > $sur_amount) {
             $content = L('surplus_amount_error');
             show_message($content, L('back_page_up'), '', 'info');
         }
         //插入会员账目明细
         $amount = '-' . $amount;
         $surplus['payment'] = '';
         $surplus['rec_id'] = model('ClipsBase')->insert_user_account($surplus, $amount);
         /* 如果成功提交 */
         if ($surplus['rec_id'] > 0) {
             $content = L('surplus_appl_submit');
             show_message($content, L('back_account_log'), url('sale/account_log'), 'info');
         } else {
             $content = $L('process_false');
             show_message($content, L('back_page_up'), '', 'info');
         }
     } else {
         if ($surplus['payment_id'] <= 0) {
             show_message(L('select_payment_pls'));
         }
         //获取支付方式名称
         $payment_info = array();
         $payment_info = model('Order')->payment_info($surplus['payment_id']);
         $surplus['payment'] = $payment_info['pay_name'];
         if ($surplus['rec_id'] > 0) {
             //更新会员账目明细
             $surplus['rec_id'] = model('ClipsBase')->update_user_account($surplus);
         } else {
             //插入会员账目明细
             $surplus['rec_id'] = model('ClipsBase')->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'] = model('ClipsBase')->insert_pay_log($surplus['rec_id'], $order['order_amount'], $type = PAY_SURPLUS, 0);
         /* 调用相应的支付方式文件 */
         include_once ROOT_PATH . 'plugins/payment/' . $payment_info['pay_code'] . '.php';
         /* 取得在线支付方式的支付按钮 */
         $pay_obj = new $payment_info['pay_code']();
         $payment_info['pay_button'] = $pay_obj->get_code($order, $payment);
         /* 模板赋值 */
         $this->assign('payment', $payment_info);
         $this->assign('pay_fee', price_format($payment_info['pay_fee'], false));
         $this->assign('amount', price_format($amount, false));
         $this->assign('order', $order);
         $this->display('sale_act_account.dwt');
     }
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:72,代码来源:SaleController.class.php

示例11: action_insert_update

/**
 * 添加/编辑预售活动的提交
 */
function action_insert_update()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 取得预售活动id */
    $pre_sale_id = intval($_POST['act_id']);
    if (isset($_POST['finish']) || isset($_POST['succeed']) || isset($_POST['fail']) || isset($_POST['mail'])) {
        if ($pre_sale_id <= 0) {
            sys_msg($_LANG['error_pre_sale'], 1);
        }
        $pre_sale = pre_sale_info($pre_sale_id);
        if (empty($pre_sale)) {
            sys_msg($_LANG['error_pre_sale'], 1);
        }
    }
    if (isset($_POST['finish'])) {
        /* 设置活动结束 */
        /* 判断活动状态 */
        if ($pre_sale['status'] != PSS_UNDER_WAY) {
            sys_msg($_LANG['error_status'], 1);
            // 此处怀疑是如果活动进行中突然要结束掉,应该抛出禁止的页面,貌似去掉了,所以程序继续执行
        }
        /* 结束预售活动,修改结束时间为当前时间 */
        $sql = "UPDATE " . $ecs->table('goods_activity') . " SET end_time = '" . gmtime() . "' " . "WHERE act_id = '{$pre_sale_id}' LIMIT 1";
        $db->query($sql);
        /* 清除缓存 */
        clear_cache_files();
        /* 提示信息 */
        $links = array(array('href' => 'pre_sale.php?act=list', 'text' => $_LANG['back_list']));
        sys_msg($_LANG['edit_success'], 0, $links);
    } elseif (isset($_POST['succeed'])) {
        /* 设置活动成功 */
        /* 判断订单状态 */
        if ($pre_sale['status'] != PSS_FINISHED) {
            sys_msg($_LANG['error_status'], 1);
        }
        /* 如果有订单,更新订单信息 */
        if ($pre_sale['total_order'] > 0) {
            /* 查找该预售活动的已确认或未确认订单(已取消的就不管了) */
            $sql = "SELECT order_id " . "FROM " . $ecs->table('order_info') . " WHERE extension_code = '" . PRE_SALE_CODE . "' " . "AND extension_id = '{$pre_sale_id}' " . "AND (order_status = '" . OS_CONFIRMED . "' or order_status = '" . OS_UNCONFIRMED . "')";
            $order_id_list = $db->getCol($sql);
            /* 更新订单商品价 */
            $final_price = $pre_sale['trans_price'];
            $sql = "UPDATE " . $ecs->table('order_goods') . " SET goods_price = '{$final_price}' " . "WHERE order_id " . db_create_in($order_id_list);
            $db->query($sql);
            /* 查询订单商品总额 */
            $sql = "SELECT order_id, SUM(goods_number * goods_price) AS goods_amount " . "FROM " . $ecs->table('order_goods') . " WHERE order_id " . db_create_in($order_id_list) . " GROUP BY order_id";
            $res = $db->query($sql);
            while ($row = $db->fetchRow($res)) {
                $order_id = $row['order_id'];
                $goods_amount = floatval($row['goods_amount']);
                /* 取得订单信息 */
                $order = order_info($order_id);
                /* 判断订单是否有效:余额支付金额 + 已付款金额 >= 保证金 */
                if ($order['surplus'] + $order['money_paid'] >= $pre_sale['deposit']) {
                    /* 有效,设为已确认,更新订单 */
                    // 更新商品总额
                    $order['goods_amount'] = $goods_amount;
                    // 如果保价,重新计算保价费用
                    if ($order['insure_fee'] > 0) {
                        $shipping = shipping_info($order['shipping_id']);
                        $order['insure_fee'] = shipping_insure_fee($shipping['shipping_code'], $goods_amount, $shipping['insure']);
                    }
                    // 重算支付费用
                    $order['order_amount'] = $order['goods_amount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['money_paid'] - $order['surplus'];
                    if ($order['order_amount'] > 0) {
                        $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount']);
                    } else {
                        $order['pay_fee'] = 0;
                    }
                    // 计算应付款金额
                    $order['order_amount'] += $order['pay_fee'];
                    // 计算付款状态
                    if ($order['order_amount'] > 0) {
                        $order['pay_status'] = PS_UNPAYED;
                        $order['pay_time'] = 0;
                    } else {
                        $order['pay_status'] = PS_PAYED;
                        $order['pay_time'] = gmtime();
                    }
                    // 如果需要退款,退到帐户余额
                    if ($order['order_amount'] < 0) {
                        // todo (现在手工退款)
                    }
                    // 订单状态
                    $order['order_status'] = OS_CONFIRMED;
                    $order['confirm_time'] = gmtime();
                    // 更新订单
                    $order = addslashes_deep($order);
                    update_order($order_id, $order);
                } else {
                    /* 无效,取消订单,退回已付款 */
//.........这里部分代码省略.........
开发者ID:seanguo166,项目名称:yinoos,代码行数:101,代码来源:pre_sale.php

示例12: update_user_account

 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, '08');
 /* 模板赋值 */
 $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->assign('act', 'act_account');
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:31,代码来源:account.php

示例13: action_act_edit_payment

function action_act_edit_payment()
{
	$user = $GLOBALS['user'];
	$_CFG = $GLOBALS['_CFG'];
	$_LANG = $GLOBALS['_LANG'];
	$smarty = $GLOBALS['smarty'];
	$db = $GLOBALS['db'];
	$ecs = $GLOBALS['ecs'];
	$user_id = $GLOBALS['user_id'];


	/* 检查是否登录 */
	if($_SESSION['user_id'] <= 0)
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	/* 检查支付方式 */
	$pay_id = intval($_POST['pay_id']);
	if($pay_id <= 0)
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	include_once (ROOT_PATH . 'includes/lib_order.php');
	$payment_info = payment_info($pay_id);
	if(empty($payment_info))
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	/* 检查订单号 */
	$order_id = intval($_POST['order_id']);
	if($order_id <= 0)
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	/* 取得订单 */
	$order = order_info($order_id);
	if(empty($order))
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	/* 检查订单用户跟当前用户是否一致 */
	if($_SESSION['user_id'] != $order['user_id'])
	{
		ecs_header("Location: ./\n");
		exit();
	}
	
	/* 检查订单是否未付款和未发货 以及订单金额是否为0 和支付id是否为改变 */
	if($order['pay_status'] != PS_UNPAYED || $order['shipping_status'] != SS_UNSHIPPED || $order['goods_amount'] <= 0 || $order['pay_id'] == $pay_id)
	{
		ecs_header("Location: user.php?act=order_detail&order_id=$order_id\n");
		exit();
	}
	
	$order_amount = $order['order_amount'] - $order['pay_fee'];
	$pay_fee = pay_fee($pay_id, $order_amount);
	$order_amount += $pay_fee;
	
	$sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='$pay_id', pay_name='$payment_info[pay_name]', pay_fee='$pay_fee', order_amount='$order_amount'" . " WHERE order_id = '$order_id'";
	$db->query($sql);
	
	/* 跳转 */
	ecs_header("Location: user.php?act=order_detail&order_id=$order_id\n");
	exit();
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:75,代码来源:复件+user.php

示例14: array

 }
 /* 修改订单,重新计算支付费用 */
 $order['surplus'] += $surplus;
 $order['order_amount'] -= $surplus;
 if ($order['order_amount'] > 0) {
     $cod_fee = 0;
     if ($order['shipping_id'] > 0) {
         $regions = array($order['country'], $order['province'], $order['city'], $order['district']);
         $shipping = shipping_area_info($order['shipping_id'], $regions);
         if ($shipping['support_cod'] == '1') {
             $cod_fee = $shipping['pay_fee'];
         }
     }
     $pay_fee = 0;
     if ($order['pay_id'] > 0) {
         $pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
     }
     $order['pay_fee'] = $pay_fee;
     $order['order_amount'] += $pay_fee;
 }
 /* 如果全部支付,设为已确认、已付款 */
 if ($order['order_amount'] == 0) {
     if ($order['order_status'] == OS_UNCONFIRMED) {
         $order['order_status'] = OS_CONFIRMED;
         $order['confirm_time'] = gmtime();
     }
     $order['pay_status'] = PS_PAYED;
     $order['pay_time'] = gmtime();
 }
 $order = addslashes_deep($order);
 update_order($order_id, $order);
开发者ID:dlpc,项目名称:ecshop,代码行数:31,代码来源:user.php


注:本文中的pay_fee函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。