本文整理汇总了PHP中order_info函数的典型用法代码示例。如果您正苦于以下问题:PHP order_info函数的具体用法?PHP order_info怎么用?PHP order_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了order_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
/**
* 處理函數
*/
function respond()
{
$arPayment = get_payment('ecshop_allpay_card');
$isTestMode = $arPayment['ecshop_allpay_card_test_mode'] == 'Yes';
$arFeedback = null;
$arQueryFeedback = null;
$szLogID = $_GET['log_id'];
$szOrderID = $_GET['order_id'];
$this->HashKey = trim($arPayment['ecshop_allpay_card_key']);
$this->HashIV = trim($arPayment['ecshop_allpay_card_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_card_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'] == '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;
}
示例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: logResult
//调试用,写文本函数记录程序运行情况是否正常
//logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
echo "success";
//请不要修改或删除
} else {
if ($trade_status == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
//注意:
//该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。
//调试用,写文本函数记录程序运行情况是否正常
//logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
logResult('TRADE_SUCCESS');
logResult('out_trade_no:' . $out_trade_no);
$order = order_info(0, $out_trade_no);
logResult('order:' . $order);
if ($order) {
logResult('order_id:' . $order['order_id']);
$log_id = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER);
logResult('log_id:' . $log_id);
order_paid($log_id, 2);
}
echo "success";
//请不要修改或删除
} else {
logResult('TRADE_STATUS:' . $trade_status);
}
}
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
示例4: respond
/**
* 處理函數
*/
function respond()
{
$arPayment = get_payment('ecshop_ecpay_barcode');
$isTestMode = $arPayment['ecshop_ecpay_barcode_test_mode'] == 'Yes';
$arFeedback = null;
$arQueryFeedback = null;
$szLogID = $_GET['log_id'];
$szOrderID = $_GET['order_id'];
//$isPaymentInfo = ($_GET['pi'] == 'true');
$this->HashKey = trim($arPayment['ecshop_ecpay_barcode_key']);
$this->HashIV = trim($arPayment['ecshop_ecpay_barcode_iv']);
try {
// 取得回傳的付款結果。
$arFeedback = $this->CheckOutFeedback();
if (sizeof($arFeedback) > 0) {
// 查詢付款結果資料。
$this->ServiceURL = $isTestMode ? "https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/v2" : "https://payment.ecpay.com.tw/Cashier/QueryTradeInfo/V2";
$this->MerchantID = trim($arPayment['ecshop_ecpay_barcode_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'] == '10100073' && $szCheckAmount == '1' && $arQueryFeedback["TradeStatus"] == '0') {
$szPaymentType = $arFeedback['PaymentType'];
$szTradeDate = $arFeedback['TradeDate'];
$szBankCode = $arFeedback['PaymentNo'];
$szExpireDate = $arFeedback['ExpireDate'];
$szBarcode1 = $arFeedback['Barcode1'];
$szBarcode2 = $arFeedback['Barcode2'];
$szBarcode3 = $arFeedback['Barcode3'];
$szNote = sprintf($GLOBALS['_LANG']['text_paying'], date("Y-m-d H:i:s"), $szPaymentType, $szTradeDate, $szBankCode, $szExpireDate, $szBarcode1, $szBarcode2, $szBarcode3);
order_paid($szLogID, PS_PAYING, $szNote);
/* 修改此次交易狀態為未付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '0' WHERE log_id = '{$szLogID}'";
$GLOBALS['db']->query($sql);
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('ECPay 查無訂單資料。');
}
}
} catch (Exception $ex) {
/* 例外處理 */
}
return false;
}
示例5: payment_info
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'];
示例6: 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);
}
示例7: 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();
}
示例8: return_order_bonus
/**
* 返回订单发放的红包
* @param int $order_id 订单id
*/
function return_order_bonus($order_id)
{
/* 取得订单应该发放的红包 */
$bonus_list = order_bonus($order_id);
/* 删除 */
if ($bonus_list) {
/* 取得订单信息 */
$order = order_info($order_id);
$user_id = $order['user_id'];
foreach ($bonus_list as $bonus) {
$sql = "DELETE FROM " . $GLOBALS['ecs']->table('user_bonus') . " WHERE bonus_type_id = '{$bonus['type_id']}' " . "AND user_id = '{$user_id}' " . "AND order_id = '0' LIMIT " . $bonus['number'];
$GLOBALS['db']->query($sql);
}
}
}
示例9: action_chat
function action_chat()
{
$user_id = $_SESSION['user_id'];
$smarty = get_smarty();
$ecs = get_ecs();
$db = get_database();
/**
* 判断当前用户是为聊天系统的注册用户
*/
$exist = check_of_username_exist($user_id);
// 获取用户头像
if (!empty($user_id)) {
$sql = "select password, headimg from " . $ecs->table('users') . " where user_id = '{$user_id}'";
$row = $db->getRow($sql);
$headimg = $row['headimg'];
$password = $row['password'];
$smarty->assign('headimg', $headimg);
}
if (!$exist) {
// 查询ECShop内用户信息
$sql = 'select a.user_id, a.password, a.email, a.user_name from ' . $ecs->table('users') . ' AS a where a.user_id = "' . $user_id . '"';
$user = $GLOBALS['db']->getRow($sql);
if (empty($user)) {
// 根据user_id未查找到任何用户信息
}
// 用户不存在,创建用户信息
$username = $user_id;
$password = $user['password'];
$name = $user['user_name'];
$email = $user['email'];
$type = 10;
$shop_id = -1;
$result = create_of_user($username, $password, $name, $email, $type, $shop_id);
if ($result) {
// 创建成功
} else {
// 创建失败
}
}
// 获取前端传来的商品编号、订单编号、店铺编号等
// 商品编号则显示商品信息
// 订单编号则显示订单信息
// 店铺编号则显示店铺信息
$goods_id = null;
$supp_id = -1;
$order_id = null;
$customers = null;
// 获取客服信息
$tab_items = array();
// 客服类型
$cus_types = CUSTOMER_SERVICE;
// 记录需要发给客服的URL
if (!empty($_REQUEST['chat_goods_id'])) {
/* 咨询商品信息 */
$goods_id = $_REQUEST['chat_goods_id'];
$goods = goods_info($goods_id);
$smarty->assign('chat_goods', $goods);
$smarty->assign('chat_goods_id', $goods_id);
// 获取店铺信息
$supp_id = null;
$tab_items[] = array("id" => "chat_goods", "name" => "咨询商品");
// 客服+售前
$cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE;
}
if (!empty($_REQUEST['chat_supp_id'])) {
/* 店铺信息 */
$supp_id = $_REQUEST['chat_supp_id'];
$supp_info = get_dianpu_baseinfo($supp_id);
$smarty->assign('supp_info', $supp_info);
$smarty->assign('chat_supp_id', $supp_id);
$tab_items[] = array("id" => "chat_supp", "name" => "店铺信息");
// 客服+售前
$cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE;
}
if (!empty($_REQUEST['chat_order_id'])) {
/* 咨询订单信息 */
require 'includes/lib_order.php';
$order_id = $_REQUEST['chat_order_id'];
// 获取商品和店铺信息
$goods_id = null;
$supp_id = null;
$order = order_info($order_id);
$order['order_status_text'] = $GLOBALS['_LANG']['os'][$order['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$order['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$order['shipping_status']];
$order['goods_list'] = order_goods($order_id);
$smarty->assign('chat_order', $order);
$smarty->assign('chat_order_id', $order_id);
$smarty->assign('chat_order_sn', $order['order_sn']);
$tab_items[] = array("id" => "chat_order", "name" => "咨询订单");
// 客服+售后
$cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_AFTER;
}
if (true) {
/* 最近订单列表 */
require 'includes/lib_transaction_1.php';
// 获取用户最近的5条订单列表
$order_list = get_user_orders_1($user_id, 5, 0);
// 所有客服忙碌状态,提示web端
$smarty->assign('order_list', $order_list);
$smarty->assign('order_count', count($order_list));
$tab_items[] = array("id" => "chat_order_list", "name" => "最近订单");
//.........这里部分代码省略.........
示例10: strtolower
$smarty->assign('city', $order['city']);
$smarty->assign('dist', $order['district']);
}
$smarty->assign('notice', $order['best_time']);
$smarty->assign('message', $res['message']);
$smarty->assign('shipping_code', $order['shipping_code']);
$smarty->display('shipping_' . strtolower($order['shipping_code']) . '.htm');
} elseif ($_REQUEST['act'] == 'info') {
/* 检查权限 */
/* 根据订单id或订单号查询订单信息 */
if (isset($_REQUEST['order_id'])) {
$order_id = intval($_REQUEST['order_id']);
$order = order_info($order_id);
} elseif (isset($_REQUEST['order_sn'])) {
$order_sn = trim($_REQUEST['order_sn']);
$order = order_info(0, $order_sn);
} else {
/* 如果参数不存在,退出 */
die('invalid parameter');
}
/* 如果订单不存在,退出 */
if (empty($order)) {
die('order does not exist');
}
/* 根据订单是否完成检查权限 */
/*if (order_finished($order))
{
admin_priv('order_view_finished');
}
else
{
示例11: zy_get_order_detail
/**
* 获取指订单的详情
*
* @access public
* @param int $order_id 订单ID
* @param int $user_id 用户ID
*
* @return arr $order 订单所有信息的数组
*/
function zy_get_order_detail($order_id, $user_id = 0)
{
include_once(RPC_ROOT . 'includes/lib_order.php');
$order_id = intval($order_id);
if ($order_id <= 0)
{
return false;
}
//得到订单信息
$order = order_info($order_id);
if($user_id >0 && $user_id != $order['user_id'])
{
return false;
}
return $order;
}
示例12: 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);
}
//.........这里部分代码省略.........
示例13: logResult
require $_SERVER['DOCUMENT_ROOT'] . '/includes/lib_payment.php';
require $_SERVER['DOCUMENT_ROOT'] . '/includes/lib_order.php';
require $_SERVER['DOCUMENT_ROOT'] . '/includes/lib_clips.php';
if (UpmpService::verifySignature($_POST)) {
// 服务器签名验证成功
//请在这里加上商户的业务逻辑程序代码
//获取通知返回参数,可参考接口文档中通知参数列表(以下仅供参考)
$transStatus = $_POST['transStatus'];
// 交易状态
if ("" != $transStatus && "00" == $transStatus) {
// 交易处理成功
logResult("交易处理成功");
logResult(var_export($_POST, true));
$orderNumber = $_POST['orderNumber'];
logResult('orderNumber:' . $orderNumber);
$order = order_info(0, $orderNumber);
if ($order) {
logResult('order_id:' . $order['order_id']);
$log_id = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER);
logResult('log_id:' . $log_id);
order_paid($log_id, 2);
}
} else {
logResult("交易处理失败");
logResult(var_export($_POST, true));
}
echo "success";
} else {
// 服务器签名验证失败
logResult("服务器签名验证失败");
echo "fail";
示例14: order_bonus
/**
* 取得订单应该发放的红包
* @param int $order_id 订单id
* @return array
*/
function order_bonus($order_id)
{
$list = array();
$order = order_info($order_id);
if (!empty($order) && $order['order_status'] == OS_CONFIRMED) {
$order_time = $order['pay_time'];
$amount = $order['money_paid'];
if ($amount > 0) {
/* 查询按商品发的红包 */
$sql = "SELECT b.*, SUM(o.goods_number) AS number " . "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o, " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('bonus_type') . " AS b " . " WHERE o.order_id = '{$order_id}' " . " AND o.is_gift = 0 " . " AND o.extension_code = ''" . " AND o.goods_id = g.goods_id " . " AND g.bonus_type_id = b.type_id " . " AND b.send_type = '" . SEND_BY_GOODS . "' " . " AND b.send_start_date <= '{$order_time}' " . " AND b.send_end_date >= '{$order_time}' " . " GROUP BY b.type_id ";
$list = $GLOBALS['db']->getAll($sql);
/* 查询按订单发的红包 */
$sql = "SELECT b.*, 1 AS number " . "FROM " . $GLOBALS['ecs']->table('bonus_type') . ' AS b ' . "WHERE send_type = '" . SEND_BY_ORDER . "' " . "AND min_amount <= {$amount} AND max_amount > {$amount} " . "AND send_start_date <= '{$order_time}' " . "AND send_end_date >= '{$order_time}' ";
$list = array_merge($list, $GLOBALS['db']->getAll($sql));
}
}
return $list;
}
示例15: respond
/**
* 响应操作
*/
function respond()
{
if (!empty($_POST)) {
foreach ($_POST as $key => $data) {
$_GET[$key] = $data;
}
}
$payment = get_payment($_GET['code']);
$seller_email = rawurldecode($_GET['seller_email']);
$log_id = str_replace($_GET['subject'], '', $_GET['out_trade_no']);
$log_id = trim($log_id);
if (!$log_id) {
$order = order_info(-1, $_GET['subject']);
$sql = "select log_id from " . $GLOBALS['ecs']->table('pay_log') . " where order_id=" . $order['order_id'];
$log_id = $GLOBALS['db']->getOne($sql);
}
/* 检查数字签名是否正确 */
ksort($_GET);
reset($_GET);
$sign = '';
foreach ($_GET as $key => $val) {
if ($key != 'sign' && $key != 'sign_type' && $key != 'code') {
$sign .= "{$key}={$val}&";
}
}
$sign = substr($sign, 0, -1) . $payment['alipay_key'];
//$sign = substr($sign, 0, -1) . ALIPAY_AUTH;
if (md5($sign) != $_GET['sign']) {
return false;
}
/* 检查支付的金额是否相符 */
if (!check_money($log_id, $_GET['total_fee'])) {
return false;
}
if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
/* 改变订单状态 */
order_paid($log_id, 2);
return true;
} elseif ($_GET['trade_status'] == 'TRADE_FINISHED') {
/* 改变订单状态 */
order_paid($log_id);
return true;
} elseif ($_GET['trade_status'] == 'TRADE_SUCCESS') {
/* 改变订单状态 */
order_paid($log_id, 2);
return true;
} else {
return false;
}
}