本文整理汇总了PHP中order_action函数的典型用法代码示例。如果您正苦于以下问题:PHP order_action函数的具体用法?PHP order_action怎么用?PHP order_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了order_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$sql = 'SELECT * FROM ' . $ecs->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $db->getRow($sql);
if (empty($order)) {
$msg = $_LANG['order_not_exists'];
} elseif ($order['shipping_status'] == SS_RECEIVED) {
$msg = $_LANG['order_already_received'];
} elseif ($order['shipping_status'] != SS_SHIPPED) {
$msg = $_LANG['order_invalid'];
} elseif ($order['consignee'] != $consignee) {
$msg = $_LANG['order_invalid'];
} else {
/* 修改订单发货状态为“确认收货” */
$sql = "UPDATE " . $ecs->table('order_info') . " SET shipping_status = '" . SS_RECEIVED . "' WHERE order_id = '{$order_id}'";
$db->query($sql);
/* 记录日志 */
order_action($order['order_sn'], $order['order_status'], SS_RECEIVED, $order['pay_status'], '', $_LANG['buyer']);
$msg = $_LANG['act_ok'];
}
/* 显示模板 */
assign_template();
$position = assign_ur_here();
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
$smarty->assign('categories', get_categories_tree());
// 分类树
$smarty->assign('helps', get_shop_help());
// 网店帮助
assign_dynamic('receive');
$smarty->assign('msg', $msg);
示例2: cancel_delivery
function cancel_delivery($order_id, $delivery_id)
{
global $db, $ecs;
/* 取得参数 */
$delivery = '';
/* 根据发货单id查询发货单信息 */
if (!empty($delivery_id)) {
$delivery_order = delivery_order_info($delivery_id);
} else {
sys_msg('订单号不能为空!', 1);
}
/* 查询订单信息 */
$order = order_info($order_id);
/* 取消当前发货单物流单号 */
$_delivery['invoice_no'] = '';
$_delivery['status'] = 2;
$query = $db->autoExecute($ecs->table('delivery_order'), $_delivery, 'UPDATE', "delivery_id = {$delivery_id}", 'SILENT');
if (!$query) {
/* 操作失败 */
$links[] = array('text' => $GLOBALS['_LANG']['delivery_sn'] . $GLOBALS['_LANG']['detail'], 'href' => 'order.php?act=delivery_info&delivery_id=' . $delivery_id);
sys_msg($GLOBALS['_LANG']['act_false'], 1, $links);
exit;
}
/* 修改定单发货单号 */
$invoice_no_order = explode('<br>', $order['invoice_no']);
$invoice_no_delivery = explode('<br>', $delivery_order['invoice_no']);
foreach ($invoice_no_order as $key => $value) {
$delivery_key = array_search($value, $invoice_no_delivery);
if ($delivery_key !== false) {
unset($invoice_no_order[$key], $invoice_no_delivery[$delivery_key]);
if (count($invoice_no_delivery) == 0) {
break;
}
}
}
$_order['invoice_no'] = implode('<br>', $invoice_no_order);
/* 更新配送状态 */
$order_finish = get_all_delivery_finish($order_id);
$shipping_status = $order_finish == -1 ? SS_SHIPPED_PART : SS_SHIPPED_ING;
$arr['shipping_status'] = $shipping_status;
if ($shipping_status == SS_SHIPPED_ING) {
$arr['shipping_time'] = '';
// 发货时间
}
$arr['invoice_no'] = $_order['invoice_no'];
update_order($order_id, $arr);
/* 发货单取消发货记录log */
order_action($order['order_sn'], $order['order_status'], $shipping_status, $order['pay_status'], $action_note, null, 1);
/* 如果使用库存,则增加库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_SHIP) {
// 检查此单发货商品数量
$virtual_goods = array();
$delivery_stock_sql = "SELECT DG.goods_id, DG.product_id, DG.is_real, SUM(DG.send_number) AS sums\r\n FROM " . $GLOBALS['ecs']->table('delivery_goods') . " AS DG\r\n WHERE DG.delivery_id = '{$delivery_id}'\r\n GROUP BY DG.goods_id ";
$delivery_stock_result = $GLOBALS['db']->getAll($delivery_stock_sql);
foreach ($delivery_stock_result as $key => $value) {
/* 虚拟商品 */
if ($value['is_real'] == 0) {
continue;
}
//(货品)
if (!empty($value['product_id'])) {
$minus_stock_sql = "UPDATE " . $GLOBALS['ecs']->table('products') . "\r\n SET product_number = product_number + " . $value['sums'] . "\r\n WHERE product_id = " . $value['product_id'];
$GLOBALS['db']->query($minus_stock_sql, 'SILENT');
}
$minus_stock_sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . "\r\n SET goods_number = goods_number + " . $value['sums'] . "\r\n WHERE goods_id = " . $value['goods_id'];
$GLOBALS['db']->query($minus_stock_sql, 'SILENT');
}
}
/* 发货单全退回时,退回其它 */
if ($order['order_status'] == SS_SHIPPED_ING) {
/* 如果订单用户不为空,计算积分,并退回 */
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($GLOBALS['_LANG']['return_order_gift_integral'], $order['order_sn']));
/* todo 计算并退回红包 */
return_order_bonus($order_id);
}
}
/* 清除缓存 */
clear_cache_files();
/* 操作成功 */
$links[] = array('text' => $GLOBALS['_LANG']['delivery_sn'] . $GLOBALS['_LANG']['detail'], 'href' => 'order.php?act=delivery_info&delivery_id=' . $delivery_id);
sys_msg($GLOBALS['_LANG']['act_ok'], 0, $links);
}
示例3: affirm_received
/**
* 确认一个用户订单
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return bool $bool
*/
function affirm_received($order_id, $user_id = 0)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_sn , order_status, shipping_status, pay_status FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $GLOBALS['db']->GetRow($sql);
// 如果用户ID大于 0 。检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add($GLOBALS['_LANG']['no_priv']);
return false;
} elseif ($order['shipping_status'] == SS_RECEIVED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_already_received']);
return false;
} elseif ($order['shipping_status'] != SS_SHIPPED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_invalid']);
return false;
} else {
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET shipping_status = '" . SS_RECEIVED . "',shipping_time_end = '" . gmtime() . "' WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
$sql_2 = "SELECT back_id FROM " . $GLOBALS['ecs']->table('back_order') . " WHERE order_id = '{$order_id}' AND status_back < 6 AND status_back != 3";
$re_2 = $GLOBALS['db']->getCol($sql_2);
if (count($re_2) > 0) {
$sql_3 = "UPDATE " . $GLOBALS['ecs']->table('back_goods') . " SET status_back = 8 WHERE back_id in (" . implode(',', $re_2) . ")";
$GLOBALS['db']->query($sql_3);
}
$sql_4 = "UPDATE " . $GLOBALS['ecs']->table('back_order') . " SET status_back = 8 WHERE order_id = '{$order_id}' AND status_back < 6 AND status_back != 3";
$GLOBALS['db']->query($sql_4);
/* 记录日志 */
order_action($order['order_sn'], $order['order_status'], SS_RECEIVED, $order['pay_status'], '', $GLOBALS['_LANG']['buyer']);
return true;
} else {
die($GLOBALS['db']->errorMsg());
}
}
}
示例4: respond
/**
* 處理函數
*/
function respond()
{
$arPayment = get_payment('ecshop_allpay_atm');
$isTestMode = $arPayment['ecshop_allpay_atm_test_mode'] == 'Yes';
$arFeedback = null;
$arQueryFeedback = null;
$szLogID = $_GET['log_id'];
$szOrderID = $_GET['order_id'];
//$isPaymentInfo = ($_GET['pi'] == 'true');
$this->HashKey = trim($arPayment['ecshop_allpay_atm_key']);
$this->HashIV = trim($arPayment['ecshop_allpay_atm_iv']);
try {
// 取得回傳的付款結果。
$arFeedback = $this->CheckOutFeedback();
if (sizeof($arFeedback) > 0) {
// 查詢付款結果資料。
$this->ServiceURL = $isTestMode ? "https://payment-stage.allpay.com.tw/Cashier/QueryTradeInfo/v2" : "https://payment.allpay.com.tw/Cashier/QueryTradeInfo/V2";
$this->MerchantID = trim($arPayment['ecshop_allpay_atm_account']);
$this->Query['MerchantTradeNo'] = $arFeedback['MerchantTradeNo'];
$arQueryFeedback = $this->QueryTradeInfo();
if (sizeof($arQueryFeedback) > 0) {
$arOrder = order_info($szOrderID);
// 檢查支付金額與訂單是否相符。
if (round($arOrder['order_amount']) == $arFeedback['TradeAmt'] && $arQueryFeedback['TradeAmt'] == $arFeedback['TradeAmt']) {
$szCheckAmount = '1';
}
// 確認產生虛擬帳號。
if ($arFeedback['RtnCode'] == '2' && $szCheckAmount == '1' && $arQueryFeedback["TradeStatus"] == '0') {
$szPaymentType = $arFeedback['PaymentType'];
$szTradeDate = $arFeedback['TradeDate'];
$szBankCode = $arFeedback['BankCode'];
$szVirtualAccount = $arFeedback['vAccount'];
$szExpireDate = $arFeedback['ExpireDate'];
$szNote = sprintf($GLOBALS['_LANG']['text_paying'], date("Y-m-d H:i:s"), $szPaymentType, $szTradeDate, $szBankCode, $szVirtualAccount, $szExpireDate);
// 變更訂單狀態為已確認
update_order($szOrderID, array('order_status' => OS_CONFIRMED, 'confirm_time' => gmtime()));
// 將付款資訊記入操作訊息
order_action($arOrder['order_sn'], OS_CONFIRMED, $arOrder['shipping_status'], $arOrder['pay_status'], $szNote);
ob_get_clean();
print '1|OK';
exit;
}
// 確認付款結果。
if ($arFeedback['RtnCode'] == '1' && $szCheckAmount == '1' && $arQueryFeedback["TradeStatus"] == '1') {
$szNote = $GLOBALS['_LANG']['text_paid'] . date("Y-m-d H:i:s");
order_paid($szLogID, PS_PAYED, $szNote);
if ($_GET['background']) {
echo '1|OK';
exit;
} else {
return true;
}
} else {
if ($_GET['background']) {
echo !$szCheckAmount ? '0|訂單金額不符。' : $arFeedback['RtnMsg'];
exit;
} else {
return false;
}
}
} else {
throw new Exception('AllPay 查無訂單資料。');
}
}
} catch (Exception $ex) {
/* 例外處理 */
}
return false;
}
示例5: unset
unset($m, $menu, $newmenu);
//
// Actions
//
base_action($core);
if ($core->user->level == 1) {
admin_action($core);
}
if ($core->user->comp && $core->user->compad) {
company_action($core);
}
if ($core->user->work == -2) {
referal_action($core);
}
if ($core->user->work >= 1) {
order_action($core);
}
if ($core->user->work == 0 || $core->user->work == 2) {
webmaster_action($core);
}
//
// Modules
//
if ($core->user->level == 1) {
admin_module($core);
}
base_module($core);
if ($core->user->comp && $core->user->compad) {
company_module($core);
}
if ($core->user->work >= 1) {
示例6: IN
$back_id = $GLOBALS['db']->insert_id();
$sql_back_goods = "INSERT INTO " . $ecs->table('back_goods') . " (back_id, goods_id, product_id, product_sn, goods_name,goods_sn, is_real, send_number, goods_attr)\n SELECT '{$back_id}', goods_id, product_id, product_sn, goods_name, goods_sn, is_real, send_number, goods_attr\n FROM " . $ecs->table('delivery_goods') . "\n WHERE delivery_id = " . $list['delivery_id'];
$GLOBALS['db']->query($sql_back_goods, 'SILENT');
}
}
/* 修改订单的发货单状态为退货 */
$sql_delivery = "UPDATE " . $ecs->table('delivery_order') . "\n SET status = 1\n WHERE status IN (0, 2)\n AND order_id = " . $order['order_id'];
$GLOBALS['db']->query($sql_delivery, 'SILENT');
/* 将订单的商品发货数量更新为 0 */
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_goods') . "\n SET send_number = 0\n WHERE order_id = '{$order_id}'";
$GLOBALS['db']->query($sql, 'SILENT');
/* 清除缓存 */
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, $_SESSION['supplier_name']);
} 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') {
include_once ROOT_PATH . 'includes/cls_json.php';
$json = new JSON();
$func = $_REQUEST['func'];
if ($func == 'get_goods_info') {
/* 取得商品信息 */
$goods_id = $_REQUEST['goods_id'];
$sql = "SELECT goods_id, c.cat_name, goods_sn, goods_name, b.brand_name, " . "goods_number, market_price, shop_price, promote_price, " . "promote_start_date, promote_end_date, goods_brief, goods_type, is_promote " . "FROM " . $ecs->table('goods') . " AS g " . "LEFT JOIN " . $ecs->table('brand') . " AS b ON g.brand_id = b.brand_id " . "LEFT JOIN " . $ecs->table('category') . " AS c ON g.cat_id = c.cat_id " . " WHERE goods_id = '{$goods_id}'";
$goods = $db->getRow($sql);
示例7: 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());
}
}
示例8: 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($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['order_status'] == OS_CONFIRMED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['current_os_already_confirmed']);
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)) {
/* 记录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 {
die($GLOBALS['db']->errorMsg());
}
}
示例9: order_paid
/**
* 修改订单的支付状态
*
* @access public
* @param string $log_id 支付编号
* @param integer $pay_status 状态
* @param string $note 备注
* @return void
*/
function order_paid($log_id, $pay_status = PS_PAYED, $note = '')
{
/* 取得支付编号 */
$log_id = intval($log_id);
if ($log_id > 0) {
/* 取得要修改的支付记录信息 */
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE log_id = '{$log_id}'";
$pay_log = $GLOBALS['db']->getRow($sql);
if (!empty($pay_log) && $pay_log['is_paid'] == 0) {
/* 修改此次支付操作的状态为已付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '1' WHERE log_id = '{$log_id}'";
$GLOBALS['db']->query($sql);
/* 根据记录类型做相应处理 */
if ($pay_log['order_type'] == PAY_ORDER) {
/* 取得订单信息 */
$sql = 'SELECT order_id, user_id, order_sn, consignee, address, tel, shipping_id, extension_code, extension_id, goods_amount ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$pay_log['order_id']}'";
$order = $GLOBALS['db']->getRow($sql);
$order_id = $order['order_id'];
$order_sn = $order['order_sn'];
/* 修改订单状态为已付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET pay_status = '{$pay_status}', " . " pay_time = '" . gmtime() . "', " . " money_paid = order_amount," . " order_amount = 0 " . "WHERE order_id = '{$order_id}'";
$GLOBALS['db']->query($sql);
/* 记录订单操作记录 */
order_action($order_sn, OS_UNCONFIRMED, SS_UNSHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
/* 如果需要,发短信 */
/*if ($GLOBALS['_CFG']['sms_order_payed'] == '1' && $GLOBALS['_CFG']['sms_shop_mobile'] != '')
{
include_once(ROOT_PATH.'include/cls_sms.php');
$sms = new sms();
$sms_error = array();
if(!$sms->send($GLOBALS['_CFG']['sms_shop_mobile'], sprintf($GLOBALS['_LANG']['order_payed_sms'], $order_sn, $order['consignee'], $order['tel']), $sms_error)){
echo $sms_error;
}
}*/
// 检查限时抢购促销数量
$sql = "select f.id, f.promote_num, sum(b.goods_number) AS sale_num FROM " . $GLOBALS['ecs']->table('order_goods', 'a') . "," . $GLOBALS['ecs']->table('order_goods', 'b') . "," . $GLOBALS['ecs']->table('order_info', 'o') . "," . $GLOBALS['ecs']->table('flash_sale', 'f') . " WHERE a.extension_code = b.extension_code AND a.extension_id = b.extension_id AND f.id = a.extension_id AND " . " o.order_id = b.order_id AND o.pay_status = " . PS_PAYED . " AND a.extension_code = 'flash_sale' AND a.order_id = '{$order_id}' " . " GROUP BY a.extension_id";
$result = $GLOBALS['db']->getAll($sql);
if (!empty($result)) {
foreach ($result as $flash) {
if ($flash['promote_num'] > 0 && $flash['promote_num'] <= $flash['sale_num']) {
$sql = "UPDATE " . $GLOBALS['ecs']->table('flash_sale') . " SET is_on_sale = 0 WHERE id = '{$flash['id']}'";
$GLOBALS['db']->query($sql);
}
}
}
/* 对虚拟商品的支持 */
$virtual_goods = get_virtual_goods($order_id);
if (!empty($virtual_goods)) {
$msg = '';
if (!virtual_goods_ship($virtual_goods, $msg, $order_sn, true)) {
$GLOBALS['_LANG']['pay_success'] .= '<div style="color:red;">' . $msg . '</div>' . $GLOBALS['_LANG']['virtual_goods_ship_fail'];
}
/* 如果订单没有配送方式,自动完成发货操作 */
if ($order['shipping_id'] == -1) {
/* 将订单标识为已发货状态,并记录发货记录 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET shipping_status = '" . SS_SHIPPED . "', shipping_time = '" . gmtime() . "'" . " WHERE order_id = '{$order_id}'";
$GLOBALS['db']->query($sql);
/* 记录订单操作记录 */
order_action($order_sn, OS_CONFIRMED, SS_SHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
$integral = integral_to_give($order);
log_account_change($order['user_id'], 0, 0, intval($integral['rank_points']), intval($integral['custom_points']), sprintf($GLOBALS['_LANG']['order_gift_integral'], $order['order_sn']));
}
}
} elseif ($pay_log['order_type'] == PAY_SURPLUS) {
$sql = 'SELECT `id` FROM ' . $GLOBALS['ecs']->table('user_account') . " WHERE `id` = '{$pay_log['order_id']}' AND `is_paid` = 1 LIMIT 1";
$res_id = $GLOBALS['db']->getOne($sql);
if (empty($res_id)) {
/* 更新会员预付款的到款状态 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_account') . " SET paid_time = '" . gmtime() . "', is_paid = 1" . " WHERE id = '{$pay_log['order_id']}' LIMIT 1";
$GLOBALS['db']->query($sql);
/* 取得添加预付款的用户以及金额 */
$sql = "SELECT user_id, amount FROM " . $GLOBALS['ecs']->table('user_account') . " WHERE id = '{$pay_log['order_id']}'";
$arr = $GLOBALS['db']->getRow($sql);
/* 修改会员帐户金额 */
$_LANG = array();
include_once ROOT_PATH . 'lang/' . $GLOBALS['_CFG']['lang'] . '/user.php';
log_account_change($arr['user_id'], $arr['amount'], 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING);
}
}
}
}
}
示例10: cancel_delivery
function cancel_delivery($order_id, $delivery_id)
{
global $db, $ecs, $_CFG;
/* 取得参数 */
$delivery = '';
/* 根据发货单id查询发货单信息 */
if (!empty($delivery_id)) {
$delivery_order = delivery_order_info($delivery_id);
} else {
sys_msg('订单号不能为空!', 1);
}
/* 查询订单信息 */
$order = order_info($order_id);
/* 取消当前发货单物流单号 */
$_delivery['invoice_no'] = '';
$_delivery['status'] = 2;
$query = $db->autoExecute($ecs->table('delivery_order'), $_delivery, 'UPDATE', "delivery_id = {$delivery_id}", 'SILENT');
if (!$query) {
/* 操作失败 */
$links[] = array('text' => $GLOBALS['_LANG']['delivery_sn'] . $GLOBALS['_LANG']['detail'], 'href' => 'order.php?act=delivery_info&delivery_id=' . $delivery_id);
sys_msg($GLOBALS['_LANG']['act_false'], 1, $links);
exit;
}
/* 修改定单发货单号 */
$invoice_no_order = explode('<br>', $order['invoice_no']);
$invoice_no_delivery = explode('<br>', $delivery_order['invoice_no']);
foreach ($invoice_no_order as $key => $value) {
$delivery_key = array_search($value, $invoice_no_delivery);
if ($delivery_key !== false) {
unset($invoice_no_order[$key], $invoice_no_delivery[$delivery_key]);
if (count($invoice_no_delivery) == 0) {
break;
}
}
}
$_order['invoice_no'] = implode('<br>', $invoice_no_order);
/* 更新配送状态 */
$order_finish = get_all_delivery_finish($order_id);
$shipping_status = $order_finish == -1 ? SS_SHIPPED_PART : SS_SHIPPED_ING;
$arr['shipping_status'] = $shipping_status;
if ($shipping_status == SS_SHIPPED_ING) {
$arr['shipping_time'] = '';
// 发货时间
}
$arr['invoice_no'] = $_order['invoice_no'];
update_order($order_id, $arr);
/* 发货单取消发货记录log */
order_action($order['order_sn'], $order['order_status'], $shipping_status, $order['pay_status'], $action_note, null, 1);
/* 如果使用库存,则增加库存 */
/* 代码增加_start By morestock_morecity */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_SHIP) {
$delivery_stock_sql = "SELECT * FROM " . $GLOBALS['ecs']->table('delivery_goods') . " WHERE delivery_id = '{$delivery_id}' ";
$delivery_stock_result = $GLOBALS['db']->getAll($delivery_stock_sql);
$store_error = '';
//$goods_attr_id = get_goods_attr_id($value['goods_id'], $value['goods_attr']);
$store_id_zhyh = get_storeid_by_ssq($order['province'], $order['city'], $order['district'], $order['xiangcun'], $order['supplier_id']);
if (!$store_id_zhyh) {
$store_error = '该发货单没有对应仓库!';
}
if ($store_error) {
sys_msg($store_error);
} else {
foreach ($delivery_stock_result as $key => $value) {
$goods_attr_id = get_goods_attr_id($value['goods_id'], $value['goods_attr']);
$store_row = get_storeid_youhuo($order['province'], $order['city'], $order['district'], $order['xiangcun'], $value['goods_id'], $goods_attr_id, $order['supplier_id'], $order_id);
$add_time = gmtime();
$add_date = local_date('Ymd');
$sql = "select max(today_sn) from " . $ecs->table('store_inout_list') . " where inout_mode=2 and add_date='{$add_date}' ";
$inout_count = $db->getOne($sql);
$inout_sn = $inout_count ? intval($inout_count + 1) : 1;
$today_sn = $inout_sn;
$inout_sn = str_pad($inout_sn, 4, "0", STR_PAD_LEFT);
$inout_sn = 'rk' . $add_date . $inout_sn;
$stock_type_id = 0;
if ($order['supplier_id'] > 0) {
$stock_type_id = $db->getOne('select type from ' . $ecs->table('store_type') . " where supplier_id=" . $order['supplier_id']);
}
$sql = "insert into " . $ecs->table('store_inout_list') . "(inout_sn, inout_status, store_id, adminer_id, inout_type, inout_mode, order_sn, " . "takegoods_man, today_sn, add_date, add_time, supplier_id, store_type_id) " . "values('{$inout_sn}', '3', '{$store_row['store_id']}', '{$_SESSION['supplier_user_id']}', '5', '2', '{$order['order_sn']}', " . "'{$_SESSION['supplier_name']}', '{$today_sn}' , '{$add_date}', '{$add_time}','{$order['supplier_id']}', '{$stock_type_id}' ) ";
$db->query($sql);
$inout_rec_id = $db->insert_id();
$sql = "insert into " . $ecs->table('store_inout_goods') . "(inout_rec_id, goods_id, goods_sn, attr_value, inout_mode, number_yingshou, number_shishou, supplier_id, store_type_id) " . "values('{$inout_rec_id}', '{$value['goods_id']}', '{$value['goods_sn']}', '{$goods_attr_id}', '2', '{$value['send_number']}', '{$value['send_number']}','{$order['supplier_id']}', '{$stock_type_id}') ";
$db->query($sql);
$upre = update_stock_in($inout_rec_id, $store_row['store_id']);
//更新库存表
}
}
}
/* 代码增加_end By morestock_morecity */
/* 发货单全退回时,退回其它 */
if ($order['order_status'] == SS_SHIPPED_ING) {
/* 如果订单用户不为空,计算积分,并退回 */
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($GLOBALS['_LANG']['return_order_gift_integral'], $order['order_sn']));
/* todo 计算并退回红包 */
return_order_bonus($order_id);
}
//.........这里部分代码省略.........
示例11: foreach
if ($n['goods_id'] == $id) {
$n['goods_num'] = $gnums[$j];
$ngoodslist[] = $n;
}
}
}
$totalprice = 0;
foreach ($goodslist as $g) {
$totalprice += $g['shop_price'];
}
$order = array('order_sn' => get_order_sn(), 'user_id' => $taocan['user_id'], 'shipping_name' => '黑猫宅急便', 'shipping_id' => 2, 'order_status' => OS_CONFIRMED, 'shipping_status' => SS_UNSHIPPED, 'pay_status' => PS_PAYED, 'consignee' => $taocan['consignee'], 'country' => $taocan['country'], 'province' => $taocan['province'], 'city' => $taocan['city'], 'district' => $taocan['district'], 'address' => $taocan['address'], 'zipcode' => $taocan['zipcode'], 'tel' => '', 'mobile' => $taocan['mobile'], 'email' => $taocan['email'], 'best_time' => local_date('Y-m-d', gmstr2time("1 day")) . " " . $taocan['halfday'], 'sign_building' => '', 'email' => $taocan['email'], 'pay_id' => '4', 'pay_name' => '余额支付', 'goods_amount' => $totalprice, 'money_paid' => $ordertotalprice, 'order_amount' => $ordertotalprice, 'referer' => '用户套餐自动生成', 'add_time' => gmtime(), 'confirm_time' => gmtime(), 'pay_time' => gmtime(), 'shipping_time' => gmtime(), 'discount' => $totalprice - $ordertotalprice);
// Add by Edward
//fwrite($james,"订单号:".get_order_sn()."--用户ID:".$taocan['user_id']."——收货人:".$taocan['consignee']."\n");
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $order, 'INSERT');
$new_order_id = $db->insert_id();
foreach ($ngoodslist as $goods) {
$ogoods = array('order_id' => $new_order_id, 'goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'goods_sn' => $goods['goods_sn'], 'product_id' => '0', 'goods_number' => $goods['goods_num'], 'goods_price' => $goods['shop_price'], 'goods_attr' => '', 'send_number' => '0', 'is_real' => '1', 'extension_code' => '', 'parent_id' => '', 'is_gift' => '0', 'goods_attr_id' => '');
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_goods'), $ogoods, 'INSERT');
}
//添加日志
order_action($order['order_sn'], OS_CONFIRMED, SS_UNSHIPPED, PS_PAYED, '', '套餐自动生成订单');
log_account_change($order['user_id'], -$ordertotalprice, 0, 0, 0, '用户套餐自动生成订单:' . $order['order_sn'] . ',自动扣除', ACT_OTHER);
$db->query("update " . $ecs->table("user_tc_goods") . " set weeks = " . $weeks . " where id=" . $taocan['tid']);
}
$db->query("update " . $ecs->table("taocan_job") . " set last_date='" . gmtime() . "', weeks = " . $weeks . "");
}
//fwrite($james, " 结束执行:".local_date('Y-m-d H:i:s')."\n");
//fclose($james);
?>
示例12: affirm_received
/**
* 确认一个用户订单
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return bool $bool
*/
function affirm_received($order_id, $user_id = 0)
{
/* 查询订单信息,检查状态 */
$sql = "SELECT user_id, order_id,order_sn , order_status, shipping_status, pay_status FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
$order = $GLOBALS['db']->GetRow($sql);
// 如果用户ID大于 0 。检查订单是否属于该用户
if ($user_id > 0 && $order['user_id'] != $user_id) {
$GLOBALS['err']->add($GLOBALS['_LANG']['no_priv']);
return false;
} elseif ($order['shipping_status'] == SS_RECEIVED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_already_received']);
return false;
} elseif ($order['shipping_status'] != SS_SHIPPED) {
$GLOBALS['err']->add($GLOBALS['_LANG']['order_invalid']);
return false;
} else {
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info') . " SET shipping_status = '" . SS_RECEIVED . "' WHERE order_id = '{$order_id}'";
if ($GLOBALS['db']->query($sql)) {
/* 记录日志 */
order_action($order['order_sn'], $order['order_status'], SS_RECEIVED, $order['pay_status'], '', $GLOBALS['_LANG']['buyer']);
//by carter 修改子订单状态
$sql = "UPDATE " . $GLOBALS['ecs']->table('order_info2') . " SET shipping_status = '" . SS_RECEIVED . "' WHERE order_id2 = '{$order_id}'";
$GLOBALS['db']->query($sql);
//同步erp, by carter
$sql_update_erp = "UPDATE " . $GLOBALS['erp']->table('order') . " SET r_status=12 " . " WHERE total_r_dh = '" . $order['order_id'] . "'";
$GLOBALS['db']->query($sql_update_erp);
return true;
} else {
die($GLOBALS['db']->errorMsg());
}
}
}
示例13: pos_order_shipping
/**
* 变更订单的发货状态
*
* @access private
* @param string $brand_name
* @return array
*/
function pos_order_shipping($order_id)
{
if (!check_priviege()) {
exit;
}
$operation = 'ship';
/* 查询订单信息 */
$order = order_info($order_id);
/* 检查能否操作 */
$operable_list = operable_list($order);
if (!isset($operable_list[$operation])) {
die('Hacking attempt');
}
if ($order['order_status'] != OS_CONFIRMED) {
$post['order_status'] = OS_CONFIRMED;
$post['confirm_time'] = gmtime();
}
$post['shipping_status'] = SS_SHIPPED;
$post['shipping_time'] = gmtime();
update_order($order_id, $post);
$action_note = '[OrderHelper ' . TUNNELVERSION . '] 打印快递单';
/* 记录log */
order_action($order['order_sn'], OS_CONFIRMED, SS_SHIPPED, $order['pay_status'], $action_note);
}
示例14: order_paid
/**
* 修改订单的支付状态
*
* @access public
* @param string $log_id 支付编号
* @param integer $pay_status 状态
* @param string $note 备注
* @return void
*/
function order_paid($log_id, $pay_status = PS_PAYED, $note = '')
{
/* 取得支付编号 */
$log_id = intval($log_id);
if ($log_id > 0) {
/* 取得要修改的支付记录信息 */
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE log_id = '{$log_id}'";
$pay_log = $GLOBALS['db']->getRow($sql);
if ($pay_log && $pay_log['is_paid'] == 0) {
/* 修改此次支付操作的状态为已付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '1' WHERE log_id = '{$log_id}'";
$GLOBALS['db']->query($sql);
/* 根据记录类型做相应处理 */
if ($pay_log['order_type'] == PAY_ORDER) {
/* 取得订单信息 */
$sql = 'SELECT order_id, order_sn, consignee, address, tel, shipping_id ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$pay_log['order_id']}'";
$order = $GLOBALS['db']->getRow($sql);
$order_id = $order['order_id'];
$order_sn = $order['order_sn'];
/* 修改订单状态为已付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET order_status = '" . OS_CONFIRMED . "', " . " confirm_time = '" . gmtime() . "', " . " pay_status = '{$pay_status}', " . " pay_time = '" . gmtime() . "', " . " money_paid = order_amount," . " order_amount = 0 " . "WHERE order_id = '{$order_id}'";
$GLOBALS['db']->query($sql);
/* 记录订单操作记录 */
order_action($order_sn, OS_CONFIRMED, SS_UNSHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
/* 如果需要,发短信 */
if ($GLOBALS['_CFG']['sms_order_payed'] == '1' && $GLOBALS['_CFG']['sms_shop_mobile'] != '') {
include_once ROOT_PATH . 'includes/cls_sms.php';
$sms = new sms();
$sms->send($GLOBALS['_CFG']['sms_shop_mobile'], sprintf($GLOBALS['_LANG']['order_payed_sms'], $order_sn, $order['consignee'], $order['tel']), 0);
}
/* 对虚拟商品的支持 */
$virtual_goods = get_virtual_goods($order_id);
if (!empty($virtual_goods)) {
$msg = '';
if (!virtual_goods_ship($virtual_goods, $msg, $order_sn, true)) {
$GLOBALS['_LANG']['pay_success'] .= '<div style="color:red;">' . $msg . '</div>' . $GLOBALS['_LANG']['virtual_goods_ship_fail'];
}
/* 如果订单没有配送方式,自动完成发货操作 */
if ($order['shipping_id'] == -1) {
/* 将订单标识为已发货状态,并记录发货记录 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET shipping_status = '" . SS_SHIPPED . "', shipping_time = '" . gmtime() . "'" . " WHERE order_id = '{$order_id}'";
$GLOBALS['db']->query($sql);
/* 记录订单操作记录 */
order_action($order_sn, OS_CONFIRMED, SS_SHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
}
}
} elseif ($pay_log['order_type'] == PAY_SURPLUS) {
/* 更新会员预付款的到款状态 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_account') . " SET paid_time = '" . gmtime() . "', is_paid = 1" . " WHERE id = '{$pay_log['order_id']}' LIMIT 1";
$GLOBALS['db']->query($sql);
/* 取得添加预付款的用户以及金额 */
$sql = "SELECT user_id, amount FROM " . $GLOBALS['ecs']->table('user_account') . " WHERE id = '{$pay_log['order_id']}'";
$arr = $GLOBALS['db']->getRow($sql);
/* 修改会员帐户金额 */
$_LANG = array();
include_once ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/user.php';
log_account_change($arr['user_id'], $arr['amount'], 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING);
}
} else {
/* 取得已发货的虚拟商品信息 */
$post_virtual_goods = get_virtual_goods($pay_log['order_id'], true);
/* 有已发货的虚拟商品 */
if (!empty($post_virtual_goods)) {
$msg = '';
/* 检查两次刷新时间有无超过12小时 */
$sql = 'SELECT pay_time, order_sn FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$pay_log['order_id']}'";
$row = $GLOBALS['db']->getRow($sql);
$intval_time = gmtime() - $row['pay_time'];
if ($intval_time > 0 && $intval_time < 3600 * 12) {
$virtual_card = array();
foreach ($post_virtual_goods as $code => $goods_list) {
/* 只处理虚拟卡 */
if ($code == 'virtual_card') {
foreach ($goods_list as $goods) {
if ($info = virtual_card_result($row['order_sn'], $goods)) {
$virtual_card[] = array('goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'info' => $info);
}
}
$GLOBALS['smarty']->assign('virtual_card', $virtual_card);
}
}
} else {
$msg = '<div>' . $GLOBALS['_LANG']['please_view_order_detail'] . '</div>';
}
$GLOBALS['_LANG']['pay_success'] .= $msg;
}
/* 取得未发货虚拟商品 */
$virtual_goods = get_virtual_goods($pay_log['order_id'], false);
if (!empty($virtual_goods)) {
$GLOBALS['_LANG']['pay_success'] .= '<br />' . $GLOBALS['_LANG']['virtual_goods_ship_fail'];
}
//.........这里部分代码省略.........
示例15: json_encode
echo json_encode(array('errcode' => 10, 'msg' => '没有可以取货的商品'));
exit;
}
// 获取商品
$goods = get_pickup_goods($pids);
if (empty($goods)) {
echo json_encode(array('errcode' => 10, 'msg' => '没有可以取货的商品'));
exit;
}
// Update order status
$orders = get_pickup_orders($pids);
if (!empty($orders)) {
$status = array('shipping_status' => SS_RECEIVED, 'receive_time' => time());
foreach ($orders as &$o) {
update_order($o['order_id'], $status);
order_action($o['order_sn'], OS_CONFIRMED, SS_RECEIVED, PS_PAYED, '门店取货');
}
}
// Update package status
$sql = "UPDATE " . $ecs->table('pickup_pack') . " SET status=3 WHERE id IN (" . implode(',', $pids) . ")";
$db->query($sql);
$response = array('errcode' => 0, 'mobile' => $orders[0]['mobile'], 'goods' => $goods, 'orders' => $orders, 'packs' => $packs);
echo json_encode($response);
exit;
}
$smarty->display(is_wechat_browser() ? 'pickup_wechat.htm' : 'pickup_wechat.htm');
/**
* 检查取货码,返回对应的user_id
*
* @param string $code 取货码
*