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


PHP Mage_Payment_Model_Method_Abstract::capture方法代码示例

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


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

示例1: capture

 /**
  * Capture payment (Authorize + Capture)
  *
  * @param   Varien_Object $orderPayment
  * @return  Mage_Payment_Model_Abstract
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     $order = $payment->getOrder();
     $options = array('transactionData' => array('trxAmount' => round($amount * 100), 'trxCurrency' => $order->getBaseCurrencyCode(), 'invoiceText' => $this->_getInvoiceText($order), 'trxUserComment' => $order->getRealOrderId() . '-' . $order->getQuoteId(), 'shopperId' => $order->getRealOrderId()));
     // check if transaction has been preauthorized (lastTransId exists)
     // and no capture already performed
     //   -> use "capture" instead
     if ($payment->getLastTransId()) {
         $options['origTrxNumber'] = $payment->getLastTransId();
         $this->_processRequest('capture', $options, $payment);
     } else {
         $this->_processRequest('authorize', $options, $payment);
     }
     return $this;
 }
开发者ID:hsq,项目名称:Magento-1-1-ipayment,代码行数:22,代码来源:Abstract.php

示例2: capture

 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     $txn = $payment->getAuthorizationTransaction();
     if ($txn) {
         try {
             $data = array('Merchant_ID' => urlencode($this->getConfigData('merchant')), 'Billnumber' => urlencode($txn->getTxnId()), 'Language' => urlencode('EN'), 'Login' => urlencode($this->getConfigData('api_login')), 'Password' => urlencode($this->getConfigData('api_password')));
             $xml = $this->callAssist(self::CHARGE_URL, $data);
             if ((int) $xml['firstcode'] || (int) $xml['secondcode']) {
                 Mage::throwException('error in call');
             }
             if ('AS000' != (string) $xml->orders->order->responsecode) {
                 Mage::throwException($this->getAssistErrors((string) $xml->orders->order->responsecode));
             }
             if (Mage::helper('assist')->isServiceSecured()) {
                 $y = implode("", array($this->getConfigData('merchant'), (string) $xml->orders->order->ordernumber, (string) $xml->orders->order->orderamount, (string) $xml->orders->order->ordercurrency, (string) $xml->orders->order->orderstate, (string) $xml->orders->order->packetdate));
                 $keyFile = Mage::getBaseDir('var') . DS . self::PEM_DIR . DS . $this->getConfigData('assist_key');
                 if ((string) $xml->orders->order->signature != $this->sign($y, $keyFile)) {
                     Mage::throwException('Incorrect Signature.');
                 }
             }
             // success
             Mage::helper('assist')->debug($xml);
         } catch (Mage_Core_Exception $e) {
             Mage::helper('assist')->debug($e->getMessage());
             throw $e;
         }
     } else {
         if (!$this->getAssistCaptureResponse()) {
             $message = Mage::helper('assist')->__('Captured amount of %s offline. ASSIST does not support invoicing via web service.', $amount);
             $this->getOrder()->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
         }
     }
     Mage::helper('assist')->debug('capture');
     return $this;
 }
开发者ID:vuleticd,项目名称:vuleticd_assist,代码行数:36,代码来源:Payment.php

示例3: capture

 /**
  * Capture payment
  * @param Varien_Object $payment
  * @param $amount
  * @return $this
  */
 public function capture(Varien_Object $payment, $amount)
 {
     Mage::helper('partpayment/tools')->addToDebug('Action: Capture');
     parent::capture($payment, $amount);
     if ($amount <= 0) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid amount for capture.'));
     }
     if (!$payment->getLastTransId()) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
     }
     $payment->setAmount($amount);
     // Load transaction Data
     $transactionId = $payment->getLastTransId();
     $transaction = $payment->getTransaction($transactionId);
     if (!$transaction) {
         Mage::throwException(Mage::helper('partpayment')->__('Can\'t load last transaction.'));
     }
     // Get Transaction Details
     $this->fetchTransactionInfo($payment, $transactionId);
     $details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
     // Not to execute for Sale transactions
     if ((int) $details['transactionStatus'] !== 3) {
         Mage::throwException(Mage::helper('partpayment')->__('Can\'t capture captured order.'));
         //return $this;
     }
     $transactionNumber = $details['transactionNumber'];
     $order_id = $payment->getOrder()->getIncrementId();
     // Prevent Rounding Issue
     // Difference can be ~0.0099999999999909
     $order_amount = Mage::helper('partpayment/order')->getCalculatedOrderAmount($payment->getOrder())->amount;
     $value = abs(sprintf("%.2f", $order_amount) - sprintf("%.2f", $amount));
     if ($value > 0 && $value < 0.011) {
         $amount = $order_amount;
     }
     $xml = Mage::helper('partpayment/order')->getInvoiceExtraPrintBlocksXML($payment->getOrder());
     // Call PxOrder.Capture5
     $params = array('accountNumber' => '', 'transactionNumber' => $transactionNumber, 'amount' => round(100 * $amount), 'orderId' => $order_id, 'vatAmount' => 0, 'additionalValues' => 'FINANCINGINVOICE_ORDERLINES=' . urlencode($xml));
     $result = Mage::helper('partpayment/api')->getPx()->Capture5($params);
     Mage::helper('partpayment/tools')->addToDebug('PXOrder.Capture5:' . $result['description'], $order_id);
     // Check Results
     if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
         // Note: Order Status will be changed in Observer
         // Add Capture Transaction
         $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($result['transactionNumber'])->setIsTransactionClosed(0);
         // @todo Get Invoice Link URL using PxOrder.InvoiceLinkGet
         // Add Transaction fields
         $payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
         return $this;
     }
     // Show Error
     Mage::helper('partpayment/tools')->throwPayExException($result, 'PxOrder.Capture5');
     return $this;
 }
开发者ID:anziv,项目名称:Magento-modules,代码行数:59,代码来源:Payment.php

示例4: capture

 /**
  * Capture payment
  *
  * @param   Varien_Object $orderPayment
  * @return  Mage_Payment_Model_Abstract
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:11,代码来源:Cba.php

示例5: capture

 /**
  * Capture payment
  * @param Varien_Object $payment
  * @param $amount
  * @return $this
  */
 public function capture(Varien_Object $payment, $amount)
 {
     Mage::helper('wywallet/tools')->addToDebug('Action: Capture');
     parent::capture($payment, $amount);
     if ($amount <= 0) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid amount for capture.'));
     }
     if (!$payment->getLastTransId()) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
     }
     $payment->setAmount($amount);
     // Load transaction Data
     $transactionId = $payment->getLastTransId();
     $transaction = $payment->getTransaction($transactionId);
     if (!$transaction) {
         Mage::throwException(Mage::helper('wywallet')->__('Can\'t load last transaction.'));
     }
     // Get Transaction Details
     $this->fetchTransactionInfo($payment, $transactionId);
     $details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
     // Not to execute for Sale transactions
     if ((int) $details['transactionStatus'] !== 3) {
         Mage::throwException(Mage::helper('wywallet')->__('Can\'t capture captured order.'));
         //return $this;
     }
     $transactionNumber = $details['transactionNumber'];
     $order_id = $details['orderId'];
     if (!$order_id) {
         $order_id = $payment->getOrder()->getIncrementId();
     }
     // Call PxOrder.Capture5
     $params = array('accountNumber' => '', 'transactionNumber' => $transactionNumber, 'amount' => round(100 * $amount), 'orderId' => $order_id, 'vatAmount' => 0, 'additionalValues' => '');
     $result = Mage::helper('wywallet/api')->getPx()->Capture5($params);
     Mage::helper('wywallet/tools')->addToDebug('PXOrder.Capture5:' . $result['description'], $order_id);
     // Check Results
     if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
         // Note: Order Status will be changed in Observer
         // Add Capture Transaction
         $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($result['transactionNumber'])->setIsTransactionClosed(0);
         // Add Transaction fields
         $payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
         return $this;
     }
     // Show Error
     Mage::helper('wywallet/tools')->throwPayExException($result, 'PxOrder.Capture5');
     return $this;
 }
开发者ID:AndreKlang,项目名称:Payex-Modules-Test,代码行数:53,代码来源:Payment.php

示例6: capture

 /**
  * Determines if a capture will be processed
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @throws Mage_Core_Exception
  * @return \Mage_Payment_Model_Abstract|void
  */
 public function capture(Varien_Object $payment, $amount)
 {
     // disallow Barclaycard online capture if amount is zero
     if ($amount < 0.01) {
         return parent::capture($payment, $amount);
     }
     if (true === Mage::registry('ops_auto_capture')) {
         Mage::unregister('ops_auto_capture');
         return parent::capture($payment, $amount);
     }
     $orderId = $payment->getOrder()->getId();
     $arrInfo = Mage::helper('ops/order_capture')->prepareOperation($payment, $amount);
     $storeId = $payment->getOrder()->getStoreId();
     if ($this->isRedirectNoticed($orderId)) {
         return $this;
     }
     try {
         $requestParams = $this->getBackendOperationParameterModel()->getParameterFor(self::OPS_CAPTURE_TRANSACTION_TYPE, $this, $payment, $amount, $arrInfo);
         $response = Mage::getSingleton('ops/api_directlink')->performRequest($requestParams, Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId), $storeId);
         Mage::helper('ops/payment')->saveOpsStatusToPayment($payment, $response);
         if ($response['STATUS'] == self::OPS_PAYMENT_PROCESSING || $response['STATUS'] == self::OPS_PAYMENT_UNCERTAIN || $response['STATUS'] == self::OPS_PAYMENT_IN_PROGRESS) {
             Mage::helper('ops/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], $arrInfo, self::OPS_CAPTURE_TRANSACTION_TYPE, $this->getHelper()->__('Start Barclaycard %s capture request', $arrInfo['type']));
             $order = Mage::getModel('sales/order')->load($orderId);
             //Reload order to avoid wrong status
             $order->addStatusHistoryComment(Mage::helper('ops')->__('Invoice will be created automatically as soon as Barclaycard sends an acknowledgement. Barclaycard status: %s.', Mage::helper('ops')->getStatusText($response['STATUS'])));
             $order->save();
             $this->getHelper()->redirectNoticed($orderId, $this->getHelper()->__('Invoice will be created automatically as soon as Barclaycard sends an acknowledgement. Barclaycard status: %s.', Mage::helper('ops')->getStatusText($response['STATUS'])));
             return $this;
         } elseif ($response['STATUS'] == self::OPS_PAYMENT_PROCESSED_MERCHANT || $response['STATUS'] == self::OPS_PAYMENT_REQUESTED) {
             return parent::capture($payment, $amount);
         } else {
             Mage::throwException($this->getHelper()->__('The Invoice was not created. Barclaycard status: %s.', Mage::helper('ops')->getStatusText($response['STATUS'])));
         }
     } catch (Exception $e) {
         Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
         Mage::helper('ops')->log("Exception in capture request:" . $e->getMessage());
         throw new Mage_Core_Exception($e->getMessage());
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:47,代码来源:Abstract.php

示例7: capture

 /**
  * In backend it means Authorize && Capture
  * @param $payment
  * @param $amount
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($this->getTransactionId())->setIsTransactionClosed(0);
     // do capture request to adyen
     $order = $payment->getOrder();
     $pspReference = Mage::getModel('adyen/event')->getOriginalPspReference($order->getIncrementId());
     $order->getPayment()->getMethodInstance()->sendCaptureRequest($payment, $amount, $pspReference);
     return $this;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:15,代码来源:Abstract.php

示例8: capture

 /**
  * Send capture request to gateway
  *
  * @param \Mage_Sales_Model_Order_Payment $payment
  * @param  float $amount
  * @return Dwyera_Pinpay_Model_PaymentMethod
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     if ($amount <= 0) {
         Mage::log('Expected amount for transaction is zero or below', Zend_Log::ERR, self::$logFile);
         Mage::throwException(Mage::helper('pinpay')->__('Invalid amount for authorization.'));
     }
     /*
      * If payment method configured for authorize only, the capture method won't be called for transactions recorded as offline
      */
     if (Mage::app()->getStore()->isAdmin() && !is_null($payment->getAdditionalInformation('offline_transaction_id'))) {
         $this->_placeOfflineTransaction($payment, $amount);
     } else {
         $authToken = $this->getPreAuthToken($payment);
         $requestType = is_null($authToken) ? self::REQUEST_TYPE_AUTH_CAPTURE : self::REQUEST_TYPE_CAPTURE_ONLY;
         $request = $this->_buildRequest($payment, $amount, $this->getCustomerEmail());
         $this->_place($payment, $requestType, $request);
     }
     return $this;
 }
开发者ID:andrew-dwyer,项目名称:PINpayments,代码行数:27,代码来源:PaymentMethod.php

示例9: capture

 public function capture(Varien_Object $payment, $amount)
 {
     $sendbaseamount = $this->getCommonConfigData('sendbaseamount');
     if (!$sendbaseamount) {
         // Multiple currencies, multiple channels fix
         $amount = $amount * $payment->getOrder()->getBaseToOrderRate();
     }
     parent::capture($payment, $amount);
     if (!$payment->getPoNumber() && $payment->getLastTransId()) {
         Mage::throwException(Mage::helper('moneybookerspsp')->__('Moneybookers transaction failed: account data is missing.'));
     }
     $params = $this->_initRequestParams();
     if ($sendbaseamount) {
         $amount = $amount >= $payment->getOrder()->getBaseGrandTotal() ? $payment->getOrder()->getBaseGrandTotal() : $amount;
         $params['PRESENTATION.CURRENCY'] = $payment->getOrder()->getBaseCurrencyCode();
     } else {
         $amount = $amount >= $payment->getOrder()->getGrandTotal() ? $payment->getOrder()->getGrandTotal() : $amount;
         // Multiple currencies, multiple channels fix
         $params['PRESENTATION.CURRENCY'] = $payment->getOrder()->getOrderCurrencyCode();
     }
     $params['PRESENTATION.AMOUNT'] = round($amount, 2);
     $params['TRANSACTION.RESPONSE'] = 'ASYNC';
     if ($payment->getLastTransId()) {
         $params['PAYMENT.CODE'] = $this->_getPaymentCode(self::PAYMENT_TYPE_CAPTURE);
         $params['IDENTIFICATION.REFERENCEID'] = $payment->getLastTransId();
     } else {
         $params['PAYMENT.CODE'] = $this->_getPaymentCode(self::PAYMENT_TYPE_DEBIT);
     }
     $this->_getApi()->setStore($this->getStore());
     $response = $this->_getApi()->request($params);
     $this->_processResponse($params, $response, $payment);
     return $this;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:33,代码来源:Abstract.php

示例10: capture

 /**
  * Determines if a capture will be processed
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return mixed
  * @throws Mage_Core_Exception
  */
 public function capture(Varien_Object $payment, $amount)
 {
     if (true === Mage::registry('postfinance_auto_capture')) {
         Mage::unregister('postfinance_auto_capture');
         return parent::capture($payment, $amount);
     }
     $orderID = $payment->getOrder()->getId();
     $arrInfo = Mage::helper('postfinance/order_capture')->prepareOperation($payment, $amount);
     if (Mage::helper('postfinance/directlink')->checkExistingTransact(self::POSTFINANCE_CAPTURE_TRANSACTION_TYPE, $orderID)) {
         $this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('You already sent a capture request. Please wait until the capture request is acknowledged.'));
     }
     if (Mage::helper('postfinance/directlink')->checkExistingTransact(self::POSTFINANCE_VOID_TRANSACTION_TYPE, $orderID)) {
         $this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('There is one void request waiting. Please wait until this request is acknowledged.'));
     }
     try {
         $requestParams = array('AMOUNT' => round($amount * 100), 'ORDERID' => $this->getConfig()->getConfigData('devprefix') . $payment->getOrder()->getQuoteId(), 'OPERATION' => $arrInfo['operation']);
         $response = Mage::getSingleton('postfinance/api_directlink')->performRequest($requestParams, Mage::getModel('postfinance/config')->getDirectLinkGatewayPath());
         Mage::helper('postfinance/payment')->savePostFinanceStatusToPayment($payment, $response);
         if ($response['STATUS'] == self::POSTFINANCE_PAYMENT_PROCESSING || $response['STATUS'] == self::POSTFINANCE_PAYMENT_UNCERTAIN || $response['STATUS'] == self::POSTFINANCE_PAYMENT_IN_PROGRESS) {
             Mage::helper('postfinance/directlink')->directLinkTransact(Mage::getSingleton("sales/order")->loadByIncrementId($payment->getOrder()->getIncrementId()), $response['PAYID'], $response['PAYIDSUB'], $arrInfo, self::POSTFINANCE_CAPTURE_TRANSACTION_TYPE, $this->getHelper()->__('Start PostFinance %s capture request', $arrInfo['type']));
             /** @var $order Mage_Sales_Model_Order */
             $order = Mage::getModel('sales/order')->load($orderID);
             //Reload order to avoid wrong status
             $order->addStatusHistoryComment(Mage::helper('postfinance')->__('Invoice will be created automatically as soon as PostFinance sends an acknowledgement. PostFinance status: %s.', $this->getHelper()->getStatusText($response['STATUS'])));
             $order->save();
             $this->getHelper()->redirectNoticed($orderID, $this->getHelper()->__('Invoice will be created automatically as soon as PostFinance sends an acknowledgement. PostFinance status: %s.', $this->getHelper()->getStatusText($response['STATUS'])));
         } elseif ($response['STATUS'] == self::POSTFINANCE_PAYMENT_PROCESSED_MERCHANT || $response['STATUS'] == self::POSTFINANCE_PAYMENT_REQUESTED) {
             return parent::capture($payment, $amount);
         } else {
             Mage::throwException($this->getHelper()->__('The Invoice was not created. PostFinance status: %s.', $this->getHelper()->getStatusText($response['STATUS'])));
         }
     } catch (Exception $e) {
         $this->getHelper()->log("Exception in capture request:" . $e->getMessage());
         throw new Mage_Core_Exception($e->getMessage());
     }
 }
开发者ID:nomade-it,项目名称:MagentoPostFinance,代码行数:44,代码来源:Abstract.php

示例11: capture

 /**
  * Capture payment
  * @note In BankDebit used auto-capture
  * @param Varien_Object $payment
  * @param $amount
  * @return $this
  */
 public function capture(Varien_Object $payment, $amount)
 {
     Mage::helper('bankdebit/tools')->addToDebug('Action: Capture');
     parent::capture($payment, $amount);
     $transactionId = $payment->getLastTransId();
     //$transactionId = $transactionId . '-capture';
     // Add Capture Transaction
     $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($transactionId)->setIsTransactionClosed(0);
     // Do nothing
     return $this;
 }
开发者ID:AndreKlang,项目名称:Payex-Modules-Test,代码行数:18,代码来源:Payment.php

示例12: capture

 /**
  * (non-PHPdoc)
  * @see Mage_Payment_Model_Method_Abstract::capture()
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     $this->log("Quack_BB_Model_Standard::capture() started");
     try {
         /* @var $request Quack_BB_Model_Sonda */
         $parentId = sprintf("%010d", $payment->getParentId());
         $request = Mage::getModel('bb/sonda')->setIdConv($this->getConfigData('idconv'))->setValorSonda(number_format($amount, 2, '', ''))->setRefTran("{$this->getConfigData('reftran')}{$parentId}")->setFormato('02');
         $sonda = $this->sonda((array) $request);
         $this->getInfoInstance()->setAdditionalInformation('paymentType', (string) $sonda->getTpPagamento())->setAdditionalInformation('paymentStatus', (string) $sonda->getSituacao())->save();
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
     if ($sonda->getSituacao() != '00') {
         $typeMsg = $this->getHelper()->getTypeMessage($sonda->getTpPagamento());
         $statMsg = $this->getHelper()->getStatusMessage($sonda->getSituacao());
         Mage::throwException("{$typeMsg}: {$statMsg}");
     }
     return $this;
 }
开发者ID:albertobraschi,项目名称:Quack-BB,代码行数:24,代码来源:Standard.php

示例13: capture

 /**
  * In backend it means Authorize && Capture
  * @param $payment
  * @param $amount
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($this->getTransactionId())->setIsTransactionClosed(0);
     return $this;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:11,代码来源:Abstract.php

示例14: capture

 /**
  * Capture preatutharized amount
  * @param Varien_Object $payment
  * @param float $amount
  */
 public function capture(Varien_Object $payment, $amount)
 {
     parent::capture($payment, $amount);
     if (Mage::app()->getRequest()->getParam('uppTransactionId')) {
         // capture is called from response action
         $payment->setStatus(self::STATUS_APPROVED);
         return $this;
     }
     $responseXml = $this->_request($payment, $amount, 'COA');
     $payment->setStatus(self::STATUS_SUCCESS);
     return $this;
 }
开发者ID:voolitels,项目名称:Magento-Datatrans,代码行数:17,代码来源:Abstract.php


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