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


PHP Payment::loadMethod方法代码示例

本文整理汇总了PHP中Payment::loadMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::loadMethod方法的具体用法?PHP Payment::loadMethod怎么用?PHP Payment::loadMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Payment的用法示例。


在下文中一共展示了Payment::loadMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Payment

 /**
  * 添加/修改支付方式插件
  */
 function payment_edit()
 {
     //支付方式插件编号
     $pluginId = IReq::get("id");
     //支付方式配置编号
     $payId = IReq::get("payid");
     //初始化支付插件类
     $payment = new Payment();
     $pay_info = array('type' => 1, 'poundage_rate' => 0, 'poundage_fix' => 0, 'poundage_type' => 1, 'config' => '', 'description' => ' ');
     //如果支付配置编号已存在,查找支付方式配置表
     if ($payId != null) {
         $paymentObj = new IModel('payment');
         $pay_info = $paymentObj->getObj("id = " . $payId);
         $pluginId = $pay_info['plugin_id'];
         if ($pay_info['poundage_type'] == 1) {
             $pay_info['poundage_rate'] = $pay_info['poundage'];
             $pay_info['poundage_fix'] = 0;
         } else {
             $pay_info['poundage_fix'] = $pay_info['poundage'];
             $pay_info['poundage_rate'] = 0;
         }
     }
     //初始化支付插件表
     $pay_pluginObj = new IModel('pay_plugin');
     //根据支付插件编号 获取该插件的详细信息
     $plugin_info = $pay_pluginObj->getObj("id = " . $pluginId);
     //根据支付插件file_path路径获取该支付插件的类
     $payObj = $payment->loadMethod($plugin_info['file_path']);
     if (!isset($pay_info['name'])) {
         $pay_info['name'] = $plugin_info['name'];
     }
     $config = isset($pay_info['config']) ? unserialize($pay_info['config']) : array();
     //获取支付插件字段
     $aField = $payObj->getfields();
     //支持货币
     $pay_info['SupportCurrency'] = $payment->getSupportCurrency($payObj->supportCurrency);
     if ($aField) {
         //处理支付插件扩展属性
         if (isset($config['ConnectType'])) {
             foreach ($aField['ConnectType']['extendcontent'] as $key => $val) {
                 foreach ($val['value'] as $ekey => $eval) {
                     if (isset($config['bankId'])) {
                         foreach ($config['bankId'] as $eitem) {
                             if ($eval['value'] == $eitem) {
                                 $aField['ConnectType']['extendcontent'][$key]['value'][$ekey]['checked'] = 'checked';
                                 break;
                             } else {
                                 $aField['ConnectType']['extendcontent'][$key]['value'][$ekey]['checked'] = '';
                             }
                         }
                     }
                 }
             }
         }
     }
     //插件类型
     $pay_info['file_path'] = $plugin_info['file_path'];
     $pay_info['config'] = $config;
     $pay_info['attr_list'] = $aField;
     $pay_info['plugin_id'] = $pluginId;
     $pay_info['pay_id'] = $payId;
     //把数据渲染到视图
     $this->setRenderData($pay_info);
     $this->redirect('payment_edit');
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:68,代码来源:system.php

示例2: IModel

 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: intval

 function payment_balance()
 {
     $urlStr = '';
     $user_id = intval($this->user['user_id']);
     $return['attach'] = IReq::get('attach');
     $return['total_fee'] = IReq::get('total_fee');
     $return['order_no'] = IReq::get('order_no');
     $return['return_url'] = IReq::get('return_url');
     $sign = IReq::get('sign');
     if (stripos($return['order_no'], 'recharge_') !== false) {
         IError::show(403, '余额支付方式不能用于在线充值');
         exit;
     }
     if (floatval($return['total_fee']) <= 0 || $return['order_no'] == '' || $return['return_url'] == '') {
         IError::show(403, '支付参数不正确');
     } else {
         $paymentObj = new Payment();
         $payObj = $paymentObj->loadMethod('balance');
         $pkey = $payObj->getConf(IFilter::act($return['attach']), 'PrivateKey');
         //md5校验
         ksort($return);
         foreach ($return as $key => $val) {
             $urlStr .= $key . '=' . urlencode($val) . '&';
         }
         $urlStr .= $user_id . $pkey;
         if ($sign != md5($urlStr)) {
             IError::show(403, '数据校验不正确');
         } else {
             $memberObj = new IModel('member');
             $memberRow = $memberObj->getObj('user_id = ' . $user_id);
             if (empty($memberRow)) {
                 IError::show(403, '用户信息不存在');
                 exit;
             } else {
                 if ($memberRow['balance'] < $return['total_fee']) {
                     IError::show(403, '账户余额不足');
                     exit;
                 } else {
                     $orderObj = new IModel('order');
                     $orderRow = $orderObj->getObj('order_no  = "' . IFilter::act($return['order_no']) . '" and pay_status = 0');
                     if (empty($orderRow)) {
                         IError::show(403, '订单已经被处理过,请查看订单状态');
                         exit;
                     }
                     $dataArray = array('balance' => 'balance - ' . IFilter::act($return['total_fee']));
                     $memberObj->setData($dataArray);
                     $is_success = $memberObj->update('user_id = ' . $user_id, 'balance');
                     if ($is_success) {
                         $return['is_success'] = 'T';
                     } else {
                         $return['is_success'] = 'F';
                     }
                     ksort($return);
                     //返还的URL地址
                     $responseUrl = '';
                     foreach ($return as $key => $val) {
                         $responseUrl .= $key . '=' . urlencode($val) . '&';
                     }
                     $nextUrl = urldecode($return['return_url']);
                     if (stripos($nextUrl, '?') === false) {
                         $return_url = $nextUrl . '?' . $responseUrl;
                     } else {
                         $return_url = $nextUrl . '&' . $responseUrl;
                     }
                     //计算要发送的md5校验
                     $urlStrMD5 = md5($responseUrl . $user_id . $pkey);
                     //拼接进返还的URL中
                     $return_url .= 'sign=' . $urlStrMD5;
                     header('location:' . $return_url);
                 }
             }
         }
     }
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:74,代码来源:ucenter.php


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