本文整理汇总了PHP中order_refund函数的典型用法代码示例。如果您正苦于以下问题:PHP order_refund函数的具体用法?PHP order_refund怎么用?PHP order_refund使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了order_refund函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refund
/**
* 退款
* 在查看订单详情页面进行退款处理
* 需提交参数,
* 退款订单ID(order_id)
* 退款金额(refund_price)
* 操作用户ID(member_id)
* @author 李东
* @date 2015-06-23
*/
public function refund()
{
if (IS_POST) {
$id = I('post.id');
$refund_price = I('post.refund_price');
if (!$id) {
$this->error('操作失败');
}
if (!$refund_price) {
$this->error('请填写退款金额');
}
$username = session('username');
$description = "管理员({$username})强制退款";
$status = order_refund($id, $refund_price, $description);
if ($status) {
$this->success('操作成功!', U('index'));
} else {
$this->error('操作失败');
}
} else {
$this->error('提交错误');
}
}
示例2: return_user_surplus_integral_bonus
return_user_surplus_integral_bonus($order);
} elseif ('return' == $operation) {
/* 定义当前时间 */
define('GMTIME_UTC', gmtime());
// 获取 UTC 时间戳
/* 过滤数据 */
$_REQUEST['refund'] = isset($_REQUEST['refund']) ? $_REQUEST['refund'] : '';
$_REQUEST['refund_note'] = isset($_REQUEST['refund_note']) ? $_REQUEST['refund'] : '';
/* 标记订单为“退货”、“未付款”、“未发货” */
$arr = array('order_status' => OS_RETURNED, 'pay_status' => PS_UNPAYED, 'shipping_status' => SS_UNSHIPPED, 'money_paid' => 0, 'invoice_no' => '', 'order_amount' => $order['money_paid']);
update_order($order_id, $arr);
/* todo 处理退款 */
if ($order['pay_status'] != PS_UNPAYED) {
$refund_type = $_REQUEST['refund'];
$refund_note = $_REQUEST['refund'];
order_refund($order, $refund_type, $refund_note);
}
/* 记录log */
order_action($order['order_sn'], OS_RETURNED, SS_UNSHIPPED, PS_UNPAYED, $action_note);
/* 如果订单用户不为空,计算积分,并退回 */
if ($order['user_id'] > 0) {
/* 取得用户信息 */
$user = user_info($order['user_id']);
$sql = "SELECT goods_number, send_number FROM" . $GLOBALS['ecs']->table('order_goods') . "\n WHERE order_id = '" . $order['order_id'] . "'";
$goods_num = $db->query($sql);
$goods_num = $db->fetchRow($goods_num);
if ($goods_num['goods_number'] == $goods_num['send_number']) {
/* 计算并退回积分 */
$integral = integral_to_give($order);
log_account_change($order['user_id'], 0, 0, -1 * intval($integral['rank_points']), -1 * intval($integral['custom_points']), sprintf($_LANG['return_order_gift_integral'], $order['order_sn']));
}
示例3: while
$sql = "SELECT * " . "FROM " . $ecs->table('order_info') . " WHERE extension_code = 'group_buy' " . "AND extension_id = '{$group_buy_id}' " . "AND (order_status = '" . OS_CONFIRMED . "' OR order_status = '" . OS_UNCONFIRMED . "') ";
$res = $db->query($sql);
while ($order = $db->fetchRow($res)) {
// 修改订单状态为已取消,付款状态为未付款
$order['order_status'] = OS_CANCELED;
$order['to_buyer'] = $_LANG['cancel_order_reason'];
$order['pay_status'] = PS_UNPAYED;
$order['pay_time'] = 0;
/* 如果使用余额或有已付款金额,退回帐户余额 */
$money = $order['surplus'] + $order['money_paid'];
if ($money > 0) {
$order['surplus'] = 0;
$order['money_paid'] = 0;
$order['order_amount'] = $money;
// 退款到帐户余额
order_refund($order, 1, $_LANG['cancel_order_reason'] . ':' . $order['order_sn'], $money);
}
/* 更新订单 */
$order = addslashes_deep($order);
update_order($order['order_id'], $order);
}
}
/* 修改团购活动状态为失败,记录失败原因(活动说明) */
$sql = "UPDATE " . $ecs->table('goods_activity') . " SET is_finished = '" . GBS_FAIL . "', " . "act_desc = '{$_POST['act_desc']}' " . "WHERE act_id = '{$group_buy_id}' LIMIT 1";
$db->query($sql);
/* 清除缓存 */
clear_cache_files();
/* 提示信息 */
$links = array(array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']));
sys_msg($_LANG['edit_success'], 0, $links);
} elseif (isset($_POST['mail'])) {
示例4: action_insert_update
//.........这里部分代码省略.........
$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 {
/* 无效,取消订单,退回已付款 */
// 修改订单状态为已取消,付款状态为未付款
$order['order_status'] = OS_CANCELED;
$order['to_buyer'] = $_LANG['cancel_order_reason'];
$order['pay_status'] = PS_UNPAYED;
$order['pay_time'] = 0;
/* 如果使用余额或有已付款金额,退回帐户余额 */
$money = $order['surplus'] + $order['money_paid'];
if ($money > 0) {
$order['surplus'] = 0;
$order['money_paid'] = 0;
$order['order_amount'] = $money;
// 退款到帐户余额
order_refund($order, 1, $_LANG['cancel_order_reason'] . ':' . $order['order_sn']);
}
/* 更新订单 */
$order = addslashes_deep($order);
update_order($order['order_id'], $order);
}
}
}
/* 修改预售活动状态为成功 */
$sql = "UPDATE " . $ecs->table('goods_activity') . " SET is_finished = '" . PSS_SUCCEED . "' " . "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['fail'])) {
/* 设置活动失败 */
/* 判断订单状态 */
if ($pre_sale['status'] != PSS_FINISHED) {
sys_msg($_LANG['error_status'], 1);
}
/* 如果有有效订单,取消订单 */
if ($pre_sale['valid_order'] > 0) {
/* 查找未确认或已确认的订单 */
$sql = "SELECT * " . "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 . "') ";
$res = $db->query($sql);
while ($order = $db->fetchRow($res)) {
// 修改订单状态为已取消,付款状态为未付款
$order['order_status'] = OS_CANCELED;
$order['to_buyer'] = $_LANG['cancel_order_reason'];
$order['pay_status'] = PS_UNPAYED;
$order['pay_time'] = 0;
示例5: refund
/**
* 退款
* 在查看订单详情页面进行退款处理
* 需提交参数,
* 退款订单ID(order_id)
* 退款金额(refund_price)
* 操作用户ID(member_id)
* @author 李东
* @date 2015-06-30
*/
public function refund()
{
if (IS_POST) {
$posts = I('post.');
$id = $posts['order_id'];
$refund_price = $posts['refund_price'];
$member_id = session('home_member_id');
$deal_password = $posts['deal_password'];
if (!$id) {
$result = array('status' => '0', 'msg' => '操作失败');
goto export;
}
if (!floatval($refund_price)) {
$result = array('status' => '0', 'msg' => '请填写退款金额');
goto export;
}
if (!$member_id) {
$result = array('status' => '0', 'msg' => '请登录后再操作');
goto export;
}
$member_info = get_info('member', array('id' => $member_id));
if (md5(md5($deal_password)) != $member_info['deal_password']) {
$result = array('status' => '0', 'msg' => '支付密码不正确');
goto export;
}
$description = "商家同意退款";
$result = order_refund($id, floatval($refund_price), $description);
export:
if ($result['status'] == 1) {
$this->success($result['msg'], U('index'));
} else {
$this->error($result['msg']);
}
} else {
$this->error('请求错误!');
}
}