本文整理汇总了PHP中change_order_goods_storage函数的典型用法代码示例。如果您正苦于以下问题:PHP change_order_goods_storage函数的具体用法?PHP change_order_goods_storage怎么用?PHP change_order_goods_storage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了change_order_goods_storage函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cancel_order
/**
* 取消一个用户订单
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return void
*/
function cancel_order($order_id, $user_id = 0)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_id, order_sn , surplus , integral , bonus_id, order_status, shipping_status, pay_status FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $GLOBALS['db']->GetRow($sql);
if (empty($order)) {
$GLOBALS['err']->add(L('order_exist'));
return false;
}
// 如果用户ID大于0,检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add(L('no_priv'));
return false;
}
// 订单状态只能是“未确认”或“已确认”
if ($order['order_status'] != OS_UNCONFIRMED && $order['order_status'] != OS_CONFIRMED) {
$GLOBALS['err']->add(L('current_os_not_unconfirmed'));
return false;
}
//订单一旦确认,不允许用户取消
if ($order['order_status'] == OS_CONFIRMED) {
$GLOBALS['err']->add(L('current_os_already_confirmed'));
return false;
}
// 发货状态只能是“未发货”
if ($order['shipping_status'] != SS_UNSHIPPED) {
$GLOBALS['err']->add(L('current_ss_not_cancel'));
return false;
}
// 如果付款状态是“已付款”、“付款中”,不允许取消,要取消和商家联系
if ($order['pay_status'] != PS_UNPAYED) {
$GLOBALS['err']->add(L('current_ps_not_cancel'));
return false;
}
//将用户订单设置为取消
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET order_status = '" . OS_CANCELED . "' WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
/* 记录log */
order_action($order['order_sn'], OS_CANCELED, $order['shipping_status'], PS_UNPAYED, L('buyer_cancel.buyer'));
/* 退货用户余额、积分、红包 */
if ($order['user_id'] > 0 && $order['surplus'] > 0) {
$change_desc = sprintf(L('return_surplus_on_cancel'), $order['order_sn']);
log_account_change($order['user_id'], $order['surplus'], 0, 0, 0, $change_desc);
}
if ($order['user_id'] > 0 && $order['integral'] > 0) {
$change_desc = sprintf(L('return_integral_on_cancel'), $order['order_sn']);
log_account_change($order['user_id'], 0, 0, 0, $order['integral'], $change_desc);
}
if ($order['user_id'] > 0 && $order['bonus_id'] > 0) {
change_user_bonus($order['bonus_id'], $order['order_id'], false);
}
/* 如果使用库存,且下订单时减库存,则增加库存 */
if (C('use_storage') == '1' && C('stock_dec_time') == SDT_PLACE) {
change_order_goods_storage($order['order_id'], false, 1);
}
/* 修改订单 */
$arr = array('bonus_id' => 0, 'bonus' => 0, 'integral' => 0, 'integral_money' => 0, 'surplus' => 0);
update_order($order['order_id'], $arr);
return true;
} else {
die($GLOBALS['db']->errorMsg());
}
}
示例2: log_account_change
}
/* 处理余额、积分、红包 */
if ($order['user_id'] > 0 && $order['surplus'] > 0) {
log_account_change($order['user_id'], $order['surplus'] * -1, 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn']));
}
if ($order['user_id'] > 0 && $order['integral'] > 0) {
log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * -1, sprintf($_LANG['pay_order'], $order['order_sn']));
}
if ($order['bonus_id'] > 0 && $temp_amout > 0) {
use_bonus($order['bonus_id'], $new_order_id);
}
$split_order['suborder_list'][$ok]['order_sn'] = $order['order_sn'];
$split_order['suborder_list'][$ok]['order_amount_formated'] = price_format($order['order_amount']);
/* 如果使用库存,且下订单时减库存,则减少库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) {
$ret = change_order_goods_storage($order['order_id'], true, SDT_PLACE);
if ($ret !== true) {
delet_data_order($order['order_id']);
//将此订单数据删除掉
show_message($ret);
}
}
/* 给商家发邮件 */
/* 增加是否给客服发送邮件选项 */
if ($_CFG['send_service_email'] && $_CFG['service_email'] != '') {
$tpl = get_mail_template('remind_of_new_order');
$smarty->assign('order', $order);
$smarty->assign('goods_list', $cart_goods);
$smarty->assign('shop_name', $_CFG['shop_name']);
$smarty->assign('send_date', date($_CFG['time_format']));
$content = $smarty->fetch('str:' . $tpl['template_content']);
示例3: integral_to_give
$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']));
}
/* todo 计算并退回红包 */
return_order_bonus($order_id);
}
/* 如果使用库存,则增加库存(不论何时减库存都需要) */
if ($_CFG['use_storage'] == '1') {
if ($_CFG['stock_dec_time'] == SDT_SHIP) {
change_order_goods_storage($order['order_id'], false, SDT_SHIP);
} elseif ($_CFG['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id'], false, SDT_PLACE);
}
}
/* 退货用户余额、积分、红包 */
return_user_surplus_integral_bonus($order);
/* 获取当前操作员 */
$delivery['action_user'] = $_SESSION['admin_name'];
/* 添加退货记录 */
$delivery_list = array();
$sql_delivery = "SELECT *\n FROM " . $ecs->table('delivery_order') . "\n WHERE status IN (0, 2)\n AND order_id = " . $order['order_id'];
$delivery_list = $GLOBALS['db']->getAll($sql_delivery);
if ($delivery_list) {
foreach ($delivery_list as $list) {
$sql_back = "INSERT INTO " . $ecs->table('back_order') . " (delivery_sn, order_sn, order_id, add_time, shipping_id, user_id, action_user, consignee, address, Country, province, City, district, sign_building, Email,Zipcode, Tel, Mobile, best_time, postscript, how_oos, insure_fee, shipping_fee, update_time, suppliers_id, return_time, agency_id, invoice_no) VALUES ";
$sql_back .= " ( '" . $list['delivery_sn'] . "', '" . $list['order_sn'] . "',\n '" . $list['order_id'] . "', '" . $list['add_time'] . "',\n '" . $list['shipping_id'] . "', '" . $list['user_id'] . "',\n '" . $delivery['action_user'] . "', '" . $list['consignee'] . "',\n '" . $list['address'] . "', '" . $list['country'] . "', '" . $list['province'] . "',\n '" . $list['city'] . "', '" . $list['district'] . "', '" . $list['sign_building'] . "',\n '" . $list['email'] . "', '" . $list['zipcode'] . "', '" . $list['tel'] . "',\n '" . $list['mobile'] . "', '" . $list['best_time'] . "', '" . $list['postscript'] . "',\n '" . $list['how_oos'] . "', '" . $list['insure_fee'] . "',\n '" . $list['shipping_fee'] . "', '" . $list['update_time'] . "',\n '" . $list['suppliers_id'] . "', '" . GMTIME_UTC . "',\n '" . $list['agency_id'] . "', '" . $list['invoice_no'] . "'\n )";
$GLOBALS['db']->query($sql_back, 'SILENT');
示例4: cancel_order
/**
* 取消一个用户订单
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return void
*/
function cancel_order($order_id, $user_id = 0)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_id, order_sn , surplus , integral , bonus_id, order_status, shipping_status, pay_status, pay_id, money_paid " . " FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $GLOBALS['db']->getRow($sql);
if (empty($order)) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_exist']);
return false;
}
// 如果用户ID大于0,检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add($GLOBALS['_LANG']['no_priv']);
return false;
}
// 订单状态只能是“未确认”
if ($order['order_status'] != OS_UNCONFIRMED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_os_not_unconfirmed']);
return false;
}
$pay_status = PS_UNPAYED;
// 如果已付款,走退款流程
if ($order['pay_status'] == PS_PAYED && $order['money_paid'] > 0) {
//查找paylog
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id = '{$order['order_id']}' AND pay_id = '{$order['pay_id']}' AND is_paid = 1 ORDER BY log_id DESC LIMIT 1";
$paylog = $GLOBALS['db']->getRow($sql);
//退款申请
$refund_data = array('order_id' => $order['order_id'], 'log_id' => $paylog['log_id'], 'outer_sn' => $paylog['outer_sn'], 'pay_id' => $order['pay_id'], 'user_id' => $order['user_id'], 'order_amount' => $order['money_paid'], 'refund_amount' => $order['money_paid'], 'create_time' => time());
$pay_status = PS_REFUNDING;
$payment = payment_info($order['pay_id']);
if ($payment['self_refund'] == 1) {
//支持自助退款
include_once ROOT_PATH . 'include/modules/payment/' . $payment['pay_code'] . '.php';
$pay_obj = new $payment['pay_code']();
$result = $pay_obj->refund($order, unserialize_config($payment['pay_config']));
if (!$result) {
$GLOBALS['err']->add('退款失败,请联系客服处理');
} else {
$pay_status = PS_REFUND;
$refund_data['refund_admin'] = 0;
$refund_data['refund_time'] = time();
$refund_data['finish_time'] = time();
$refund_data['status'] = 2;
//TODO:发送微信模板消息或短信通知
}
} else {
$GLOBALS['err']->add('等待客服审核退款申请');
}
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('refund_apply'), $refund_data, 'INSERT');
}
//将用户订单设置为取消
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET order_status = " . OS_CANCELED . ", pay_status = " . $pay_status . " WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
/* 记录log */
order_action($order['order_sn'], OS_CANCELED, $order['shipping_status'], PS_UNPAYED, $GLOBALS['_LANG']['buyer_cancel'], 'buyer');
/* 退货用户余额、积分、红包 */
if ($order['user_id'] > 0 && $order['surplus'] > 0) {
$change_desc = sprintf($GLOBALS['_LANG']['return_surplus_on_cancel'], $order['order_sn']);
log_account_change($order['user_id'], $order['surplus'], 0, 0, 0, $change_desc);
}
if ($order['user_id'] > 0 && $order['integral'] > 0) {
$change_desc = sprintf($GLOBALS['_LANG']['return_integral_on_cancel'], $order['order_sn']);
log_account_change($order['user_id'], 0, 0, 0, $order['integral'], $change_desc);
}
if ($order['user_id'] > 0 && $order['bonus_id'] > 0) {
change_user_bonus($order['bonus_id'], $order['order_id'], false);
}
/* 如果使用库存,且下订单时减库存,则增加库存 */
if ($GLOBALS['_CFG']['use_storage'] == '1' && $GLOBALS['_CFG']['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id'], false, 1);
}
/* 修改订单 */
$arr = array('bonus_id' => 0, 'bonus' => 0, 'integral' => 0, 'integral_money' => 0, 'surplus' => 0);
update_order($order['order_id'], $arr);
return true;
} else {
return false;
}
}
示例5: cancel_order
/**
* 取消一个用户订单
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
* @param int $action 取消类型
*
* @return void
*/
function cancel_order($order_id, $user_id = 0, $action = OS_CANCELED)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_id, order_sn , surplus , integral , bonus_id, order_status, shipping_status, pay_status, pay_id, money_paid " . " FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $GLOBALS['db']->GetRow($sql);
if (empty($order)) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_exist']);
return false;
}
// 如果用户ID大于0,检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add($GLOBALS['_LANG']['no_priv']);
return false;
}
// 订单状态只能是“未确认”
if ($order['order_status'] != OS_UNCONFIRMED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_os_not_unconfirmed']);
return false;
}
// 如果已付款,走退款流程
if ($order['pay_status'] == PS_PAYED && $order['money_paid'] > 0) {
$payment = payment_info($order['pay_id']);
include_once ROOT_PATH . 'include/modules/payment/' . $payment['pay_code'] . '.php';
$pay_obj = new $payment['pay_code']();
$result = $pay_obj->refund($order, unserialize_config($payment['pay_config']));
if (!$result) {
$GLOBALS['err']->add('退款失败,请联系客服处理。');
return false;
}
}
//将用户订单设置为取消
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET order_status = '{$action}', pay_status = " . PS_UNPAYED . " WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
/* 记录log */
order_action($order['order_sn'], $action, $order['shipping_status'], PS_UNPAYED, $GLOBALS['_LANG']['buyer_cancel'], 'buyer');
/* 退货用户余额、积分、红包 */
if ($order['user_id'] > 0 && $order['surplus'] > 0) {
$change_desc = sprintf($GLOBALS['_LANG']['return_surplus_on_cancel'], $order['order_sn']);
log_account_change($order['user_id'], $order['surplus'], 0, 0, 0, $change_desc);
}
if ($order['user_id'] > 0 && $order['integral'] > 0) {
$change_desc = sprintf($GLOBALS['_LANG']['return_integral_on_cancel'], $order['order_sn']);
log_account_change($order['user_id'], 0, 0, 0, $order['integral'], $change_desc);
}
if ($order['user_id'] > 0 && $order['bonus_id'] > 0) {
change_user_bonus($order['bonus_id'], $order['order_id'], false);
}
/* 如果使用库存,且下订单时减库存,则增加库存 */
if ($GLOBALS['_CFG']['use_storage'] == '1' && $GLOBALS['_CFG']['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id'], false, 1);
}
/* 修改订单 */
$arr = array('bonus_id' => 0, 'bonus' => 0, 'integral' => 0, 'integral_money' => 0, 'surplus' => 0);
update_order($order['order_id'], $arr);
return true;
} else {
die($GLOBALS['db']->errorMsg());
}
}
示例6: cancel_ps_order
/**
* 取消一个用户的预售订单
*
* @access public
* @param int $order_id
* 订单ID
* @param int $user_id
* 用户ID
*
* @return void
*/
function cancel_ps_order($order_id, $user_id = 0)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_id, order_sn , surplus , integral , bonus_id, order_status, shipping_status, pay_status FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}' and extension_code = '" . PRE_SALE_CODE . "'";
$order = $GLOBALS['db']->GetRow($sql);
if (empty($order)) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_exist']);
return false;
}
// 如果用户ID大于0,检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add($GLOBALS['_LANG']['no_priv']);
return false;
}
// 订单状态只能是“未确认”或“已确认”
if ($order['order_status'] != OS_UNCONFIRMED && $order['order_status'] != OS_CONFIRMED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_os_not_unconfirmed']);
return false;
}
// 发货状态只能是“未发货”
if ($order['shipping_status'] != SS_UNSHIPPED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_ss_not_cancel']);
return false;
}
// 如果付款状态是“已付款”、“付款中”,不允许取消,要取消和商家联系
if ($order['pay_status'] != PS_UNPAYED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_ps_not_cancel']);
return false;
}
// 将用户订单设置为取消
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET order_status = '" . OS_CANCELED . "' WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
/* 载入语言文件 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php';
// 记录log
$note = $GLOBALS['_LANG']['ps_timeout_system_cancel'];
order_action($order['order_sn'], OS_CANCELED, $order['shipping_status'], PS_UNPAYED, $note, 'system');
/**
* // 退货用户余额、积分、红包
* if ($order['user_id'] > 0 && $order['surplus'] > 0)
* {
* $change_desc = sprintf($GLOBALS['_LANG']['return_surplus_on_cancel'],
* $order['order_sn']);
* log_account_change($order['user_id'], $order['surplus'], 0, 0, 0,
* $change_desc);
* }
* if ($order['user_id'] > 0 && $order['integral'] > 0)
* {
* $change_desc =
* sprintf($GLOBALS['_LANG']['return_integral_on_cancel'],
* $order['order_sn']);
* log_account_change($order['user_id'], 0, 0, 0, $order['integral'],
* $change_desc);
* }
* if ($order['user_id'] > 0 && $order['bonus_id'] > 0)
* {
* change_user_bonus($order['bonus_id'], $order['order_id'], false);
* }
*/
// 如果使用库存,且下订单时减库存,则增加库存
if ($GLOBALS['_CFG']['use_storage'] == '1' && $GLOBALS['_CFG']['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id'], false, 1);
}
/**
* // 修改订单
* $arr = array(
* 'bonus_id' => 0,
* 'bonus' => 0,
* 'integral' => 0,
* 'integral_money' => 0,
* 'surplus' => 0
* );
* update_order($order['order_id'], $arr);
*/
return true;
} else {
die($GLOBALS['db']->errorMsg());
}
}
示例7: order_action
}
/* 记录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']);
/* 计算并退回积分 */
$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']));
/* todo 计算并退回红包 */
return_order_bonus($order_id);
}
/* 如果使用库存,则增加库存(不论何时减库存都需要) */
if ($_CFG['use_storage'] == '1') {
change_order_goods_storage($order['order_id'], false);
}
/* 退货用户余额、积分、红包 */
return_user_surplus_integral_bonus($order);
/* 清除缓存 */
clear_cache_files();
} elseif ('after_service' == $operation) {
/* 记录log */
order_action($order['order_sn'], $order['order_status'], $order['shipping_status'], $order['pay_status'], '[' . $_LANG['op_after_service'] . '] ' . $action_note);
} else {
die('invalid params');
}
/* 操作成功 */
$links[] = array('text' => $_LANG['order_info'], 'href' => 'order.php?act=info&order_id=' . $order_id);
sys_msg($_LANG['act_ok'] . $msg, 0, $links);
} elseif ($_REQUEST['act'] == 'json') {
示例8: log_account_change
/* 插入订单商品 */
$sql = "INSERT INTO " . $ecs->table('order_goods') . "( " . "order_id, goods_id, goods_name, goods_sn, goods_number, market_price, " . "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift) " . " SELECT '{$new_order_id}', goods_id, goods_name, goods_sn, goods_number, market_price, " . "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift " . " FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '{$flow_type}'";
$db->query($sql);
/* 处理余额、积分、红包 */
if ($order['user_id'] > 0 && $order['surplus'] > 0) {
log_account_change($order['user_id'], $order['surplus'] * -1, 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn']));
}
if ($order['user_id'] > 0 && $order['integral'] > 0) {
log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * -1, sprintf($_LANG['pay_order'], $order['order_sn']));
}
if ($order['bonus_id'] > 0 && $temp_amout > 0) {
use_bonus($order['bonus_id'], $new_order_id);
}
/* 如果使用库存,且下订单时减库存,则减少库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) {
change_order_goods_storage($order['order_id']);
}
/* 给商家发邮件 */
/* 增加是否给客服发送邮件选项 */
if ($_CFG['send_service_email'] && $_CFG['service_email'] != '') {
$tpl = get_mail_template('remind_of_new_order');
$smarty->assign('order', $order);
$smarty->assign('goods_list', $cart_goods);
$smarty->assign('shop_name', $_CFG['shop_name']);
$smarty->assign('send_date', date($_CFG['time_format']));
$content = $smarty->fetch('str:' . $tpl['template_content']);
send_mail($_CFG['shop_name'], $_CFG['service_email'], $tpl['template_subject'], $content, $tpl['is_html']);
}
/* 如果需要,发短信 */
if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '') {
include_once 'includes/cls_sms.php';