本文整理汇总了PHP中payment_info函数的典型用法代码示例。如果您正苦于以下问题:PHP payment_info函数的具体用法?PHP payment_info怎么用?PHP payment_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了payment_info函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ecs_header
ecs_header('Location: user.php?act=order_detail&order_id=' . $order_id . "\n");
exit;
} elseif ($action == 'act_edit_payment') {
/* 检查是否登录 */
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;
示例2: get_order_detail
/**
* 获取指订单的详情
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return arr $order 订单所有信息的数组
*/
function get_order_detail($order_id, $user_id = 0)
{
include_once ROOT_PATH . 'includes/lib_order.php';
$order_id = intval($order_id);
if ($order_id <= 0) {
$GLOBALS['err']->add(L('invalid_order_id'));
return false;
}
$order = order_info($order_id);
//检查订单是否属于该用户
if ($user_id > 0 && $user_id != $order['user_id']) {
$GLOBALS['err']->add(L('no_priv'));
return false;
}
/* 对发货号处理 */
if (!empty($order['invoice_no'])) {
$shipping_code = $GLOBALS['db']->GetOne("SELECT shipping_code FROM " . $GLOBALS['ecs']->table('shipping') . " WHERE shipping_id = '{$order['shipping_id']}'");
$plugin = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php';
if (file_exists($plugin)) {
include_once $plugin;
$shipping = new $shipping_code();
$order['invoice_no'] = $shipping->query($order['invoice_no']);
}
}
/* 只有未确认才允许用户修改订单地址 */
if ($order['order_status'] == OS_UNCONFIRMED) {
$order['allow_update_address'] = 1;
//允许修改收货地址
} else {
$order['allow_update_address'] = 0;
}
/* 获取订单中实体商品数量 */
$order['exist_real_goods'] = exist_real_goods($order_id);
/* 如果是未付款状态,生成支付按钮 */
if ($order['pay_status'] == PS_UNPAYED && ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED)) {
/*
* 在线支付按钮
*/
//支付方式信息
$payment_info = array();
$payment_info = payment_info($order['pay_id']);
//无效支付方式
if ($payment_info === false) {
$order['pay_online'] = '';
} else {
//取得支付信息,生成支付代码
$payment = unserialize_config($payment_info['pay_config']);
//获取需要支付的log_id
$order['log_id'] = get_paylog_id($order['order_id'], $pay_type = PAY_ORDER);
$order['user_name'] = $_SESSION['user_name'];
$order['pay_desc'] = $payment_info['pay_desc'];
/* 调用相应的支付方式文件 */
include_once ROOT_PATH . 'includes/modules/payment/' . $payment_info['pay_code'] . '.php';
/* 取得在线支付方式的支付按钮 */
$pay_obj = new $payment_info['pay_code']();
$order['pay_online'] = $pay_obj->get_code($order, $payment);
}
} else {
$order['pay_online'] = '';
}
/* 无配送时的处理 */
$order['shipping_id'] == -1 and $order['shipping_name'] = L('shipping_not_need');
/* 其他信息初始化 */
$order['how_oos_name'] = $order['how_oos'];
$order['how_surplus_name'] = $order['how_surplus'];
/* 虚拟商品付款后处理 */
if ($order['pay_status'] != PS_UNPAYED) {
/* 取得已发货的虚拟商品信息 */
$virtual_goods = get_virtual_goods($order_id, true);
$virtual_card = array();
foreach ($virtual_goods as $code => $goods_list) {
/* 只处理虚拟卡 */
if ($code == 'virtual_card') {
foreach ($goods_list as $goods) {
if ($info = virtual_card_result($order['order_sn'], $goods)) {
$virtual_card[] = array('goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'info' => $info);
}
}
}
/* 处理超值礼包里面的虚拟卡 */
if ($code == 'package_buy') {
foreach ($goods_list as $goods) {
$sql = 'SELECT g.goods_id FROM ' . $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE pg.goods_id = g.goods_id AND pg.package_id = '" . $goods['goods_id'] . "' AND extension_code = 'virtual_card'";
$vcard_arr = $GLOBALS['db']->getAll($sql);
foreach ($vcard_arr as $val) {
if ($info = virtual_card_result($order['order_sn'], $val)) {
$virtual_card[] = array('goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'info' => $info);
}
}
}
}
//.........这里部分代码省略.........
示例3: pay_fee
/**
* 获得订单需要支付的支付费用
*
* @access public
* @param integer $payment_id
* @param float $order_amount
* @param mix $cod_fee
* @return float
*/
function pay_fee($payment_id, $order_amount, $cod_fee = null)
{
$pay_fee = 0;
$payment = payment_info($payment_id);
$rate = $payment['is_cod'] && !is_null($cod_fee) ? $cod_fee : $payment['pay_fee'];
if (strpos($rate, '%') !== false) {
/* 支付费用是一个比例 */
$val = floatval($rate) / 100;
$pay_fee = $val > 0 ? $order_amount * $val / (1 - $val) : 0;
} else {
$pay_fee = floatval($rate);
}
return round($pay_fee, 2);
}
示例4: 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;
}
示例5: log_account_change
log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * -1, sprintf('支付订单 %s', $order['order_sn']));
}
/* 如果使用库存,且下订单时减库存,则减少库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id'], true, SDT_PLACE);
}
/* 清空购物车 */
clear_cart($flow_type);
/* 清除缓存,否则买了商品,但是前台页面读取缓存,商品数量不减少 */
clear_all_files();
if (!empty($order['shipping_name'])) {
$order['shipping_name'] = trim(stripcslashes($order['shipping_name']));
}
/* 取得支付信息,生成支付代码 */
if ($order['order_amount'] > 0) {
$payment = payment_info($order['pay_id']);
include_once 'includes/modules/payment/' . $payment['pay_code'] . '.php';
$pay_obj = new $payment['pay_code']();
$order['log_id'] = insert_pay_log($new_order_id, $order['order_amount'], PAY_ORDER);
$pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config']));
$order['pay_desc'] = $payment['pay_desc'];
$smarty->assign('pay_online', $pay_online);
}
/* 订单信息 */
$smarty->assign('order', $order);
$smarty->assign('total', $total);
$smarty->assign('goods_list', $cart_goods);
$smarty->assign('order_submit_back', sprintf('您可以 %s 或去 %s', '<a href="index.php">返回首页</a>', '<a href="user.php">用户中心</a>'));
// 返回提示
unset($_SESSION['flow_consignee']);
// 清除session中保存的收货人信息
示例6: operable_list
/**
* 返回某个订单可执行的操作列表,包括权限判断
* @param array $order 订单信息 order_status, shipping_status, pay_status
* @param bool $is_cod 支付方式是否货到付款
* @return array 可执行的操作 confirm, pay, unpay, prepare, ship, unship, receive, cancel, invalid, return, drop
* 格式 array('confirm' => true, 'pay' => true)
*/
function operable_list($order)
{
/* 取得订单状态、发货状态、付款状态 */
$os = $order['order_status'];
$ss = $order['shipping_status'];
$ps = $order['pay_status'];
/* 取得订单操作权限 */
$actions = $_SESSION['action_list'];
if ($actions == 'all') {
$priv_list = array('os' => true, 'ss' => true, 'ps' => true, 'edit' => true);
} else {
$actions = ',' . $actions . ',';
$priv_list = array('os' => strpos($actions, ',order_os_edit,') !== false, 'ss' => strpos($actions, ',order_ss_edit,') !== false, 'ps' => strpos($actions, ',order_ps_edit,') !== false, 'edit' => strpos($actions, ',order_edit,') !== false);
}
/* 取得订单支付方式是否货到付款 */
$payment = payment_info($order['pay_id']);
$is_cod = $payment['is_cod'] == 1;
/* 根据状态返回可执行操作 */
$list = array();
if (OS_UNCONFIRMED == $os) {
/* 状态:未确认 => 未付款、未发货 */
if ($priv_list['os']) {
$list['confirm'] = true;
// 确认
$list['invalid'] = true;
// 无效
$list['cancel'] = true;
// 取消
if ($is_cod) {
/* 货到付款 */
if ($priv_list['ss']) {
$list['prepare'] = true;
// 配货
$list['split'] = true;
// 分单
}
} else {
/* 不是货到付款 */
if ($priv_list['ps']) {
$list['pay'] = true;
// 付款
}
}
}
} elseif (OS_CONFIRMED == $os || OS_SPLITED == $os || OS_SPLITING_PART == $os) {
/* 状态:已确认 */
if (PS_UNPAYED == $ps) {
/* 状态:已确认、未付款 */
if (SS_UNSHIPPED == $ss || SS_PREPARING == $ss) {
/* 状态:已确认、未付款、未发货(或配货中) */
if ($priv_list['os']) {
$list['cancel'] = true;
// 取消
$list['invalid'] = true;
// 无效
}
if ($is_cod) {
/* 货到付款 */
if ($priv_list['ss']) {
if (SS_UNSHIPPED == $ss) {
$list['prepare'] = true;
// 配货
}
$list['split'] = true;
// 分单
}
} else {
/* 不是货到付款 */
if ($priv_list['ps']) {
$list['pay'] = true;
// 付款
}
}
} elseif (SS_SHIPPED_ING == $ss || SS_SHIPPED_PART == $ss) {
// 部分分单
if (OS_SPLITING_PART == $os) {
$list['split'] = true;
// 分单
}
$list['to_delivery'] = true;
// 去发货
} else {
/* 状态:已确认、未付款、已发货或已收货 => 货到付款 */
if ($priv_list['ps']) {
$list['pay'] = true;
// 付款
}
if ($priv_list['ss']) {
if (SS_SHIPPED == $ss) {
$list['receive'] = true;
// 收货确认
}
$list['unship'] = true;
//.........这里部分代码省略.........
示例7: done
//.........这里部分代码省略.........
{
$order[$key] = addslashes($value);
}
/* 订单中的总额 */
$total = order_fee($order, $cart_goods, $consignee);
$order['bonus'] = $total['bonus'];
$order['goods_amount'] = $total['goods_price'];
$order['discount'] = $total['discount'];
$order['surplus'] = $total['surplus'];
$order['tax'] = $total['tax'];
#购物车中的商品能享受红包支付的总额
$discount_amout = compute_discount_amount();
#红包和积分最多能支付的金额为商品总额
$temp_amout = $order['goods_amount'] - $discount_amout;
if ($temp_amout <= 0)
{
$order['bonus_id'] = 0;
}
/* 配送方式 */
if ($order['shipping_id'] > 0)
{
$shipping = shipping_info($order['shipping_id']);
$order['shipping_name'] = addslashes($shipping['shipping_name']);
}
$order['shipping_fee'] = $total['shipping_fee'];
$order['insure_fee'] = $total['shipping_insure'];
/* 支付方式 */
if ($order['pay_id'] > 0)
{
$payment = payment_info($order['pay_id']);
$order['pay_name'] = addslashes($payment['pay_name']);
}
$order['pay_fee'] = $total['pay_fee'];
$order['cod_fee'] = $total['cod_fee'];
/* 商品包装 */
if ($order['pack_id'] > 0)
{
$pack = pack_info($order['pack_id']);
$order['pack_name'] = addslashes($pack['pack_name']);
}
$order['pack_fee'] = $total['pack_fee'];
/* 祝福贺卡 */
if ($order['card_id'] > 0)
{
$card = card_info($order['card_id']);
$order['card_name'] = addslashes($card['card_name']);
}
$order['card_fee'] = $total['card_fee'];
$order['order_amount'] = number_format($total['amount'], 2, '.', '');
/* 如果全部使用余额支付,检查余额是否足够 */
if ($payment['pay_code'] == 'balance' && $order['order_amount'] > 0)
{
if($order['surplus'] >0) //余额支付里如果输入了一个金额
{
$order['order_amount'] = $order['order_amount'] + $order['surplus'];
$order['surplus'] = 0;
}
示例8: array
//$orders[$key]['ss'] = $goods_list;
$goods_list_t = array();
// $goods_list = API_DATA("SIMPLEGOODS", $goods_list);
foreach ($goods_list as $v) {
$goods_list_t[] = array("goods_id" => $v['goods_id'], "name" => $v['goods_name'], "goods_number" => $v['goods_number'], "subtotal" => price_format($v['subtotal'], false), "formated_shop_price" => price_format($v['goods_price'], false), "img" => array('small' => API_DATA('PHOTO', $v['goods_thumb']), 'thumb' => API_DATA('PHOTO', $v['goods_img']), 'url' => API_DATA('PHOTO', $v['original_img'])));
}
$orders[$key]['goods_list'] = $goods_list_t;
$order_detail = get_order_detail($value['order_id'], $user_id);
$orders[$key]['formated_integral_money'] = $order_detail['formated_integral_money'];
//积分 钱
$orders[$key]['formated_bonus'] = $order_detail['formated_bonus'];
//红包 钱
$orders[$key]['formated_shipping_fee'] = $order_detail['formated_shipping_fee'];
//运送费
if ($order_detail['pay_id'] > 0) {
$payment = payment_info($order_detail['pay_id']);
}
$subject = $orders[$key]['goods_list'][0]['name'] . '等' . count($orders[$key]['goods_list']) . '种商品';
$orders[$key]['order_info'] = array('pay_code' => $payment['pay_code'], 'order_amount' => $order_detail['order_amount'], 'order_id' => $order_detail['order_id'], 'subject' => $subject, 'desc' => $subject, 'order_sn' => $order_detail['order_sn']);
}
// print_r($orders);exit;
$pagero = array("total" => $pager['record_count'], "count" => count($orders), "more" => empty($pager['page_next']) ? 0 : 1);
GZ_Api::outPut($orders, $pagero);
////function
/**
* 获取用户指定范围的订单列表
*
* @access public
* @param int $user_id 用户ID号
* @param int $num 列表最大数量
* @param int $start 列表起始位置
示例9: insert_user_account
$surplus['payment'] = '';
$surplus['rec_id'] = insert_user_account($surplus, $amount);
/* 如果成功提交 */
if ($surplus['rec_id'] > 0) {
exit("您的提现申请已成功提交,请等待管理员的审核!");
} else {
exit("此次操作失败,请返回重试!");
}
} else {
if ($surplus['payment_id'] <= 0) {
exit("请选择支付方式");
}
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;
示例10: 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();
}
示例11: payment_info
$_REQUEST['code'] = $arr1[0];
$_REQUEST[$arr2[0]] = $arr2[1];
$_GET['code'] = $arr1[0];
$_GET[$arr2[0]] = $arr2[1];
$pay_code = $arr1[0];
}
/* 判断是否启用 */
$sql = "SELECT pay_id FROM " . $ecs->table('touch_payment') . " WHERE pay_code = '{$pay_code}' AND enabled = 1";
$pay_id = $db->getOne($sql);
if (empty($pay_id)) {
$msg = $_LANG['pay_disabled'];
} else {
$plugin_file = 'include/modules/payment/' . $pay_code . '.php';
/* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */
if (file_exists($plugin_file)) {
$param = payment_info($pay_id);
/* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */
include_once $plugin_file;
$payment = new $pay_code();
$config = unserialize_config($param['pay_config']);
$config['call_type'] = $_REQUEST['call_type'];
unset($_GET['code']);
unset($_GET['call_type']);
$msg = @$payment->respond($config) ? $_LANG['pay_success'] : $_LANG['pay_fail'];
} else {
$msg = $_LANG['pay_not_exist'];
}
}
}
assign_template();
$position = assign_ur_here();
示例12: pay_team_action
function pay_team_action($orsn)
{
/*是团购改变订单*/
$sql = "select * from " . $GLOBALS['hhs']->table('order_info') . " where order_sn='" . $orsn . "'";
$order_info = $GLOBALS['db']->getRow($sql);
include_once ROOT_PATH . "languages/zh_cn/wx_msg.php";
if (!empty($order_info) && $order_info['extension_code'] == 'team_goods') {
$team_sign = $order_info['team_sign'];
$weixin = new class_weixin($GLOBALS['appid'], $GLOBALS['appsecret']);
$openid = $GLOBALS['db']->getOne("select openid from " . $GLOBALS['hhs']->table('users') . " where user_id=" . $order_info['user_id']);
$t_openid = $GLOBALS['db']->getOne("select u.openid from " . $GLOBALS['hhs']->table('order_info') . " as oi left join " . $GLOBALS['hhs']->table('users') . " as u on oi.user_id=u.user_id where oi.team_first=1 and oi.team_sign=" . $team_sign);
$sql = "select team_num,discount_type,discount_amount from " . $GLOBALS['hhs']->table('goods') . " where goods_id=" . $order_info['extension_id'];
$rs = $GLOBALS['db']->getRow($sql);
$team_num = $rs['team_num'];
$discount_type = $rs['discount_type'];
$discount_amount = $rs['discount_amount'];
if ($order_info['team_first'] == 1) {
//若是团长记录下团的人数
if ($discount_type == 1 && $order_info['refund_sign'] == 0) {
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET team_num='{$team_num}',discount_type ='{$discount_type}',discount_amount=money_paid+order_amount WHERE order_id=" . $order_info['order_id'];
} elseif ($discount_type == 2 && $order_info['refund_sign'] == 0) {
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET team_num='{$team_num}',discount_type ='{$discount_type}', discount_amount='{$discount_amount}' WHERE order_id=" . $order_info['order_id'];
} else {
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET team_num='{$team_num}', discount_amount=0 WHERE order_id=" . $order_info['order_id'];
}
$GLOBALS['db']->query($sql);
}
$sql = "select team_num from " . $GLOBALS['hhs']->table('order_info') . " where order_id=" . $order_info['team_sign'];
$team_num = $GLOBALS['db']->getOne($sql);
//团共需人数和状态
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET team_status=1,team_num='{$team_num}' WHERE order_id=" . $order_info['order_id'];
$GLOBALS['db']->query($sql);
//实际人数
$sql = "select count(*) from " . $GLOBALS['hhs']->table('order_info') . " where team_sign=" . $team_sign . " and team_status>0 ";
$rel_num = $GLOBALS['db']->getOne($sql);
//存储实际人数
$sql = "update " . $GLOBALS['hhs']->table('order_info') . " set teammen_num='{$rel_num}' where team_sign=" . $team_sign;
$GLOBALS['db']->query($sql);
if ($team_num <= $rel_num) {
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET team_status=2 WHERE team_status=1 and team_sign=" . $team_sign;
$GLOBALS['db']->query($sql);
//取消未参团订单
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET order_status=2 WHERE team_status=0 and team_sign=" . $team_sign;
$GLOBALS['db']->query($sql);
//判断团长是否有优惠,要重新取数据
$sql = "select order_id,user_id,refund_sign,discount_type, discount_amount, money_paid,order_amount,order_sn from " . $GLOBALS['hhs']->table('order_info') . " where order_id=" . $team_sign;
$r = $GLOBALS['db']->getRow($sql);
//目前只有微信可以退款
$payment = payment_info($order_info['pay_id']);
if ($payment['pay_code'] == 'wxpay') {
if ($r['discount_type'] == 1 && $r['refund_sign'] == 0) {
//团长免单
$f = refund($r['order_sn'], $r['money_paid'] * 100);
if ($f) {
$arr['pay_status'] = 3;
$arr['refund_sign'] = 1;
$arr['money_paid'] = 0;
$arr['order_amount'] = $r['money_paid'] + $r['order_amount'];
update_order($team_sign, $arr);
$weixin->send_wxmsg($t_openid, $_team_msg['refund_team_first']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['refund_team_first']['desc']);
}
} elseif ($r['discount_type'] == 2 && $r['refund_sign'] == 0) {
$f = refund($r['order_sn'], $r['discount_amount'] * 100);
if ($f) {
$arr['refund_sign'] = 1;
$arr['money_paid'] = $r['money_paid'] - $r['discount_amount'];
$arr['order_amount'] = $r['discount_amount'] + $r['order_amount'];
update_order($team_sign, $arr);
$weixin->send_wxmsg($t_openid, $_team_msg['refund_team_discount']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['refund_team_discount']['desc']);
}
}
}
}
if ($order_info['team_first'] == 1) {
$weixin->send_wxmsg($openid, $_team_msg['pay']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['pay']['desc']);
//$weixin->send_wxmsg($t_openid, $_team_msg['team_suc_first']['title'] , 'share.php?team_sign='.$team_sign , $_team_msg['team_suc_first']['title'] );
} elseif ($order_info['team_first'] == 2) {
if ($team_num <= $rel_num) {
$weixin->send_wxmsg($openid, $_team_msg['team_suc_mem']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['team_suc_mem']['desc']);
$weixin->send_wxmsg($t_openid, $_team_msg['team_suc_first']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['team_suc_first']['title']);
} else {
$weixin->send_wxmsg($openid, $_team_msg['mem_pay']['title'], 'share.php?team_sign=' . $team_sign, $_team_msg['mem_pay']['title']);
}
}
}
}
示例13: get_user_orders_ex
function get_user_orders_ex($user_id, $num = 10, $start = 0, $ext = null)
{
global $_CFG;
/*判断组团的状态*/
$sql = "select * from " . $GLOBALS['hhs']->table('order_info') . " where user_id='{$user_id}' limit " . $start . "," . $num;
$orders = $GLOBALS['db']->getAll($sql);
if (!empty($orders)) {
foreach ($orders as $v) {
if ($v['extension_code'] == 'team_goods' && $v['team_status'] == 1) {
$sql = "select pay_time from " . $GLOBALS['hhs']->table('order_info') . " where order_id=" . $v['team_sign'];
$pay_time = $GLOBALS['db']->getOne($sql);
if ($pay_time + $_CFG['team_suc_time'] * 24 * 3600 < gmtime()) {
//取消订单
$sql = "update " . $GLOBALS['hhs']->table('order_info') . " set team_status=3,order_status=2 where team_status=1 and team_sign=" . $v['team_sign'];
$GLOBALS['db']->query($sql);
$sql = "UPDATE " . $GLOBALS['hhs']->table('order_info') . " SET order_status=2 WHERE team_status=0 and team_sign=" . $v['team_sign'];
$GLOBALS['db']->query($sql);
}
}
}
}
include_once ROOT_PATH . 'includes/lib_order.php';
/* 取得订单列表 */
$arr = array();
$sql = "SELECT order_id,share_pay_type, order_sn, order_status, shipping_status, pay_status,pay_id, add_time,order_amount, shipping_name,shipping_id,invoice_no, " . "(goods_amount + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee + tax - discount) AS total_fee,extension_code,extension_id,team_sign,team_first,team_status " . " FROM " . $GLOBALS['hhs']->table('order_info') . " WHERE user_id = '{$user_id}' " . $ext . " ORDER BY add_time DESC";
$res = $GLOBALS['db']->SelectLimit($sql, $num, $start);
while ($row = $GLOBALS['db']->fetchRow($res)) {
if ($row['order_status'] == OS_UNCONFIRMED) {
$row['handler'] = "<a href=\"user.php?act=cancel_order&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $GLOBALS['_LANG']['confirm_cancel'] . "')) return false;\">" . $GLOBALS['_LANG']['cancel'] . "</a>";
} else {
if ($row['order_status'] == OS_SPLITED) {
/* 对配送状态的处理 */
if ($row['shipping_status'] == SS_SHIPPED) {
@($row['handler'] = "<a href=\"javascript:void(0);\" onclick='get_invoice(\"" . $row['shipping_name'] . "\",\"" . $row['invoice_no'] . "\");'>查看物流</a>");
@($row['handler'] .= "<a href=\"user.php?act=affirm_received&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $GLOBALS['_LANG']['confirm_received'] . "')) return false;\">" . $GLOBALS['_LANG']['received'] . "</a>");
} elseif ($row['shipping_status'] == SS_RECEIVED) {
//@$row['handler'] = '<span style="color:red">'.$GLOBALS['_LANG']['ss_received'] .'</span>';
} else {
if ($row['pay_status'] == PS_UNPAYED) {
//@$row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" .$row['order_id']. '">' .$GLOBALS['_LANG']['pay_money']. '</a>';
} else {
//@$row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" .$row['order_id']. '">' .$GLOBALS['_LANG']['view_order']. '</a>';
}
}
} else {
//$row['handler'] = '<span style="color:red">'.$GLOBALS['_LANG']['os'][$row['order_status']] .'</span>';
}
}
$pay_online = '';
if ($row['share_pay_type'] > 0 && $row['pay_status'] == PS_UNPAYED) {
$pay_online = "<a class='state_btn_2' href='share_pay.php?id=" . $row['order_id'] . "'>代付</a>";
}
if ($row['share_pay_type'] == 0 && $row['pay_status'] == PS_UNPAYED && ($row['order_status'] == OS_UNCONFIRMED || $row['order_status'] == OS_CONFIRMED)) {
$payment_info = array();
$payment_info = payment_info($row['pay_id']);
//无效支付方式
if ($payment_info === false) {
$row['pay_online'] = '';
} else {
if ($payment_info['pay_code'] == 'cod') {
$payment_info = $GLOBALS['db']->getRow("select * from " . $GLOBALS['hhs']->table("payment") . " where pay_code='wxpay' AND enabled = 1");
}
//取得支付信息,生成支付代码
$payment = unserialize_config($payment_info['pay_config']);
//获取需要支付的log_id
$row['log_id'] = get_paylog_id($row['order_id'], $pay_type = PAY_ORDER);
$row['user_name'] = $_SESSION['user_name'];
$row['pay_desc'] = $payment_info['pay_desc'];
if ($row['extension_id']) {
$sql = "select goods_name from " . $GLOBALS['hhs']->table('goods') . " where goods_id=" . $row['extension_id'];
$row['goods_name'] = $GLOBALS['db']->getOne($sql);
}
/* 调用相应的支付方式文件 */
include_once ROOT_PATH . 'includes/modules/payment/' . $payment_info['pay_code'] . '.php';
if ($row['order_amount'] > 0) {
if ($payment_info['pay_code'] != 'alipay') {
/* 调用相应的支付方式文件 */
include_once ROOT_PATH . 'includes/modules/payment/' . $payment_info['pay_code'] . '.php';
/* 取得在线支付方式的支付按钮 */
$pay_obj = new $payment_info['pay_code']();
$pay_online = $pay_obj->get_code($row, $payment);
} else {
$pay_online = '<a class="state_btn_2" href="toalipay.php?order_id=' . $row['order_id'] . '" >支付宝支付</a>';
}
}
}
}
$row['handler'] = $pay_online . $row['handler'];
$row['shipping_status'] = $row['shipping_status'] == SS_SHIPPED_ING ? SS_PREPARING : $row['shipping_status'];
/*
if($row['order_status']==2){
$row['order_status'] = $GLOBALS['_LANG']['os'][$row['order_status']] ;
}else{
if($row['pay_status']==0){
$row['order_status'] = $GLOBALS['_LANG']['ps'][$row['pay_status']];
}else{
$row['order_status'] = $GLOBALS['_LANG']['ss'][$row['shipping_status']];// $GLOBALS['_LANG']['ps'][$row['pay_status']] . ',' .
}
}*/
$row['order_status'] = $GLOBALS['_LANG']['ps'][$row['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$row['shipping_status']];
//.........这里部分代码省略.........