当前位置: 首页>>代码示例>>PHP>>正文


PHP payment::updateRecharge方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:43,代码来源:block.php

示例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';
     }
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:42,代码来源:block.php

示例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;
     }
 }
开发者ID:xzdesk,项目名称:iwebshop.com,代码行数:50,代码来源:block.php


注:本文中的payment::updateRecharge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。