本文整理匯總了PHP中payment::updateRecharge方法的典型用法代碼示例。如果您正苦於以下問題:PHP payment::updateRecharge方法的具體用法?PHP payment::updateRecharge怎麽用?PHP payment::updateRecharge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類payment
的用法示例。
在下文中一共展示了payment::updateRecharge方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: server_callback
/**
* @brief 【重要】支付回調[異步]
*/
function server_callback()
{
//從URL中獲取支付方式
$payment_id = IFilter::act(IReq::get('_id'), 'int');
$paymentInstance = Payment::createPaymentInstance($payment_id);
if (!is_object($paymentInstance)) {
die('fail');
}
//初始化參數
$money = '';
$message = '支付失敗';
$orderNo = '';
//執行接口回調函數
$callbackData = array_merge($_POST, $_GET);
unset($callbackData['controller']);
unset($callbackData['action']);
unset($callbackData['_id']);
$return = $paymentInstance->callback($callbackData, $payment_id, $money, $message, $orderNo);
//支付成功
if ($return == 1) {
//充值方式
if (stripos($orderNo, 'recharge_') !== false) {
$tradenoArray = explode('_', $orderNo);
$recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
if (payment::updateRecharge($recharge_no)) {
$paymentInstance->notifyStop();
exit;
}
} else {
$order_id = Order_Class::updateOrderStatus($orderNo);
if ($order_id) {
$paymentInstance->notifyStop();
exit;
}
}
} else {
$paymentInstance->notifyStop();
exit;
}
}
示例2: server_callback
function server_callback()
{
$payment_name = is_array($payment_name = IReq::get('payment_name')) ? IFilter::act($payment_name[0]) : IFilter::act(IReq::get('payment_name'));
//初始化參數
$money = null;
$message = null;
$tradeno = null;
//獲取支付payment的id值
$pObj = new IModel('payment as a,pay_plugin as b');
$paymentRow = $pObj->getObj('b.file_path = "' . $payment_name . '" and a.plugin_id = b.id', 'a.id');
//載入支付接口文件
$paymentObj = new Payment();
$payObj = $paymentObj->loadMethod($payment_name);
if (!is_object($payObj)) {
echo 'fail';
exit;
}
//執行接口回調函數
$return = $payObj->serverCallback(array_merge($_POST, $_GET), $paymentRow['id'], $money, $message, $tradeno);
//判斷返回狀態
if ($return == 1) {
if (stripos($tradeno, 'recharge_') !== false) {
$tradenoArray = explode('_', $tradeno);
$recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
if (payment::updateRecharge($recharge_no)) {
echo 'success';
exit;
} else {
echo 'fail';
}
} else {
if (payment::updateOrder($tradeno)) {
echo 'success';
exit;
} else {
echo 'fail';
}
}
} else {
echo 'fail';
}
}
示例3: server_callback
/**
* @brief 【重要】支付回調[異步]
*/
function server_callback()
{
//從URL中獲取支付方式
$payment_id = IFilter::act(IReq::get('_id'), 'int');
$paymentInstance = Payment::createPaymentInstance($payment_id);
if (!is_object($paymentInstance)) {
die('fail');
}
//初始化參數
$money = '';
$message = '支付失敗';
$orderNo = '';
//執行接口回調函數
$callbackData = array_merge($_POST, $_GET);
unset($callbackData['controller']);
unset($callbackData['action']);
unset($callbackData['_id']);
$return = $paymentInstance->serverCallback($callbackData, $payment_id, $money, $message, $orderNo);
//支付成功
if ($return == 1) {
//充值方式
if (stripos($orderNo, 'recharge') !== false) {
$tradenoArray = explode('recharge', $orderNo);
$recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
if (payment::updateRecharge($recharge_no)) {
$paymentInstance->notifyStop();
exit;
}
} else {
//讀取批量訂單付款
$cacheObj = new ICache('file');
$moreOrder = $cacheObj->get($orderNo);
$moreOrder = $moreOrder ? explode(",", $moreOrder) : array($orderNo);
foreach ($moreOrder as $key => $item) {
$order_id = Order_Class::updateOrderStatus($item);
if (!$order_id) {
throw new IException("異步支付回調修改狀態錯誤,訂單ID:" . $order_id);
}
}
$paymentInstance->notifyStop();
exit;
}
} else {
$paymentInstance->notifyStop();
exit;
}
}