songxingwei 2 سال پیش
والد
کامیت
cf8c1bd2be
100فایلهای تغییر یافته به همراه19500 افزوده شده و 1 حذف شده
  1. 1 1
      app/common.php
  2. 111 0
      app/common/library/AliPay.php
  3. 144 0
      app/common/library/AliPay2.php
  4. 239 0
      app/common/library/AliPay3.php
  5. 613 0
      app/common/library/Auth.php
  6. 304 0
      app/common/library/Common.php
  7. 197 0
      app/common/library/Email.php
  8. 144 0
      app/common/library/Ems.php
  9. 142 0
      app/common/library/Hecheng.php
  10. 317 0
      app/common/library/HuijuH5Pay.php
  11. 200 0
      app/common/library/HuijuKjPay.php
  12. 81 0
      app/common/library/Jiyan.php
  13. 148 0
      app/common/library/JuheRecharge.php
  14. 144 0
      app/common/library/Menu.php
  15. 245 0
      app/common/library/PHPExcelService.php
  16. 16 0
      app/common/library/Pay.php
  17. 3223 0
      app/common/library/QRcode.php
  18. 129 0
      app/common/library/Shande.php
  19. 158 0
      app/common/library/Token.php
  20. 8 0
      app/common/library/UserException.php
  21. 189 0
      app/common/library/WxMerchPay.php
  22. 394 0
      app/common/library/WxPay.php
  23. 188 0
      app/common/library/alipay/aop/AlipayMobilePublicMultiMediaClient.php
  24. 115 0
      app/common/library/alipay/aop/AlipayMobilePublicMultiMediaExecute.php
  25. 1237 0
      app/common/library/alipay/aop/AopCertClient.php
  26. 527 0
      app/common/library/alipay/aop/AopCertification.php
  27. 1299 0
      app/common/library/alipay/aop/AopClient.php
  28. 81 0
      app/common/library/alipay/aop/AopEncrypt.php
  29. 18 0
      app/common/library/alipay/aop/EncryptParseItem.php
  30. 16 0
      app/common/library/alipay/aop/EncryptResponseData.php
  31. 15 0
      app/common/library/alipay/aop/SignData.php
  32. 14 0
      app/common/library/alipay/aop/readme
  33. 118 0
      app/common/library/alipay/aop/request/AftAifinFireeyeOcrImageQueryRequest.php
  34. 118 0
      app/common/library/alipay/aop/request/AftFinsecureRiskplusSecurityPolicyQueryRequest.php
  35. 118 0
      app/common/library/alipay/aop/request/AliosOpenAutoInfoQueryRequest.php
  36. 118 0
      app/common/library/alipay/aop/request/AlipayAccountExrateAdviceAcceptRequest.php
  37. 118 0
      app/common/library/alipay/aop/request/AlipayAccountExrateAllclientrateQueryRequest.php
  38. 118 0
      app/common/library/alipay/aop/request/AlipayAccountExrateRatequeryRequest.php
  39. 118 0
      app/common/library/alipay/aop/request/AlipayAccountExrateTraderequestCreateRequest.php
  40. 171 0
      app/common/library/alipay/aop/request/AlipayAcquireCancelRequest.php
  41. 152 0
      app/common/library/alipay/aop/request/AlipayAcquireCloseRequest.php
  42. 550 0
      app/common/library/alipay/aop/request/AlipayAcquireCreateandpayRequest.php
  43. 402 0
      app/common/library/alipay/aop/request/AlipayAcquirePrecreateRequest.php
  44. 136 0
      app/common/library/alipay/aop/request/AlipayAcquireQueryRequest.php
  45. 236 0
      app/common/library/alipay/aop/request/AlipayAcquireRefundRequest.php
  46. 118 0
      app/common/library/alipay/aop/request/AlipayAppTokenGetRequest.php
  47. 103 0
      app/common/library/alipay/aop/request/AlipayAssetPointBalanceQueryRequest.php
  48. 103 0
      app/common/library/alipay/aop/request/AlipayAssetPointBudgetQueryRequest.php
  49. 118 0
      app/common/library/alipay/aop/request/AlipayAssetPointOrderCreateRequest.php
  50. 118 0
      app/common/library/alipay/aop/request/AlipayAssetPointOrderQueryRequest.php
  51. 118 0
      app/common/library/alipay/aop/request/AlipayBossCsChannelQueryRequest.php
  52. 103 0
      app/common/library/alipay/aop/request/AlipayBossFncXwbtestRetModifyRequest.php
  53. 118 0
      app/common/library/alipay/aop/request/AlipayBossProdArrangementOfflineQueryRequest.php
  54. 118 0
      app/common/library/alipay/aop/request/AlipayBossProdMyTestQueryRequest.php
  55. 103 0
      app/common/library/alipay/aop/request/AlipayCommerceAdContractSignRequest.php
  56. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceAirCallcenterTradeApplyRequest.php
  57. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceAirXfgDsgModifyRequest.php
  58. 103 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorCityQueryRequest.php
  59. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositCancelRequest.php
  60. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositConfirmRequest.php
  61. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositQueryRequest.php
  62. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorFunctionQueryRequest.php
  63. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorScriptQueryRequest.php
  64. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorStationQueryRequest.php
  65. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherBatchqueryRequest.php
  66. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherCancelRequest.php
  67. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherConfirmRequest.php
  68. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherGenerateRequest.php
  69. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherQueryRequest.php
  70. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherRefundRequest.php
  71. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherUploadRequest.php
  72. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceDataCampaignCreateRequest.php
  73. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceDataCampaignSendRequest.php
  74. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceDataCustommetricSyncRequest.php
  75. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceDataLogdataSyncRequest.php
  76. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceDataMonitordataSyncRequest.php
  77. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceEducateAuthenticateCampuscardCreateRequest.php
  78. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceEducateParttimejobInfoCreateRequest.php
  79. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceEducateSchoolcodeTokenCreateRequest.php
  80. 103 0
      app/common/library/alipay/aop/request/AlipayCommerceEducateStudentinfoShareRequest.php
  81. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceEducateUserClickCreateRequest.php
  82. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceIotDeviceserviceCancelRequest.php
  83. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceLogisticsWaybillMinimctSyncRequest.php
  84. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceLotteryPresentSendRequest.php
  85. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceLotteryPresentlistQueryRequest.php
  86. 103 0
      app/common/library/alipay/aop/request/AlipayCommerceLotteryTypelistQueryRequest.php
  87. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportIntelligentizeDataSyncRequest.php
  88. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportNfccardSendRequest.php
  89. 103 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayKeyQueryRequest.php
  90. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayRecordVerifyRequest.php
  91. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayUserblacklistQueryRequest.php
  92. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportParkingReserveConfirmRequest.php
  93. 118 0
      app/common/library/alipay/aop/request/AlipayCommerceTransportVehicleownerMessageSendRequest.php
  94. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderCancelRequest.php
  95. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderConfirmRequest.php
  96. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderModifyRequest.php
  97. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderQueryRequest.php
  98. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderRefundRequest.php
  99. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderRefuseRequest.php
  100. 118 0
      app/common/library/alipay/aop/request/AlipayDaoweiOrderSpModifyRequest.php

+ 1 - 1
app/common.php

@@ -154,7 +154,7 @@ function setqrcode($value,$name){
         mkdir($dir, 0700,true);
     }
     $filename = $dir.'/'.$name.'.png';
-    \app\common\library\QRcode::png($value,$filename,QR_ECLEVEL_L,7);
+    QRcode::png($value,$filename,QR_ECLEVEL_L,7);
 
     $url = 'http://'.$_SERVER['SERVER_NAME']."/user/".$name.'.png';
     return $url;

+ 111 - 0
app/common/library/AliPay.php

@@ -0,0 +1,111 @@
+<?php
+namespace app\common\library;
+use Alipay\EasySDK\Kernel\Factory;
+use Alipay\EasySDK\Kernel\Util\ResponseChecker;
+use app\common\model\Config;
+use think\Controller;
+
+class AliPay
+{
+    /*
+   配置参数
+   */
+    public function __construct()
+    {
+        $this->appId = "2021003138683914";
+        $this->rsaPrivateKey =  'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDNQ36vpF2cveu4z09kbvaajPwJD2Lk4yPQL0d/yhW7oPlMAXOjUsHEJ43ooyG5AkRhMS0DbXVE0dbJZdnzEdGe/efCIXpcLR45xcLcvSS2Kmc8xvo3zhzvo45lA0+mBSwdE2nIlkQCLNgrZPnH0J9mliF3mJa3SgtX5kvu4UX76xE9uTj1oMFexnXo4S5Pw0d86YFTe3fSMdPnoI71tnA7f7cV0N5MyFnJnyRrd16EAJjn/IoX66mD7NtO6u7mFY71ijZ9PD6S7xCl+HnnUARIS4YlTMdsxgsNM9CtO0srI9uvW9Us9YaTNACdjK/TSCxWUC9hXXgjW1T2pBfs5cJRAgMBAAECggEBAKs/9XDqi6NanFBavV0Iaru0hg21BYf6rQVifJ9z5T/d5D9yMpz/TWOusGl3uInXB1+jHG/woVbiTvVGAVkW87FXGkVPkvtWNRJ0GMf7Eabdp7YAN//Y+TFBXmqOIaRcSlqTuLy+CU1bRpqlqvL27hYziQZzisKuhto17AIHdlDeZBYeS0RIb487g/qcTMywb9Rry7qjpa9SPzkK9pAjLJ3nkAi+dMGRLoEa0jSKh8B9QmkCn4BF64w2ykoukZGKBI/TM0BtZi6XsYGT2di5IgxEc78xN91RDWKlY/xjpfrakFFLrCx4bh3RjWmMfO8ctqC0xLkhnNhSeCaWzMvAVLECgYEA++/+u2xfkOByCaIZELcDo8Nx4Cjaf0ldtLO5iwi0Ve/0ObI8+TMcNs1cAeb+DrsyGrkdazpJKICMwNuPQtCaeVfdoxMAS6sX+Jend8u0xG5K/FcvoPj8CM7QYzwYsEJKOumAtQp5Ha/EHfmYwMIpxfcvAXIwdO0Akz8QSwBNMBUCgYEA0JLUNjKm/eagaCV2hkEgtIifDmuAW+DRi1GwTYbsFY+pvtVHX7ylLJPbGmR2yDAM3ha54vbWE9YyYX3KVCjKnii2kSQo4XcOGlIdi8HWdtq07Y2SdC0myhyzv+mWS/CddVL90TfdtFkEyrledkukKF2H+yOnv2l3hpBcXQG8HE0CgYBy6yggyfBVn2ulJUGVtEV+v7oD696uzQJnWMu7tb68rHWUk87oRP4LqWTcoUcl5RGXyvS2YqHYTbrmhcA1U/4Cd6frqNErsuF+TX7gUBUmvMCLliFtpeUhB2VavqDsVXCSqsxAyIQynGgy3BVnZ6myWWwhlrqvuyPWBqAh9gM/eQKBgQCFNUFTXAZLIoBQA50vIWlB4/+xtfbEt1EdKY7v9LvTCW3f81ciTdkwHz5QHNnAAPA250zRJ9SR1rtWiIAwP90oJdhz2iRB20emh8tW9vWB8yyai1B94lhjvPEQIJ9c4M+vntF8TbHK/Q+SadFqu+Sb4yB1xM/d7/3mc0yKGhGKAQKBgCxTGEXo9tvYRCMViQZ46laFLMi/hw6satmsm3nwnjkXRliJfezneokJjtK6Gq4FchRqS8nZrkJ1q5Zu5U1qzt76mwd9DinHi8l/D1GDhGRM2539ixT8Bl+iLdYNobSXHTUZEnCRq1Uw8/9aG2Fpo2NqYQti+BsBcnPDooIlD7yL';
+        $this->aliPayRsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzUN+r6RdnL3ruM9PZG72moz8CQ9i5OMj0C9Hf8oVu6D5TAFzo1LBxCeN6KMhuQJEYTEtA211RNHWyWXZ8xHRnv3nwiF6XC0eOcXC3L0ktipnPMb6N84c76OOZQNPpgUsHRNpyJZEAizYK2T5x9CfZpYhd5iWt0oLV+ZL7uFF++sRPbk49aDBXsZ16OEuT8NHfOmBU3t30jHT56CO9bZwO3+3FdDeTMhZyZ8ka3dehACY5/yKF+upg+zbTuru5hWO9Yo2fTw+ku8Qpfh551AESEuGJUzHbMYLDTPQrTtLKyPbr1vVLPWGkzQAnYyv00gsVlAvYV14I1tU9qQX7OXCUQIDAQAB';
+    }
+
+
+    /**
+     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
+     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
+     * @throws \GuzzleHttp\Exception\GuzzleException
+     * 支付宝支付
+     */
+    public static function ali_pay($subject,$totalAmount,$outTradeNo,$notifyUrl,$returnUrl='',$expire=null){
+        Factory::setOptions(self::getOptions($notifyUrl));
+            //2. 发起API调用(以支付能力下的统一收单交易创建接口为例)
+            //$result = Factory::payment()->common()->create("iPhone6 16G", "20200326235526001", "88.88", "2088002656718920");
+            $result = Factory::payment()->wap()->pay($subject,$outTradeNo , $totalAmount,'',$returnUrl,$expire);
+            $responseChecker = new ResponseChecker();
+            user_log('ali_pay.unify',['arguments'=>func_get_args(),$result->body]);
+            //3. 处理响应或异常
+            if ($responseChecker->success($result)) {
+                return $result->body;
+            } else {
+                //echo "调用失败,原因:". $result->msg.",".$result->subMsg.PHP_EOL;
+            }
+    }
+    public static function ali_pay_calcel($outTradeNo){
+        Factory::setOptions(self::getOptions());
+        $result = Factory::payment()->common()->close($outTradeNo);
+        user_log('ali_pay_calcel',[
+            compact('outTradeNo','result')
+        ]);
+        return $result;
+    }
+    public static function query($orderNo){
+        Factory::setOptions(self::getOptions());
+        $result = Factory::payment()->common()->query($orderNo);
+        return $result;
+    }
+
+    public static function refund($orderNo,$amount){
+        Factory::setOptions(self::getOptions());
+        $result = Factory::payment()->common()->refund($orderNo,$amount);
+        user_log('Alipay.refund',['arg'=>func_get_args(),$result]);
+        return $result;
+    }
+
+    public static function ali_pay_pc($subject='商品',$totalAmount,$outTradeNo,$notifyUrl,$returnUrl){
+        Factory::setOptions(self::getOptions($notifyUrl));
+        try {
+            $result = Factory::payment()->Page()->pay($subject,$outTradeNo,$totalAmount,$returnUrl);
+            $responseChecker = new ResponseChecker();
+            //3. 处理响应或异常
+            if ($responseChecker->success($result)) {
+                return $result->body;
+            } else {
+                echo "调用失败,原因:". $result->msg.",".$result->subMsg.PHP_EOL;
+            }
+        } catch (Exception $e) {
+            return false;
+        }
+    }
+
+
+    public static function getOptions($notifyUrl=''){
+        $options = new \Alipay\EasySDK\Kernel\Config();
+        $options->protocol = 'https';
+        $options->gatewayHost = 'openapi.alipay.com';
+        $options->signType = 'RSA2';
+
+        $options->appId = '2021003138683914';
+
+        // 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中
+        $options->merchantPrivateKey = file_get_contents(sprintf('%s/data/alipay/play.wdmeta.art_私钥.txt',app()->getRootPath()));
+
+        //$options->alipayCertPath = '<-- 请填写您的支付宝公钥证书文件路径,例如:/foo/alipayCertPublicKey_RSA2.crt -->';
+        $options->alipayCertPath = sprintf('%s/data/alipay/alipayCertPublicKey_RSA2.crt',app()->getRootPath());
+        //$options->alipayRootCertPath = '<-- 请填写您的支付宝根证书文件路径,例如:/foo/alipayRootCert.crt" -->';
+        $options->alipayRootCertPath = sprintf('%s/data/alipay/alipayRootCert.crt',app()->getRootPath());
+        //$options->merchantCertPath = '<-- 请填写您的应用公钥证书文件路径,例如:/foo/appCertPublicKey_2019051064521003.crt -->';
+        $options->merchantCertPath = sprintf('%s/data/alipay/appCertPublicKey_2021003138683914.crt',app()->getRootPath());
+
+        //注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可
+        $options->alipayPublicKey ='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkI3OUjhrVtqqBaKBFmUgQHcio9rtcKdj2wwSIw7k+zzC7zaiFFQpnP+g115mz0V3WA+6r1jfr+Nh4kTKXDabiolzw/Ga2CkVGJRXoO/ZIyeOzIQWPLOJmPHicPTJG1BAWYDzZNnwz6gAmxq55m5VUva0ytojbSLdznWaUhD4nogkfgSI71eVzqDpVNcDaDBaaSnVE0INiIsf5pN2GRmlPJcIyZGq3w9wLka6TvL3DLYgaeEyLuzacO8epJ8m/hiLK85BFAP12eWIjjL7FkZV+xKH7a9qbU36KcRi7wymrFx55HNeRxRIZDmAvsX+R8fpwuIb7wNDwYY1enOas5HugQIDAQAB';
+        //可设置异步通知接收服务地址(可选)
+        $options->notifyUrl = $notifyUrl;
+        //可设置AES密钥,调用AES加解密相关接口时需要(可选)
+        $options->encryptKey = "";
+        return $options;
+    }
+
+    public static function resulr(){
+        Factory::setOptions(self::getOptions());
+        return Factory::payment()->common()->verifyNotify(request()->post());
+    }
+
+}

+ 144 - 0
app/common/library/AliPay2.php

@@ -0,0 +1,144 @@
+<?php
+namespace app\common\library;
+use app\common\model\Config;
+use think\Controller;
+
+class AliPay2 extends Controller
+{
+    /*
+   配置参数
+   */
+    public function __construct()
+    {
+        $this->appId = "202100312862198822222122";
+        $this->rsaPrivateKey =  'MIIEowIBAAKCAQEAhkW8tpvdkVRZklapB+scLgcdL6N8/noWdV4h6ViUDxHd1rSjYJRHLmFgLYLgyKHHyS3tXySPf7qRbWwyImV4A17+WNTxAtdMH+TBAuqS49sAND4JYjurtY6CbQjwBEHUOE506DhISM4+fzkgtLGF8lD0jAJyXFRK4XutL3ddJ2XSzbIUTvT1bIP+cwNQcsmTTmpO145+9gKvx8tkHILKZPockarsoUoeo9gapB3hnNHNrYTbzpsa/zkOETD7L3rgpWbGJSc675t5dk8RaqH13Eon0BTn/Ov5gJ0P8j4VUWXYqdI9cEVur65S002vvhiIFVpy+30nB9SviF+/rcjQnQIDAQABAoIBAAGAdCzir2a5t8rAN2HESmtlXvkybep2uRuU8vImMHm+rGmDWbRx1B37rtSzewojbRWd8uK2iPhXwNqldCYYVnBLNrMNpqhuegZ9S39Z2ky8HVN4QiicHD6KmoDXsb+KcPI0RnB2eLB/xgksPWZn+eSM7T9Ho7nOo4vEE1rNjfgr0hexrbGJwrE1mlXfgsLRFgXfx5/3ndv4HZtX1uULdt9Xei9h8jE/kbkGz5bemjGar3ZC7rGQ+TNHDJ3BBXNCVxt9kJDjYpnf6EPceMEdClfSWwN4pvFvCx9LGcSGtFDx9NOF43alt4nt9VWrBj0H0iXRA1hyIFmO7KeuUoujN00CgYEA79L5cT38sMx3HMQ8aDXjUDvVq3yjHjKMDryt8PB3DVLqZCn7qehUQQG7NuVc4gdX6Ew97tcmx6vs8LRoD36lr8WFvJiY3RVTlu5fkZdMfu4jYoyG3udtzAOQ+dLxtAtCLO28FApAwi2VPF+nTJDWOzJsStDfDgJhDPKL5eojPwMCgYEAj1Q1iHKZ4+S/2zrhOoviIILCNy0VWTmEv0SV26NdJIQk1zAbrSz+m2q+ufJgO+6Tt6WXnjYWHA5ocObddH+paB12Ja4Z5UVSqa8kuDMZlVz4B1UiUmV5yuHnC20EI+2vGe4g/kDvTfwpaQFR5tMhwgMBTx9G21Bx0HmL033hT98CgYEA1BfqAGtImXcJ9EfcAHF/6cow6isc+yzKzpGw5v9S2la08gZrCdVtBdypHCB2J3NFHCypLRvbsQRsVGfIC8P+ddeisarmrccZmMaRgGmk/jBO3O3YrTNQ1/djdH1IwuieCqvpBHQY12GGtNEHXOBOhiXOvc/BJFuYRuIONTP/Hc8CgYAzUDumMRlFTLUfYNIX6tK3PvkXVe2ptvz+mShprPAAzcp+u/t8oXo53BqSaeLoMf7ypbdFbim2O7ZKjWzFc5sL6lhNHyqoOYxhsZGc3LaREeq+fU0/YJMc/omAPrRXxJWG3Ak13buPGPMeY9mVoQsZ8Yd7c0Aj7oYA1DMqMYwD0wKBgEenuZbJDJFOXgRj9T7UvE2ANvnZtCLNhxlQ+AtCCSKTUSESQvO2v+Xhe2bKYhZAejXBykia2UjUDmeDVzT2aID0p+qLaAUtfOdR2ahUN4ME0JJFcwzqSODeuOR7CqWWDu2OQ/rJMhh12nePzMpedepkRrGnzqBwPljAPnigat04';
+        $this->aliPayRsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhkW8tpvdkVRZklapB+scLgcdL6N8/noWdV4h6ViUDxHd1rSjYJRHLmFgLYLgyKHHyS3tXySPf7qRbWwyImV4A17+WNTxAtdMH+TBAuqS49sAND4JYjurtY6CbQjwBEHUOE506DhISM4+fzkgtLGF8lD0jAJyXFRK4XutL3ddJ2XSzbIUTvT1bIP+cwNQcsmTTmpO145+9gKvx8tkHILKZPockarsoUoeo9gapB3hnNHNrYTbzpsa/zkOETD7L3rgpWbGJSc675t5dk8RaqH13Eon0BTn/Ov5gJ0P8j4VUWXYqdI9cEVur65S002vvhiIFVpy+30nB9SviF+/rcjQnQIDAQAB';
+    }
+
+    /*
+     * 支付宝支付
+     */
+    public function aliPay($body, $total_amount, $product_code, $notify_url)
+    {
+        /**
+         * 调用支付宝接口。
+         */
+        $isdir = dirname(__DIR__)."/library/";//绝对路径
+        require_once($isdir.'/alipay/aop/AopClient.php');
+        require_once($isdir.'/alipay/aop/request/AlipayTradeAppPayRequest.php');
+        $total_amount = floatval($total_amount);
+        $aop = new AopClient();
+        $aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
+        $aop->appId = $this->appId;
+        $aop->rsaPrivateKey = $this->rsaPrivateKey;
+        $aop->format = "json";
+        $aop->charset = "UTF-8";
+        $aop->signType = "RSA2";
+        $aop->alipayrsaPublicKey = $this->aliPayRsaPublicKey;
+        $request = new AlipayTradeAppPayRequest();
+        $arr['body'] = $body;
+        $arr['subject'] = $body;
+        $arr['out_trade_no'] = $product_code;
+        $arr['timeout_express'] = '30m';
+        $arr['total_amount'] = $total_amount;
+        $arr['product_code'] = 'QUICK_MSECURITY_PAY';
+
+        $json = json_encode($arr);
+        $request->setNotifyUrl($notify_url);
+        $request->setBizContent($json);
+        $response = $aop->sdkExecute($request);
+        return $response;
+
+
+    }
+
+    //支付宝退款
+    public function zfbrefund($out_trade_no,$out_refund_no,$total_fee,$refund_reason){
+        $total_fee  = sprintf("%.2f",substr(sprintf("%.4f", $total_fee), 0, -2));
+        $isdir = dirname(__DIR__)."/library/";//绝对路径
+        require_once($isdir.'/alipay/aop/AopClient.php');
+        require_once($isdir.'/alipay/aop/request/AlipayTradeRefundRequest.php');
+        $aop = new AopClient();
+        $aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
+        $aop->appId = $this->appId;
+        $aop->rsaPrivateKey = $this->rsaPrivateKey;
+        $aop->format = "json";
+        $aop->charset = "UTF-8";
+        $aop->signType = "RSA2";
+        $aop->apiVersion = '1.0';
+//        $aop->alipayrsaPublicKey = $this->aliPayRsaPublicKey;
+        $request = new \AlipayTradeRefundRequest();
+        //$arr['trade_no'] = $out_refund_no;
+        $arr['out_trade_no'] = $out_trade_no;
+        $arr['refund_amount'] = $total_fee;
+        $arr['refund_reason'] = $refund_reason;
+        $arr['refund_currency'] = "CNY";
+        $arr['operator_id'] = "OP001";
+        $arr['store_id'] = "NJ_S_001";
+        $arr['terminal_id'] = "NJ_T_001";
+        $json = json_encode($arr);
+        $request->setBizContent($json);
+        $result = $aop->execute($request);
+        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
+        $resultCode = $result->$responseNode->code;
+        return $resultCode;
+    }
+
+
+    //支付宝转账个人账户
+    public function FundTransToaccount($out_trade_no,$account,$account_real_name,$amount,$remark){
+        $amount  = sprintf("%.2f",substr(sprintf("%.4f", $amount), 0, -2));
+        $isdir = dirname(__DIR__)."/library/";//绝对路径
+        require_once($isdir.'/alipay/aop/AopClient.php');
+        $aop = new AopClient();
+        $aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
+        $aop->appId = $this->appId;
+        $aop->rsaPrivateKey = $this->rsaPrivateKey;
+        $aop->format = 'json';
+        $aop->charset = 'UTF-8';
+        $aop->signType = 'RSA2';
+        //$aop->alipayrsaPublicKey = $this->aliPayRsaPublicKey;
+        require_once($isdir.'/alipay/aop/request/AlipayFundTransToaccountTransferRequest.php');
+        $request = new \AlipayFundTransToaccountTransferRequest();
+        $arr['out_biz_no'] = $out_trade_no;      //订单号
+        $arr['payee_type'] = 'ALIPAY_LOGONID';
+        $arr['payee_account'] = $account;        //对方支付宝账号
+        $arr['payee_real_name'] = $account_real_name;   //支付宝实名姓名
+        $arr['amount']  = $amount;
+        $arr['remark']  = $remark;
+        $json = json_encode($arr,true);
+        $request->setBizContent($json);
+        $result = $aop->execute($request);
+        $result2 = json_decode(json_encode($result),true);
+        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
+        $resultCode = $result->$responseNode->code;
+        $arr = ['code'=>$resultCode,'result'=>$result2];
+        return $arr;
+    }
+
+
+    function createLinkstring($para)
+    {
+        $arg = "";
+        while (list ($key, $val) = each($para)) {
+            $arg .= $key . "=" . $val . "&";
+        }
+        //去掉最后一个&字符
+        $arg = substr($arg, 0, count($arg) - 2);
+
+        //如果存在转义字符,那么去掉转义
+        if (get_magic_quotes_gpc()) {
+            $arg = stripslashes($arg);
+        }
+
+        return $arg;
+    }
+
+
+    function argSort($para)
+    {
+        ksort($para);
+        reset($para);
+        return $para;
+    }
+}

+ 239 - 0
app/common/library/AliPay3.php

@@ -0,0 +1,239 @@
+<?php
+namespace app\common\library;
+use think\Controller;
+
+class AliPay3 extends Controller
+{
+    /*
+   配置参数
+   */
+    public function __construct()
+    {
+        $this->appId = "220431411";
+        $this->rsaPrivateKey =  "-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC95Mqn1Q9bTF0H
+ncQOXRCsP10I6U7f83OX2+8WMxMr30J8AX6QxU3sWRY/eDMPmnnSifsG6n1ZsgJQ
+DaN8CRFjsGGA6E0Fglphf0A22MkuTsyQRSAnhmQCQbjFetdrLUBGcwXzX9H1uLhe
+F8opCjK3YdnnIYfadlq5Y8Ogw5RsmjX7sRN2l6hvONPlrN5qKd0GjGbttfYrNgxt
+D7Upbr+MVZ//RoeN3DfGSmdPQjEMVrbnHaNp92hxdVTo2t0ZlqpsICJlDF8lFzFv
+0DVmn0tsR1rlCjmASy0LRLrIQJhp4ojhl2Jew8zx/XUEWQpyjsBGXETh4zeHXURa
+Cw8NsofrAgMBAAECggEAQirawqhm9XUiZWj/y9F54csia9x/82EtQhkMsjuRzpO4
+4uTSaTeW82gHbI5BnIpDMK2LntlOXFa+n45hDPNL7+Sh1P0c+XJ2c8qXYYUgdNZY
+SV0M2zjk2DR2YblwHpRh9SpXRHp6+pgnBgJcGvjGu0eJWhRA9kqPSlIM9JOxwDVR
+2RUn52VFmLqwe/QY3RlMTBS6lHxZqo8qwok+BsHAD79o5EDVKj64tvCD6Ew3WzZi
+NySctdRKt+GN/l4IWgwzll8dkMEZbqMhB6Kb4KAU0Bkzdqz539Q5CapNsYTTHW+j
+VbCq8LwhMyAkpUgWyjCxUNH6c6+AoApstKeMjiQoAQKBgQDskD6WPaAhxZcAFqDL
+Ei03LUmuypl4djuKJVWYdxPxTr3icAqd/gRfLojWRMT/5Ql/E62L0E/5uHa/Tx9P
+9A0lej8CS1NHrtE8JtXPjUF5jv+yNr7QyZkDF2tIBkSr5hMFBtSRBbsDYsRDPalB
+yHJ2XPdIOBoplzIcDxW2F921AQKBgQDNfutqYgdMkgrVH9hRv+e8bu4S1n08HbgJ
+/wn37TvsT/vRyWs/we6umkDia0zm0BDBeN8IGj+HVrLqcQQqAFADo1ToI8hQMH5f
+WVlsIq7JkRJY6MNPGaM40ZkQJ0C0H7GNZBDKP0LKX/2DU6j3loVEpfX3tkY0Gnb5
+2Ox0kE1g6wKBgF/I6A6dVUFXaBS5FNIkwfoddEA5+Ho2JVWCWG4riP+kCm6tPx9J
+wytnBDD+F2YlrvqtVQ/PgRJ0BmDgAKW3A7uxC+I57baQqlfYwaoQX/qAVDgswoZ3
+mmUODnpTT2rq9biLU3aFA3wTebRgOzBPoUkby2SKks1UUw3ZbckVUMgBAoGBALPw
+EN+kWtPXhZi9O8PJkHdVgy4Hlr2PIFnQcsAfgTsZhl1aS4kWnZNSCsK4RixNwH5J
+ArKrmTk+14el0omcoHOvD2f9/ScKb326VSz06awiVbh4iJy4zE2yap7UYDnZDrXK
+C1GtNyTSDMBz/x5dNPC5ibmQZ8Sz774zDkm7GaZlAoGBAMnbSMMXs+wuTCo4LI38
+hHANp5Ry8xUPzWyQ8N0XkF9PvUz/dnr/b+SRB2y4Xe5w2YGPp4OKBWRMJMjG2Pby
+8+lPXS6OalWyzsdPVuDEMbM5D54FmVlMIjvi1vTzsaYiHqoTydivaet/F87Dghpa
+U6MhZnBh1032L8aFVcn3q7fj
+-----END PRIVATE KEY-----
+"; //商户私钥
+        $this->aliPayRsaPublicKey = "-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp7+ID0TR1iN/5YUWkSzh
+8fG3+e+kj9gWbkU5j8jkGqG0fXE7uhKvhuPeUOvuAnVtUw8VKI6GssfFUafs0rMT
+4No/s8wF7AzndyD/YoqpCqe5xToPNVHZ+5JHa9K92alTvvcx1ukRfJp1SI0JHXg1
+goUhfUrLOXV2QSgoshBHUTocWuIY4CdKP1tVOelBMcwItY9KBujfs7WMUFibe6gg
+5V+KqYoK0uhpvZmFb9IHCGdujVdPGxL0tPH/hGBNrbgm1gOBubB9yEnH3hTj9gGg
+arcELZGyRi9HQU0haG3c79f4XDvirSTsnHnd7aIM9BKPdlkq8QZANGyuO7Rs1zkF
+CwIDAQAB
+-----END PUBLIC KEY-----";//平台公钥
+    }
+
+    /*
+     * 支付宝支付
+     */
+    public function aliPay($body, $total_amount, $order_no, $notify_url,$attach,$callbackurl)
+    {
+        $params = [
+            "service"=>"App.Order.Pay",
+            "timestamp"=>date('Y-m-d H:i:s'),
+            "nonce"=>time(),
+            "member_id"=>$this->appId,
+            "mem_order"=>$order_no,
+            "bank_code"=>"953",
+           // "notifyurl"=>"https://".$_SERVER['SERVER_NAME']."/api/Pay/alipayOrderNotify",
+            "notifyurl"=>$notify_url,
+           // "callbackurl"=>"https://".$_SERVER['SERVER_NAME']."/pages/mine/order-list?num=1",
+            "callbackurl"=>$callbackurl,
+            "amount"=>$total_amount,
+            "productname"=>$body,
+            "attach"=>$attach
+        ];
+        $apiKey = "4n79o0izlo0ax9z45lopjj0hgwl249bk";//商户中心的APIKEY
+
+        ksort($params);
+
+        $signString = "";
+        foreach($params as $key => $val){
+            $signString .= $val;
+        }
+        $signString .= $apiKey;
+
+        $params['sign'] = strtoupper(md5($signString));
+
+//    var_dump($params['sign']);
+        //到这里签名完成
+        //对notifyurl进行rsa加密
+        $params['notifyurl'] = $this->sslEn($params['notifyurl'],$this->rsaPrivateKey);//$key是商户私钥
+
+        //最后POST提交  $params
+        $url = "https://apis.wqkeji.cn";
+        $re = $this->httpPost($url,$params);//提交返回
+        //判断是否为数组
+        $re = is_array($re)?$re:json_decode($re,true);
+
+        //对data进行平台公钥解密
+        $data = $this->sslDe($re['data'], $this->aliPayRsaPublicKey);
+        return json_decode($data,true);
+    }
+
+
+
+    /**
+     * RSA 私钥、公钥加密
+     * @param $data
+     * @param $key
+     * @param $type
+     * @return string
+     */
+    function sslEn($data, $key, $type = 'pi')
+    {
+        $encrypted = "";
+        if ($type == 'pi') {
+            $r = openssl_pkey_get_private($key);
+            //私钥加密
+            foreach (str_split($data, 117) as $chunk) {
+                openssl_private_encrypt($chunk, $encryptData, $key);
+                $encrypted .= $encryptData;
+            }
+        } elseif ($type == 'pu') {
+            $r = openssl_pkey_get_public($key);
+            //公钥加密
+            foreach (str_split($data, 117) as $chunk) {
+                openssl_public_encrypt($chunk, $encryptData, $key);
+                $encrypted .= $encryptData;
+            }
+        }
+        $encrypt_data = base64_encode($encrypted);
+        return $encrypt_data;
+    }
+
+    /**
+     * RSA 私钥、公钥解密
+     * @param $data
+     * @param $key
+     * @param $type
+     * @return string
+     */
+    function sslDe($data, $key, $type = 'pu')
+    {
+        $hex_encrypt_data = trim($data);
+        $encrypt_data = base64_decode($hex_encrypt_data);//对BASE64进行转换
+        $decrypted = "";
+        if ($type == 'pu') {
+            $r = openssl_pkey_get_public($key);
+            //公钥解密
+            $arrThrunk = str_split($encrypt_data, 256);
+            foreach ($arrThrunk as $trunk) {
+                $temp = '';
+                if (openssl_public_decrypt($trunk, $temp, $key)) {
+                    $decrypted .= $temp;
+                } else {
+                    return '';
+                }
+            }
+        } elseif ($type == 'pi') {
+            $r = openssl_pkey_get_private($key);
+            //私钥解密  ---- 分段解密
+            $arrThrunk = str_split($encrypt_data, 256);
+            foreach ($arrThrunk as $trunk) {
+                $temp = '';
+                if (openssl_private_decrypt($trunk, $temp, $key)) {
+                    $decrypted .= $temp;
+                } else {
+                    return '';
+                }
+            }
+        }
+        return $decrypted;
+    }
+
+    /**
+     * RSA 私钥、公钥解密
+     * @param $data
+     * @param $key
+     * @param $type
+     * @return string
+     */
+    function sslDeReturn($data, $type = 'pu')
+    {
+        $key = $this->aliPayRsaPublicKey;
+        $hex_encrypt_data = trim($data);
+        $encrypt_data = base64_decode($hex_encrypt_data);//对BASE64进行转换
+        $decrypted = "";
+        if ($type == 'pu') {
+            $r = openssl_pkey_get_public($key);
+            //公钥解密
+            $arrThrunk = str_split($encrypt_data, 256);
+            foreach ($arrThrunk as $trunk) {
+                $temp = '';
+                if (openssl_public_decrypt($trunk, $temp, $key)) {
+                    $decrypted .= $temp;
+                } else {
+                    return '';
+                }
+            }
+        } elseif ($type == 'pi') {
+            $r = openssl_pkey_get_private($key);
+            //私钥解密  ---- 分段解密
+            $arrThrunk = str_split($encrypt_data, 256);
+            foreach ($arrThrunk as $trunk) {
+                $temp = '';
+                if (openssl_private_decrypt($trunk, $temp, $key)) {
+                    $decrypted .= $temp;
+                } else {
+                    return '';
+                }
+            }
+        }
+        return $decrypted;
+    }
+
+    //HTTP post 工具
+    function httpPost($url, $post_data)
+    {
+        // 模拟提交数据函数
+        $curl = curl_init(); // 启动一个CURL会话
+        curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
+        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查
+        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
+        if (isset($_SERVER['HTTP_USER_AGENT'])) {
+            curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
+        }
+        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
+        curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
+        if (!empty($post_data)) {
+            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_data)); // Post提交的数据包
+        }
+        curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
+        curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
+        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
+        // 发出请求
+        $response = curl_exec($curl);
+        curl_close($curl); // 关闭CURL会话
+        return $response;
+    }
+
+}

+ 613 - 0
app/common/library/Auth.php

@@ -0,0 +1,613 @@
+<?php
+
+namespace app\common\library;
+
+use app\common\model\User;
+use app\common\model\UserRule;
+use fast\Random;
+use think\Config;
+use think\Db;
+use think\Hook;
+use think\Request;
+use think\Validate;
+
+class Auth
+{
+
+    protected static $instance = null;
+    protected $_error = '';
+    protected $_logined = FALSE;
+    protected $_user = NULL;
+    protected $_token = '';
+    //Token默认有效时长
+    protected $keeptime = 2592000;
+    protected $requestUri = '';
+    protected $rules = [];
+    //默认配置
+    protected $config = [];
+    protected $options = [];
+    protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score','money','city','gender'];
+
+    public function __construct($options = [])
+    {
+        if ($config = Config::get('user'))
+        {
+            $this->config = array_merge($this->config, $config);
+        }
+        $this->options = array_merge($this->config, $options);
+    }
+
+    /**
+     * 
+     * @param array $options 参数
+     * @return Auth
+     */
+    public static function instance($options = [])
+    {
+        if (is_null(self::$instance))
+        {
+            self::$instance = new static($options);
+        }
+
+        return self::$instance;
+    }
+
+    /**
+     * 获取User模型
+     * @return User
+     */
+    public function getUser()
+    {
+        return $this->_user;
+    }
+
+    /**
+     * 兼容调用user模型的属性
+     * 
+     * @param string $name
+     * @return mixed
+     */
+    public function __get($name)
+    {
+        return $this->_user ? $this->_user->$name : NULL;
+    }
+
+    /**
+     * 根据Token初始化
+     *
+     * @param string       $token    Token
+     * @return boolean
+     */
+    public function init($token)
+    {
+        if ($this->_logined)
+        {
+            return TRUE;
+        }
+        if ($this->_error)
+            return FALSE;
+        $data = Token::get($token);
+        if (!$data)
+        {
+            return FALSE;
+        }
+        $user_id = intval($data['user_id']);
+        if ($user_id > 0)
+        {
+            $user = User::get($user_id);
+            if (!$user)
+            {
+                $this->setError('Account not exist');
+                return FALSE;
+            }
+            if ($user['status'] != 'normal')
+            {
+                $this->setError('Account is locked');
+                return FALSE;
+            }
+            $this->_user = $user;
+            $this->_logined = TRUE;
+            $this->_token = $token;
+
+            //初始化成功的事件
+            Hook::listen("user_init_successed", $this->_user);
+
+            return TRUE;
+        }
+        else
+        {
+            $this->setError('You are not logged in');
+            return FALSE;
+        }
+    }
+
+    /**
+     * 注册用户
+     *
+     * @param string $username  用户名
+     * @param string $password  密码
+     * @param string $email     邮箱
+     * @param string $mobile    手机号
+     * @param array $extend    扩展参数
+     * @return boolean
+     */
+    public function register($username, $password, $email = '', $mobile = '', $extend = [])
+    {
+        // 检测用户名或邮箱、手机号是否存在
+        if (User::getByUsername($username))
+        {
+            $this->setError('Username already exist');
+            return FALSE;
+        }
+        if ($email && User::getByEmail($email))
+        {
+            $this->setError('Email already exist');
+            return FALSE;
+        }
+        //if ($mobile && User::getByMobile($mobile))
+        //{
+        //    $this->setError('Mobile already exist');
+        //    return FALSE;
+        //}
+
+        $ip = request()->ip();
+        $time = time();
+
+        $data = [
+            'username' => $username,
+            'password' => $password,
+            'email'    => $email,
+            'mobile'   => $mobile,
+            'level'    => 1,
+            'score'    => 0,
+            'avatar'   => '',
+        ];
+        $params = array_merge($data, [
+            'nickname'  => $username,
+            'salt'      => Random::alnum(),
+            'jointime'  => $time,
+            'joinip'    => $ip,
+            'logintime' => $time,
+            'loginip'   => $ip,
+            'prevtime'  => $time,
+            'status'    => 'normal'
+        ]);
+        $params['password'] = $this->getEncryptPassword($password, $params['salt']);
+        $params = array_merge($params, $extend);
+
+        //账号注册时需要开启事务,避免出现垃圾数据
+        Db::startTrans();
+        try
+        {
+            $user = User::create($params);
+            Db::commit();
+
+            // 此时的Model中只包含部分数据
+            $this->_user = User::get($user->id);
+
+            //设置Token
+            $this->_token = Random::uuid();
+            Token::set($this->_token, $user->id, $this->keeptime);
+
+            //注册成功的事件
+            Hook::listen("user_register_successed", $this->_user);
+
+            return TRUE;
+        }
+        catch (Exception $e)
+        {
+            $this->setError($e->getMessage());
+            Db::rollback();
+            return FALSE;
+        }
+    }
+
+    /**
+     * 用户登录
+     *
+     * @param string    $account    账号,用户名、邮箱、手机号
+     * @param string    $password   密码
+     * @return boolean
+     */
+    public function login($account, $password)
+    {
+        $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username');
+        $user = User::get([$field => $account]);
+        if (!$user)
+        {
+            $this->setError('Account is incorrect');
+            return FALSE;
+        }
+
+        if (!empty($user->email_chkcode))
+        {
+            $this->setError('请验证邮箱后登陆');
+            return FALSE;
+        }
+
+        if ($user->status != 'normal')
+        {
+            $this->setError('Account is locked');
+            return FALSE;
+        }
+        if ($user->password != $this->getEncryptPassword($password, $user->salt))
+        {
+            $this->setError('Password is incorrect');
+            return FALSE;
+        }
+
+        //直接登录会员
+        $this->direct($user->id);
+
+        return TRUE;
+    }
+
+    /**
+     * 注销
+     * 
+     * @return boolean
+     */
+    public function logout()
+    {
+        if (!$this->_logined)
+        {
+            $this->setError('You are not logged in');
+            return false;
+        }
+        //设置登录标识
+        $this->_logined = FALSE;
+        //删除Token
+        Token::delete($this->_token);
+        //注销成功的事件
+        Hook::listen("user_logout_successed", $this->_user);
+        return TRUE;
+    }
+
+    /**
+     * 修改密码
+     * @param string    $newpassword        新密码
+     * @param string    $oldpassword        旧密码
+     * @param bool      $ignoreoldpassword  忽略旧密码
+     * @return boolean
+     */
+    public function changepwd($newpassword, $oldpassword = '', $ignoreoldpassword = false)
+    {
+        if (!$this->_logined)
+        {
+            $this->setError('You are not logged in');
+            return false;
+        }
+        //判断旧密码是否正确
+        if ($this->_user->password == $this->getEncryptPassword($oldpassword, $this->_user->salt) || $ignoreoldpassword)
+        {
+            $salt = Random::alnum();
+            $newpassword = $this->getEncryptPassword($newpassword, $salt);
+            $this->_user->save(['password' => $newpassword, 'salt' => $salt]);
+
+            Token::delete($this->_token);
+            //修改密码成功的事件
+            Hook::listen("user_changepwd_successed", $this->_user);
+            return true;
+        }
+        else
+        {
+            $this->setError('Password is incorrect');
+            return false;
+        }
+    }
+
+    /**
+     * 直接登录账号
+     * @param int $user_id
+     * @return boolean
+     */
+    public function direct($user_id)
+    {
+        $user = User::get($user_id);
+        if ($user)
+        {
+            ////////////////同步到Ucenter////////////////
+            if (defined('UC_STATUS') && UC_STATUS)
+            {
+                $uc = new \addons\ucenter\library\client\Client();
+                $re = $uc->uc_user_login($this->user->id, $this->user->password . '#split#' . $this->user->salt, 3);
+                // 如果小于0则说明发生错误
+                if ($re <= 0)
+                {
+                    $this->setError('Username or password is incorrect');
+                    return FALSE;
+                }
+            }
+
+            $ip = request()->ip();
+            $time = time();
+
+            //判断连续登录和最大连续登录
+            if ($user->logintime < \fast\Date::unixtime('day'))
+            {
+                $user->successions = $user->logintime < \fast\Date::unixtime('day', -1) ? 1 : $user->successions + 1;
+                $user->maxsuccessions = max($user->successions, $user->maxsuccessions);
+            }
+
+            $user->prevtime = $user->logintime;
+            //记录本次登录的IP和时间
+            $user->loginip = $ip;
+            $user->logintime = $time;
+
+            $user->save();
+
+            $this->_user = $user;
+
+            $this->_token = Random::uuid();
+            Token::set($this->_token, $user->id, $this->keeptime);
+
+            $this->_logined = TRUE;
+
+            //登录成功的事件
+            Hook::listen("user_login_successed", $this->_user);
+            return TRUE;
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+
+    /**
+     * 检测是否是否有对应权限
+     * @param string $path      控制器/方法
+     * @param string $module    模块 默认为当前模块
+     * @return boolean
+     */
+    public function check($path = NULL, $module = NULL)
+    {
+        if (!$this->_logined)
+            return false;
+
+        $ruleList = $this->getRuleList();
+        $rules = [];
+        foreach ($ruleList as $k => $v)
+        {
+            $rules[] = $v['name'];
+        }
+        $url = ($module ? $module : request()->module()) . '/' . (is_null($path) ? $this->getRequestUri() : $path);
+        $url = strtolower(str_replace('.', '/', $url));
+        return in_array($url, $rules) ? TRUE : FALSE;
+    }
+
+    /**
+     * 判断是否登录
+     * @return boolean
+     */
+    public function isLogin()
+    {
+        if ($this->_logined)
+        {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 获取当前Token
+     * @return string
+     */
+    public function getToken()
+    {
+        return $this->_token;
+    }
+
+    /**
+     * 获取会员基本信息
+     */
+    public function getUserinfo()
+    {
+        $data = $this->_user->toArray();
+        $allowFields = $this->getAllowFields();
+        $userinfo = array_intersect_key($data, array_flip($allowFields));
+        $userinfo = array_merge($userinfo, Token::get($this->_token));
+        return $userinfo;
+    }
+
+    /**
+     * 获取会员组别规则列表
+     * @return array
+     */
+    public function getRuleList()
+    {
+        if ($this->rules)
+            return $this->rules;
+        $group = $this->_user->group;
+        if (!$group)
+        {
+            return [];
+        }
+        $rules = explode(',', $group->rules);
+        $this->rules = UserRule::where('status', 'normal')->where('id', 'in', $rules)->field('id,pid,name,title,ismenu')->select();
+        return $this->rules;
+    }
+
+    /**
+     * 获取当前请求的URI
+     * @return string
+     */
+    public function getRequestUri()
+    {
+        return $this->requestUri;
+    }
+
+    /**
+     * 设置当前请求的URI
+     * @param string $uri
+     */
+    public function setRequestUri($uri)
+    {
+        $this->requestUri = $uri;
+    }
+
+    /**
+     * 获取允许输出的字段
+     * @return array
+     */
+    public function getAllowFields()
+    {
+        return $this->allowFields;
+    }
+
+    /**
+     * 设置允许输出的字段
+     * @param array $fields
+     */
+    public function setAllowFields($fields)
+    {
+        $this->allowFields = $fields;
+    }
+
+    /**
+     * 删除一个指定会员
+     * @param int $user_id 会员ID
+     * @return boolean
+     */
+    public function delete($user_id)
+    {
+        $user = User::get($user_id);
+        if (!$user)
+        {
+            return FALSE;
+        }
+
+        ////////////////同步到Ucenter////////////////
+        if (defined('UC_STATUS') && UC_STATUS)
+        {
+            $uc = new \addons\ucenter\library\client\Client();
+            $re = $uc->uc_user_delete($user['id']);
+            // 如果小于0则说明发生错误
+            if ($re <= 0)
+            {
+                $this->setError('Account is locked');
+                return FALSE;
+            }
+        }
+
+        // 调用事务删除账号
+        $result = Db::transaction(function($db) use($user_id) {
+                    // 删除会员
+                    User::destroy($user_id);
+                    // 删除会员指定的所有Token
+                    Token::clear($user_id);
+                    return TRUE;
+                });
+        if ($result)
+        {
+            Hook::listen("user_delete_successed", $user);
+        }
+        return $result ? TRUE : FALSE;
+    }
+
+    /**
+     * 获取密码加密后的字符串
+     * @param string $password  密码
+     * @param string $salt      密码盐
+     * @return string
+     */
+    public function getEncryptPassword($password, $salt = '')
+    {
+        return md5(md5($password) . $salt);
+    }
+
+    /**
+     * 检测当前控制器和方法是否匹配传递的数组
+     *
+     * @param array $arr 需要验证权限的数组
+     * @return boolean
+     */
+    public function match($arr = [])
+    {
+        $request = Request::instance();
+        $arr = is_array($arr) ? $arr : explode(',', $arr);
+        if (!$arr)
+        {
+            return FALSE;
+        }
+        $arr = array_map('strtolower', $arr);
+        // 是否存在
+        if (in_array(strtolower($request->action()), $arr) || in_array('*', $arr))
+        {
+            return TRUE;
+        }
+
+        // 没找到匹配
+        return FALSE;
+    }
+
+    /**
+     * 设置会话有效时间
+     * @param int $keeptime 默认为永久
+     */
+    public function keeptime($keeptime = 0)
+    {
+        $this->keeptime = $keeptime;
+    }
+
+    /**
+     * 渲染用户数据
+     * @param array     $datalist   二维数组
+     * @param mixed     $fields     加载的字段列表
+     * @param string    $fieldkey   渲染的字段
+     * @param string    $renderkey  结果字段
+     * @return array
+     */
+    public function render(&$datalist, $fields = [], $fieldkey = 'user_id', $renderkey = 'userinfo')
+    {
+        $fields = !$fields ? ['id', 'nickname', 'level', 'avatar'] : (is_array($fields) ? $fields : explode(',', $fields));
+        $ids = [];
+        foreach ($datalist as $k => $v)
+        {
+            if (!isset($v[$fieldkey]))
+                continue;
+            $ids[] = $v[$fieldkey];
+        }
+        $list = [];
+        if ($ids)
+        {
+            if (!in_array('id', $fields))
+            {
+                $fields[] = 'id';
+            }
+            $ids = array_unique($ids);
+            $selectlist = User::where('id', 'in', $ids)->column($fields);
+            foreach ($selectlist as $k => $v)
+            {
+                $list[$v['id']] = $v;
+            }
+        }
+        foreach ($datalist as $k => &$v)
+        {
+            $v[$renderkey] = isset($list[$v[$fieldkey]]) ? $list[$v[$fieldkey]] : NULL;
+        }
+        unset($v);
+        return $datalist;
+    }
+
+    /**
+     * 设置错误信息
+     *
+     * @param $error 错误信息
+     * @return Auth
+     */
+    public function setError($error)
+    {
+        $this->_error = $error;
+        return $this;
+    }
+
+    /**
+     * 获取错误信息
+     * @return string
+     */
+    public function getError()
+    {
+        return $this->_error ? __($this->_error) : '';
+    }
+
+}

+ 304 - 0
app/common/library/Common.php

@@ -0,0 +1,304 @@
+<?php
+
+namespace app\common\library;
+
+use app\common\model\Config;
+use app\common\model\OrderStatus;
+use app\common\model\User;
+use think\Hook;
+use think\Request;
+use app\common\library\QRcode;
+
+/**
+ * 公共类
+ */
+class Common
+{
+
+    /**
+     * curl 请求
+     * @param $url string 请求地址
+     * @param $headers json 请求头
+     * @param $body json 请求体
+     * @return mixed
+     */
+    public static function curlRequest($url, $headers = [], $body = [], $method = "GET")
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);//设置请求头
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $body);//设置请求体
+        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); //定义请求类型
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_HTTP_VERSION, 'CURL_HTTP_VERSION_1_1');
+        $output = curl_exec($ch);
+        curl_close($ch);
+        $arr = json_decode($output, true);
+        return $arr;
+    }
+    /**
+     * 成功
+     * @param $msg
+     * @return array
+     */
+    public static function return_success($msg,$data = null){
+        $result = [
+            'code' => 1,
+            'msg'  => $msg,
+            'data' =>$data
+        ];
+        return $result;
+        die;
+    }
+
+    /**
+     * 失败
+     * @param $msg
+     * @return array
+     */
+    public static function return_error($msg,$data = null){
+        $result = [
+            'code' => 0,
+            'msg'  => $msg,
+            'data' => $data
+        ];
+        return $result;
+        die;
+    }
+
+
+    public static function get_ffid($invite_code){
+        $f = \app\common\model\User::where('id',$invite_code)->field('fid')->find();
+        if ($f)
+            return $f->fid;
+        else
+            return 0;
+    }
+
+
+    /**
+     * 生成二维码
+     */
+    public static function generate_qrcode($value){
+        $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/verify';
+        if(!file_exists($dir)){
+            //检查是否有该文件夹,如果没有就创建,并给予最高权限
+            mkdir($dir, 0700,true);
+        }
+        $filename = $dir.'/'.$value.'.png';
+        QRcode::png($value,$filename);
+        return 'http://'.$_SERVER['SERVER_NAME']."/verify/".$value.'.png';
+    }
+
+
+    /**
+     * 生成二维码
+     */
+    public static function setqrcode($value,$name){
+        $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/user';
+        if(!file_exists($dir)){
+            //检查是否有该文件夹,如果没有就创建,并给予最高权限
+            mkdir($dir, 0700,true);
+        }
+        $filename = $dir.'/'.$name.'.png';
+        QRcode::png($value,$filename,QR_ECLEVEL_L,7);
+        return 'http://'.$_SERVER['SERVER_NAME']."/user/".$name.'.png';
+    }
+
+    public static function setintivecode($user_id,$type){
+        $g = $type==1 ? 'invite' : 'mer';
+        $name = $g.$user_id."_".time();
+        $address = 'http://'.$_SERVER['SERVER_NAME'].'/build/#/'.$type.'/'.$user_id;
+        $url = self::setqrcode($address,$name);
+        return $url;
+    }
+
+
+    /**
+     * 订单操作记录
+     * @param int $change_message    操作备注
+     * @param int $oid  订单id
+     */
+    public static function order_status($oid, $change_message)
+    {
+        OrderStatus::create(['oid' => $oid,'change_message' => $change_message, 'change_time' => time()]);
+    }
+
+
+    /**
+     * 判断金额在哪个区间
+     */
+    public static function checkMoneyGrade($money){
+        if ($money<50000){
+            return false;
+        }elseif ($money>=50000 && $money<150000){
+            return 50000;
+        }elseif ($money>=150000 && $money<450000){
+            return 150000;
+        }elseif ($money>=450000 && $money<1350000){
+            return 450000;
+        }elseif ($money>=1350000 && $money<4000000){
+            return 1350000;
+        }elseif ($money>=4000000 && $money<12000000){
+            return 4000000;
+        }elseif ($money>=12000000 && $money<36000000){
+            return 12000000;
+        }elseif ($money>=36000000 && $money<100000000){
+            return 36000000;
+        }elseif ($money>=100000000 && $money<300000000){
+            return 100000000;
+        }elseif ($money>=300000000 && $money<600000000){
+            return 300000000;
+        }elseif ($money>=600000000){
+            return 600000000;
+        }
+    }
+
+
+    /**
+     * 生成订单唯一id
+     * $user_id  用户id
+     * @return string
+     */
+    public static function getNewOrderId($user_id)
+    {
+        $str = date('Ymd').$user_id.substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
+        return $str;
+    }
+
+
+
+    /**
+     * 身份证验证
+     * @param $card
+     * @return bool
+     */
+    public static function setCard($card){
+        $city = [11=>"北京",12=>"天津",13=>"河北",14=>"山西",15=>"内蒙古",21=>"辽宁",22=>"吉林",23=>"黑龙江 ",31=>"上海",32=>"江苏",33=>"浙江",34=>"安徽",35=>"福建",36=>"江西",37=>"山东",41=>"河南",42=>"湖北 ",43=>"湖南",44=>"广东",45=>"广西",46=>"海南",50=>"重庆",51=>"四川",52=>"贵州",53=>"云南",54=>"西藏 ",61=>"陕西",62=>"甘肃",63=>"青海",64=>"宁夏",65=>"新疆",71=>"台湾",81=>"香港",82=>"澳门",91=>"国外 "];
+        $tip = "";
+        $match = "/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/";
+        $pass= true;
+        if(!$card || !preg_match($match,$card)){
+            //身份证格式错误
+            $pass = false;
+        }else if(!$city[substr($card,0,2)]){
+            //地址错误
+            $pass = false;
+        }else{
+            //18位身份证需要验证最后一位校验位
+            if(strlen($card) == 18){
+                $card = str_split($card);
+                //∑(ai×Wi)(mod 11)
+                //加权因子
+                $factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
+                //校验位
+                $parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
+                $sum = 0;
+                $ai = 0;
+                $wi = 0;
+                for ($i = 0; $i < 17; $i++)
+                {
+                    $ai = $card[$i];
+                    $wi = $factor[$i];
+                    $sum += $ai * $wi;
+                }
+                $last = $parity[$sum % 11];
+                if($parity[$sum % 11] != $card[17]){
+                    $pass =false;
+                }
+            }else{
+                $pass =false;
+            }
+        }
+        if(!$pass) return false;/* 身份证格式错误*/
+        return true;/* 身份证格式正确*/
+    }
+
+
+
+    /**
+     * 高德地图api根据ip获取地区
+     */
+    public static function gaoDegetAreaToIp(){
+        $ip = request()->ip();
+        $content = file_get_contents("http://restapi.amap.com/v3/ip?key=7b60be14348558ca73ea081b3e871c6e&ip={$ip}");
+        $json = json_decode($content,true);
+        return $json;
+    }
+
+
+
+
+
+    /**
+     * 获取当前的经纬度
+     */
+    public static function get_ipjwd(){
+        $ip = request()->ip();
+        //获取百度地图apikey
+        $api_key = Config::get_values('baidu_api_server');
+        if ($ip=='127.0.0.1') {//如果获取到的ip为127.0.0.1 会报错  在这随便给一个ip
+            $ip='58.30.228.35';
+        }
+        $content = file_get_contents("http://api.map.baidu.com/location/ip?ak=$api_key&ip={$ip}&coor=bd09ll");
+        $json = json_decode($content);
+        $data=array();
+        $data['log']=$json->{'content'}->{'point'}->{'x'};//按层级关系提取经度数据
+        $data['lat']=$json->{'content'}->{'point'}->{'y'};//按层级关系提取纬度数据
+        $data['address']=$json->{'content'}->{'address'};//按层级关系提取address数据
+        return $data;
+    }
+
+
+    /**
+     * 计算距离
+     * 1.纬度1,经度1,纬度2,经度2
+     * 2.返回结果是单位是KM。
+     * 3.保留一位小数
+    */
+    public static function getDistance($lat2,$lng2,$lat='',$log='')
+    {
+        $user = app()->session->get('us');
+        $userinfo = User::get($user['id']);
+        if ($lat && $log) {
+            $lng1 = $log;
+            $lat1 = $lat;
+        }elseif ($userinfo && $userinfo['now_lat'] && $userinfo['now_log']){
+            $lng1 = $userinfo['now_log'];
+            $lat1 = $userinfo['now_lat'];
+        }else{
+            return "0";
+        }
+
+//        $userinfo = User::get($user['id']);
+//        if ($userinfo && $userinfo['now_lat'] && $userinfo['now_log']){
+//            $lng1 = $userinfo['now_log'];
+//            $lat1 = $userinfo['now_lat'];
+//        }else{
+//            if (!$lat2 || !$lng2)
+//                return '1';
+//            $ip = request()->ip();
+//            //获取百度地图apikey
+//            $api_key = Config::get_values('baidu_api_server');
+//            if ($ip=='127.0.0.1') {//如果获取到的ip为127.0.0.1 会报错  在这随便给一个ip
+//                $ip='58.30.228.35';
+//            }
+//            $content = file_get_contents("http://api.map.baidu.com/location/ip?ak=$api_key&ip={$ip}&coor=bd09ll");
+//            $json = json_decode($content);
+//            $lng1=$json->{'content'}->{'point'}->{'x'};//按层级关系提取经度数据
+//            $lat1=$json->{'content'}->{'point'}->{'y'};//按层级关系提取纬度数据
+//        }
+        //将角度转为狐度
+        $radLat1 = deg2rad($lat1);//deg2rad()函数将角度转换为弧度
+        $radLat2 = deg2rad($lat2);
+        $radLng1 = deg2rad($lng1);
+        $radLng2 = deg2rad($lng2);
+        $a = $radLat1 - $radLat2;
+        $b = $radLng1 - $radLng2;
+        $s = 2*asin(sqrt(pow(sin($a/2),2)+cos($radLat1)*cos($radLat2)*pow(sin($b/2),2)))*6371;
+        return round($s,1);
+    }
+
+}

+ 197 - 0
app/common/library/Email.php

@@ -0,0 +1,197 @@
+<?php
+
+namespace app\common\library;
+
+use PHPMailer\PHPMailer\PHPMailer;
+use think\Config;
+
+class Email
+{
+
+    /**
+     * 单例对象
+     */
+    protected static $instance;
+
+    /**
+     * phpmailer对象
+     */
+    protected $mail = [];
+
+    /**
+     * 错误内容
+     */
+    protected $_error = '';
+
+    /**
+     * 默认配置
+     */
+    public $options = [
+        'charset' => 'utf-8', //编码格式
+        'debug'   => 0, //调式模式
+    ];
+
+    /**
+     * 初始化
+     * @access public
+     * @param array $options 参数
+     * @return Email
+     */
+    public static function instance($options = [])
+    {
+        if (is_null(self::$instance))
+        {
+            self::$instance = new static($options);
+        }
+
+        return self::$instance;
+    }
+
+    /**
+     * 构造函数
+     * @param array $options
+     */
+    public function __construct($options = [])
+    {
+        if ($config = Config::get('smtp'))
+        {
+            $this->options = array_merge($this->options, $config);
+        }
+
+        $this->options = array_merge($this->options, $options);
+        vendor('phpmailer.phpmailer.PHPMailerAutoload');
+        $securArr = [1 => 'tls', 2 => 'ssl'];
+
+        $this->mail = new PHPMailer(true);
+        $this->mail->CharSet = $this->options['charset'];
+        $this->mail->SMTPDebug = $this->options['debug'];
+        $this->mail->isSMTP();
+        $this->mail->SMTPAuth = true;
+        $this->mail->Host = $this->options['server'];
+        $this->mail->Username = $this->options['smtpuser'];
+        $this->mail->Password = $this->options['smtpass'];
+        $this->mail->SMTPSecure = isset($securArr[$this->options['smttype']]) ? $securArr[$this->options['smttype']] : '';
+        $this->mail->Port = $this->options['serverport'];
+        //设置发件人
+        $this->from($this->options['usermail']);
+    }
+
+    /**
+     * 设置邮件主题
+     * @param string $subject
+     * @return $this
+     */
+    public function subject($subject)
+    {
+        $this->options['subject'] = $subject;
+        return $this;
+    }
+
+    /**
+     * 设置发件人
+     * @param string $email
+     * @param string $name
+     * @return $this
+     */
+    public function from($email, $name = '')
+    {
+        $this->options['from'] = $email;
+        $this->options['from_name'] = $name;
+        return $this;
+    }
+
+    /**
+     * 设置收件人
+     * @param string $email
+     * @param string $name
+     * @return $this
+     */
+    public function to($email, $name = '')
+    {
+        $this->options['to'] = $email;
+        $this->options['to_name'] = $name;
+        return $this;
+    }
+
+    /**
+     * 设置邮件正文
+     * @param string $body
+     * @param boolean $ishtml
+     * @return $this
+     */
+    public function message($body, $ishtml = true)
+    {
+        $this->options['body'] = $body;
+        $this->options['ishtml'] = $ishtml;
+        return $this;
+    }
+
+    /**
+     * 获取最后产生的错误
+     * @return string
+     */
+    public function getError()
+    {
+        return $this->_error;
+    }
+
+    /**
+     * 设置错误
+     * @param string $error 信息信息
+     */
+    protected function setError($error)
+    {
+        $this->_error = $error;
+    }
+
+    /**
+     * 发送邮件
+     * @return boolean
+     */
+    public function send()
+    {
+        $result = false;
+        switch ($this->options['mail_type'])
+        {
+            case 1:
+                //使用phpmailer发送
+                $this->mail->setFrom($this->options['from'], $this->options['from_name']);
+                $this->mail->addAddress($this->options['to'], $this->options['to_name']);
+                $this->mail->Subject = $this->options['subject'];
+                if ($this->options['ishtml'])
+                {
+                    $this->mail->msgHTML($this->options['body']);
+                }
+                else
+                {
+                    $this->mail->Body = $this->options['body'];
+                }
+                try
+                {
+                    $result = $this->mail->send();
+                }
+                catch (\phpmailerException $e)
+                {
+                    $this->setError($e->getMessage());
+                }
+
+                $this->setError($result ? '' : $this->mail->ErrorInfo);
+                break;
+            case 2:
+                //使用mail方法发送邮件
+                $headers = 'MIME-Version: 1.0' . "\r\n";
+                $headers .= "Content-type: text/html; charset=" . $this->options['charset'] . "\r\n";
+                $headers .= "To: {$this->options['to_name']} <{$this->options['to']}>\r\n"; //收件人
+                $headers .= "From: {$this->options['from_name']} <{$this->options['from']}>\r\n"; //发件人
+                $result = mail($this->options['to'], $this->options['subject'], $this->options['body'], $headers);
+                $this->setError($result ? '' : error_get_last()['message']);
+                break;
+            default:
+                //邮件功能已关闭
+                $this->setError(__('Mail already closed'));
+                break;
+        }
+        return $result;
+    }
+
+}

+ 144 - 0
app/common/library/Ems.php

@@ -0,0 +1,144 @@
+<?php
+
+namespace app\common\library;
+
+use think\Hook;
+
+/**
+ * 邮箱验证码类
+ */
+class Ems
+{
+
+    /**
+     * 验证码有效时长
+     * @var int 
+     */
+    protected static $expire = 120;
+
+    /**
+     * 最大允许检测的次数
+     * @var int 
+     */
+    protected static $maxCheckNums = 10;
+
+    /**
+     * 获取最后一次邮箱发送的数据
+     *
+     * @param   int       $email   邮箱
+     * @param   string    $event    事件
+     * @return  Ems
+     */
+    public static function get($email, $event = 'default')
+    {
+        $ems = \app\common\model\Ems::
+                where(['email' => $email, 'event' => $event])
+                ->order('id', 'DESC')
+                ->find();
+        Hook::listen('ems_get', $ems, null, true);
+        return $ems ? $ems : NULL;
+    }
+
+    /**
+     * 发送验证码
+     *
+     * @param   int       $email   邮箱
+     * @param   int       $code     验证码,为空时将自动生成4位数字
+     * @param   string    $event    事件
+     * @return  boolean
+     */
+    public static function send($email, $code = NULL, $event = 'default')
+    {
+        $code = is_null($code) ? mt_rand(1000, 9999) : $code;
+        $time = time();
+        $ip = request()->ip();
+        $ems = \app\common\model\Ems::create(['event' => $event, 'email' => $email, 'code' => $code, 'ip' => $ip, 'createtime' => $time]);
+        $result = Hook::listen('ems_send', $ems, null, true);
+        if (!$result)
+        {
+            $ems->delete();
+            return FALSE;
+        }
+        return TRUE;
+    }
+
+    /**
+     * 发送通知
+     * 
+     * @param   mixed     $email   邮箱,多个以,分隔
+     * @param   string    $msg      消息内容
+     * @param   string    $template 消息模板
+     * @return  boolean
+     */
+    public static function notice($email, $msg = '', $template = NULL)
+    {
+        $params = [
+            'email'    => $email,
+            'msg'      => $msg,
+            'template' => $template
+        ];
+        $result = Hook::listen('ems_notice', $params, null, true);
+        return $result ? TRUE : FALSE;
+    }
+
+    /**
+     * 校验验证码
+     *
+     * @param   int       $email     邮箱
+     * @param   int       $code       验证码
+     * @param   string    $event      事件
+     * @return  boolean
+     */
+    public static function check($email, $code, $event = 'default')
+    {
+        $time = time() - self::$expire;
+        $ems = \app\common\model\Ems::where(['email' => $email, 'event' => $event])
+                ->order('id', 'DESC')
+                ->find();
+        if ($ems)
+        {
+            if (strtotime($ems['createtime']) > $time && $ems['times'] <= self::$maxCheckNums)
+            {
+                $correct = $code == $ems['code'];
+                if (!$correct)
+                {
+                    $ems->times = $ems->times + 1;
+                    $ems->save();
+                    return FALSE;
+                }
+                else
+                {
+                    $result = Hook::listen('ems_check', $ems, null, true);
+                    return TRUE;
+                }
+            }
+            else
+            {
+                // 过期则清空该邮箱验证码
+                self::flush($email, $event);
+                return FALSE;
+            }
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+
+    /**
+     * 清空指定邮箱验证码
+     *
+     * @param   int       $email     邮箱
+     * @param   string    $event      事件
+     * @return  boolean
+     */
+    public static function flush($email, $event = 'default')
+    {
+        \app\common\model\Ems::
+                where(['email' => $email, 'event' => $event])
+                ->delete();
+        Hook::listen('ems_flush');
+        return TRUE;
+    }
+
+}

+ 142 - 0
app/common/library/Hecheng.php

@@ -0,0 +1,142 @@
+<?php
+namespace app\common\library;
+
+use app\common\model\Config;
+use think\Controller;
+
+class Hecheng extends Controller
+{
+    //获取预支付订单
+    public function hecheng($money,$pay_type){
+        # 填写网页上申请的appkey 如 $apiKey="g8eBUMSokVB1BHGmgxxxxxx"
+        $apiKey = "9sjcD2OQB71wBwGMEdGOvh2l";
+# 填写网页上申请的APP SECRET 如 $secretKey="94dc99566550d87f8fa8ece112xxxxx"
+        $secretKey = "j4VzpHUmraneN6wNCiSx3lkMKoNXWa0X";
+
+# text 的内容为"欢迎使用百度语音合成"的urlencode,utf-8 编码
+# 可以百度搜索"urlencode"
+        if ($pay_type=='weixin' || $pay_type=='yue'){
+            $text = "全民创商家微信收款".$money."元。";
+        }elseif ($pay_type=='zfb'){
+            $text = "全民创商家支付宝收款".$money."元。";
+        }
+
+        $text2 = iconv("UTF-8", "GBK", $text);
+
+# 发音人选择, 基础音库:0为度小美,1为度小宇,3为度逍遥,4为度丫丫,
+# 精品音库:5为度小娇,103为度米朵,106为度博文,110为度小童,111为度小萌,默认为度小美
+        $per = 0;
+#语速,取值0-15,默认为5中语速
+        $spd = 4;
+#音调,取值0-15,默认为5中语调
+        $pit = 5;
+#音量,取值0-9,默认为5中音量
+        $vol = 6;
+// 下载的文件格式, 3:mp3(default) 4: pcm-16k 5: pcm-8k 6. wav
+        $aue = 3;
+
+        $formats = array(3 => 'mp3', 4 => 'pcm', 5 =>'pcm', 6 => 'wav');
+        $format = $formats[$aue];
+
+        $cuid = time();
+
+        /** 公共模块获取token开始 */
+
+        $auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=".$apiKey."&client_secret=".$secretKey;
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $auth_url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //信任任何证书
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 检查证书中是否设置域名,0不验证
+        curl_setopt($ch, CURLOPT_VERBOSE, false);
+        $res = curl_exec($ch);
+        if(curl_errno($ch))
+        {
+            print curl_error($ch);
+        }
+        curl_close($ch);
+
+        $response = json_decode($res, true);
+
+        if (!isset($response['access_token'])){
+            echo "ERROR TO OBTAIN TOKEN\n";
+            exit(1);
+        }
+        if (!isset($response['scope'])){
+            echo "ERROR TO OBTAIN scopes\n";
+            exit(2);
+        }
+
+        if (!in_array('audio_tts_post',explode(" ", $response['scope']))){
+            echo "DO NOT have tts permission\n";
+            // 请至网页上应用内开通语音合成权限
+            exit(3);
+        }
+
+        $token = $response['access_token'];
+        /** 公共模块获取token结束 */
+
+        /** 拼接参数开始 **/
+// tex=$text&lan=zh&ctp=1&cuid=$cuid&tok=$token&per=$per&spd=$spd&pit=$pit&vol=$vol
+        $params = array(
+            'tex' => urlencode($text), // 为避免+等特殊字符没有编码,此处需要2次urlencode。
+            'per' => $per,
+            'spd' => $spd,
+            'pit' => $pit,
+            'vol' => $vol,
+            'aue' => $aue,
+            'cuid' => $cuid,
+            'tok' => $token,
+            'lan' => 'zh', //固定参数
+            'ctp' => 1, // 固定参数
+        );
+        $paramsStr =  http_build_query($params);
+        $url = 'http://tsn.baidu.com/text2audio';
+        $urltest = $url . '?' . $paramsStr;
+        //echo $urltest . "\n"; // 反馈请带上此url
+        return $urltest;
+        //die;
+        /** 拼接参数结束 **/
+
+        $g_has_error = true;
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+        curl_setopt ($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $paramsStr);
+        function read_header($ch, $header){
+            global $g_has_error;
+
+            $comps = explode(":", $header);
+            // 正常返回的头部 Content-Type: audio/*
+            // 有错误的如 Content-Type: application/json
+            if (count($comps) >= 2){
+                if (strcasecmp(trim($comps[0]), "Content-Type") == 0){
+                    if (strpos($comps[1], "audio/") > 0 ){
+                        $g_has_error = false;
+                    }else{
+                        echo $header ." , has error \n";
+                    }
+                }
+            }
+            return strlen($header);
+        }
+        //echo $urltest . "\n"; // 反馈请带上此urlcurl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header');
+        $data = curl_exec($ch);
+        if(curl_errno($ch))
+        {
+            echo curl_error($ch);
+            exit(2);
+        }
+        curl_close($ch);
+        echo $urltest . "\n"; // 反馈请带上此url
+        die;
+        $file = $g_has_error ? "result.txt" : "result." . $format;
+        file_put_contents($file, $data);
+        echo "\n$file saved successed, please open it \n";
+    }
+
+
+}

+ 317 - 0
app/common/library/HuijuH5Pay.php

@@ -0,0 +1,317 @@
+<?php
+namespace app\common\library;
+use think\Controller;
+
+//汇聚银联h5、支付宝h5
+
+class HuijuH5Pay extends Controller
+{
+
+    public function __construct(){
+        $this->mch_no_trade = "888117500004672";
+
+        //报备商户号
+        $this->TradeMerchantNo = "777171600367612";
+        //商户私钥
+        $this->mchPrivateKey = "40c310e1a575470cb660f08937bf6313";
+    }
+
+    //银联h5
+    public function ylh5Pay($order_no,$ReturnUrl,$notifyurl,$good_name,$amount,$m_id,$type='1'){
+        if ($type==1){
+            $q1_fr = "ALIPAY_H5";
+        }elseif ($type==2){
+            $q1_fr = "UNIONPAY_H5";
+        }
+        //1.版本号
+        $params["p0_Version"] = "2.1";
+        //2.商户编号
+        $params["p1_MerchantNo"] = $this->mch_no_trade;
+        //3.商户订单号
+        $params["p2_OrderNo"] = $order_no;
+        //4.订单金额
+        $params["p3_Amount"] = $amount;
+        //5.交易币种
+        $params["p4_Cur"] = "1";
+        //6.商品名称
+        $params["p5_ProductName"] = $good_name;
+        //7.商品描述
+        $params["p6_ProductDesc"] = "";
+        //8.公用回传参数
+        $params["p7_Mp"] = $m_id;
+        //9.商户页面通知地址
+        $params["p8_ReturnUrl"] = $ReturnUrl;
+        //10.服务器异步通知地址
+        $params["p9_NotifyUrl"] = $notifyurl;
+        //11.交易类型
+        $params["q1_FrpCode"] = $q1_fr;
+        //18.微信 H5 模 式
+        //$params["q9_TransactionModel"] = "MODEL1";  //新增
+        //19.报备商户号
+        $params["qa_TradeMerchantNo"] = $this->TradeMerchantNo;  //新增
+
+        $hmacVal = urlencode($this->hmacRequest($params,$this->mchPrivateKey));
+        $params['hmac'] = $hmacVal;
+        $url = 'https://www.joinpay.com/trade/uniPayApi.action';
+        $result = http_post($url,$params);
+        $result = json_decode($result,true);
+        //dump($result);die;
+        return $result;
+
+    }
+
+
+    //代付(朝夕付)
+    public function we_pay(){
+        //1.商户编号
+        $params['userNo'] = $this->mch_no_trade;
+        //2.产品类型
+        $params['productCode'] = "BANK_PAY_DAILY_ORDER";
+        //3.交易请求时间
+        $params['requestTime'] =  date("Y-m-d H:i:s",time());
+        //4.商户订单号
+        $params['merchantOrderNo'] = get_order_sn();
+        //5.收款账户号
+        $params['receiverAccountNoEnc'] = "6226227904711037";
+        //6.收款人
+        $params['receiverNameEnc'] = "宋星伟";
+        //7.账户类型
+        $params['receiverAccountType'] = "201";
+        //8.收款账户联行号
+//        if( $_POST['receiverBankChannelNo']!=''){
+//            $params['receiverBankChannelNo'] = $_POST['receiverBankChannelNo'];
+//        }
+        //9.交易金额
+        $params['paidAmount'] =  sprintf("%.2f",'0.01');
+        //10.币种
+        $params['currency'] = '201';
+        //11.是否复核 (201复核,202,不复核)
+        $params['isChecked'] = '202';
+        //12.代付说明
+        $params['paidDesc'] = "用户余额提现";
+        //13.代付用途
+        $params['paidUse'] = "207";
+        //14.商户通知地址
+        $params['callbackUrl'] ="http://".$_SERVER['SERVER_NAME']."/index.php/api/Pay/wePayNotify";//回调地址
+        //15.代付说明
+//        $params['firstProductCode'] = '';
+
+        // 根据验签方式提交 MD5
+        $hmacVal = urlencode($this->hmacRequest($params,$this->mchPrivateKey));
+        $params['hmac'] = $hmacVal;
+        dump($params);
+        $url = "https://www.joinpay.com/payment/pay/singlePay";
+        $result = $this->http_post($url,$params,true);
+        dump($result);
+        die;
+    }
+
+
+
+    /**
+     * 生成签名
+     * @param $params
+     * @param $key
+     * @param string $encryptType
+     * @return string
+     */
+    function hmacRequest($params, $key, $encryptType = "1")
+    {
+        if ("1" == $encryptType) {
+            return md5(implode("", $params) . $key);
+        } else {
+            $private_key = openssl_pkey_get_private($key);
+            $params = implode("", $params);
+            openssl_sign($params, $sign, $private_key, OPENSSL_ALGO_MD5);
+            openssl_free_key($private_key);
+            $sign = base64_encode($sign);
+            return $sign;
+        }
+
+    }
+
+
+    /**
+     *  批量代付生成签名,由于批量代付包含details的字段,需要特殊处理
+     * @param $params
+     * @param $key
+     * @param string $encryptType
+     * @return string
+     */
+    function batchHmacRequest($params, $key, $encryptType = "1")
+    {
+        $details=$params['details'];
+        unset($params['details']);
+        $detailsStr='';
+        foreach ($details as $k=>$value){
+            $detailsStr.= implode("", $value);
+        }
+        if ("1" == $encryptType) {
+            return md5(implode("", $params) . $detailsStr . $key);
+        } else {
+            $private_key = openssl_pkey_get_private($key);
+            $params = implode("", $params).$detailsStr;
+            openssl_sign($params, $sign, $private_key, OPENSSL_ALGO_MD5);
+            openssl_free_key($private_key);
+            $sign = base64_encode($sign);
+            return $sign;
+        }
+
+    }
+
+
+
+
+//生成订单号
+    function getOrderId()
+    {
+        return date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
+    }
+
+    /**
+     * 生成批量代付detail
+     *
+     *$detail=array(
+     * 0=>array(
+     *         1, //detailId
+     *          '张三',//payee
+     *          '6228480402564890018',//'bankacount'
+     *         '0.1',// 'money'
+     *          '代付接口测试1',//'desc'
+     *         '广州市',// 'city'
+     *          0,//'isVerify'
+     *          1,//'PublicOrPrivate'
+     *         102902500019,// 'num'
+     *      )
+     *
+     * )
+     * return str
+     *
+     * example
+     *  代付明细序号(必填)|收款人姓名(必填)|收款银行帐号(必填)|代付金额(必填)|代付说明|收款银行所在城市(必填)|是否审核(1:审核 0:不审核)|对公对私(1:对公 2:对私)|联行号(对公必填)
+     *  1001|张三|6228480402564890018|10.01|代付接口测试1|广州市|1|1|102902500019^1001|李四|6228480402564890018|10.01|代付接口测试2|广州市|1|1|102902500019
+     **/
+    function getProxyPayDetail(Array $detail)
+    {
+        $result = '';
+        foreach ($detail as $key => $item) {
+            if ($key != 0) {
+                $result .= '^';
+            }
+
+            $result .= implode('|', array_values($item));
+
+        }
+        return $result;
+    }
+
+
+    function decodeUnicode($str)
+    {
+        return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
+            create_function(
+                '$matches',
+                'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'
+            ),
+            $str);
+    }
+
+    function output($str){
+        echo '<pre>'.decodeUnicode(json_encode(json_decode($str), JSON_PRETTY_PRINT)).'</pre>';
+    }
+
+
+
+
+    /**
+     *   判断文件是是否是图片
+     * @param $fileName
+     * @param $fileTmpName
+     *  @return bool true|false
+     */
+    function checkIsImage($fileName,$fileTmpName){
+
+        if( !in_array(substr(strrchr ( $fileName , "." ),1), array('jpg','png','bmp','jpeg')) || !getimagesize($fileTmpName)){
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 获取图片的base64
+     * @param $file  $_FILES["file"]["tmp_name"]
+     * @param $type  png/
+     * @return string
+     */
+    function getImageBase64($file,$type){
+        $bin_string = file_get_contents($file);
+        return 'data:' . $type . ';base64,' . base64_encode($bin_string);
+    }
+
+
+    /**
+     * 生成批次id
+     * @param $length
+     * @return string
+     */
+    function getBatchId()
+    {
+        return "batch".getOrderId();
+    }
+
+    /**
+     * POST请求
+     */
+    function http_post($url, $params,$contentType=false)
+    {
+
+        if (function_exists('curl_init')) { // curl方式
+            $oCurl = curl_init();
+            if (stripos($url, 'https://') !== FALSE) {
+                curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
+                curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
+            }
+            $string = $params;
+            if (is_array($params)) {
+                $aPOST = array();
+                foreach ($params as $key => $val) {
+                    $aPOST[] = $key . '=' . urlencode($val);
+                }
+                $string = join('&', $aPOST);
+            }
+            curl_setopt($oCurl, CURLOPT_URL, $url);
+            curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
+            curl_setopt($oCurl, CURLOPT_POST, TRUE);
+            //$contentType json处理
+            if($contentType){
+                $headers = array(
+                    "Content-type: application/json;charset='utf-8'",
+                );
+
+                curl_setopt($oCurl, CURLOPT_HTTPHEADER, $headers);
+                curl_setopt($oCurl, CURLOPT_POSTFIELDS, json_encode($params));
+            }else{
+                curl_setopt($oCurl, CURLOPT_POSTFIELDS, $string);
+            }
+            $response = curl_exec($oCurl);
+            curl_close($oCurl);
+            return $response;
+//        return json_decode($response, true);
+        } elseif (function_exists('stream_context_create')) { // php5.3以上
+            $opts = array(
+                'http' => array(
+                    'method' => 'POST',
+                    'header' => 'Content-type: application/x-www-form-urlencoded',
+                    'content' => http_build_query($params),
+                )
+            );
+            $_opts = stream_context_get_params(stream_context_get_default());
+            $context = stream_context_create(array_merge_recursive($_opts['options'], $opts));
+            return file_get_contents($url, false, $context);
+//        return json_decode(file_get_contents($url, false, $context), true);
+        } else {
+            return FALSE;
+        }
+    }
+
+}

+ 200 - 0
app/common/library/HuijuKjPay.php

@@ -0,0 +1,200 @@
+<?php
+namespace app\common\library;
+use think\Controller;
+
+require_once env('root_path').'application/common/library/huiju/kuaijie/entity/Request.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/entity/Response.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/entity/NotifyResponse.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/entity/SecretKey.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/entity/Callback.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/exceptions/SDKException.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/AESUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/HttpUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/MD5Util.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/RandomUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/RequestUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/RSAUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/SignUtil.php';
+require_once env('root_path').'application/common/library/huiju/kuaijie/utils/ObjectUtil.php';
+
+
+use joinpay\Request;
+use joinpay\SecretKey;
+use joinpay\RequestUtil;
+use joinpay\RandomUtil;
+use joinpay\AESUtil;
+
+class HuijuKjPay extends Controller
+{
+
+    public function __construct(){
+        $this->mch_no_trade = "888117500004672";
+        //平台公钥
+        $this->platPublicKey = "-----BEGIN PUBLIC KEY-----
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCS4CHpmFRfFJR2cMjx2Ii7WBck6W3QXjr8ubrrlKkGVwMCpZT+Dg85jhsCqoTdVYJlbwfqpXNs5+I4KJ1K4cTz/9DgAjQW2oJF7owsGqPVbsz5APh5mWtlil71UNLwLWhlmmS2NcdcI/PdCH8/IY11q55Ymt+R55cst4ZSl62cTQIDAQAB
+-----END PUBLIC KEY-----";
+
+//商户私钥
+        $this->mchPrivateKey = "-----BEGIN RSA PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKJ2zCsD/JMiFRRwGJvpf80NeWmduNGZ/sfU3mJRi00CYE5d9KbMpmq/A5gEurNiVkgFCOs+vF3F+qd+tla2+RuX/izTQlxlgHUh0W48BYm8FQYgL6YsJQj6sM8VeTSW7ynUAQdqU0kGe32QtFP829uggHhxj20yUsFM8nzDdX/rAgMBAAECgYANU7Fr1efiKemQw6FBKOZS68gJ4eZHS1qbCds0NXw31PoRc6OeCyublg+1aK3oCSkKv1777SmGh7cIBlzuwBOvDlMBTllA1xOrt0A//QLfWz0ELlEoGKJQZLxluYINbcoxjH7FvYxMlWWhYIJWr1JiK+OKV7A6NND9yxN9yzrIAQJBAM3g5ibq3xaUjdcFu2UXCXpm/DViNcwVymdbujzjRd1DLNhvvOMSZ3utgi6UJSiA3ryMRbBGITFUFXlaqXB2jucCQQDKBCab1sQmU2O5dshNpw4PkR0v4bR6/g16V6GEZ+NN4Vpg4rVexn5p7/Hyte+DKWSXfc5pKff0RWdxPwWruvpdAkEAhdLyx8lUSfE2YdawAP4Agzf+KRU1svtXHehaHsn8196af/Xh6hhEe/hE7tINdU6PejAT/IkZel8VtlRgX2IxcQJADnQnkwTVuexDeVSPVkb6kZCPZwqeECK3Mias7r1EHSFfhwkRcvt+tfOt+vCbd2XxxYkByLJxBDAnC4o3zKavHQJBAJIdMjx5OAxAswBFxL7smSDGbxfoeTAGrSlbyKpDXaw8qCxi3yMPHaljBr4yP/hqaA+4oSTZ84K4PqO7x3CJ0eA=
+-----END RSA PRIVATE KEY-----";
+    }
+    //短信
+    public function sms($name,$id_card_no,$bank_card_no,$mobile){
+        $secKey = RandomUtil::randomStr();
+        $mch_order_no = get_order_sn();
+        $data = [];
+       // $data["mch_no_trade"] = $this->mch_no_trade;
+        $data["mch_order_no"] = $mch_order_no;
+        $data["order_amount"] = "0.01";
+        $data["mch_req_time"] = date('Y-m-d H:i:s', time());
+        $data["order_desc"] = "签约发送短信";
+        $data["id_type"] = "1";
+        $data["callback_param"] =null;
+        $data["payer_name"] = AESUtil::encryptECB($name, $secKey);//加密
+        $data["id_no"] = AESUtil::encryptECB($id_card_no, $secKey);//加密
+        $data["bank_card_no"] = AESUtil::encryptECB($bank_card_no, $secKey);//加密
+        $data["mobile_no"] = AESUtil::encryptECB($mobile, $secKey);//加密
+
+        $request = new Request();
+        $request->setMethod("fastPay.agreement.signSms");
+        $request->setVersion("1.0");
+        $request->setMchNo($this->mch_no_trade);
+        $request->setSignType("2");
+        $request->setRandStr(RandomUtil::randomStr(32));
+        $request->setData($data);
+        $request->setSecKey($secKey);//rsa有效
+
+        $secretKey = new SecretKey();
+        $secretKey->setReqSignKey($this->mchPrivateKey);//签名:使用商户私钥
+        $secretKey->setRespVerifyKey($this->platPublicKey);//验签:使用平台公钥
+        $secretKey->setSecKeyEncryptKey($this->platPublicKey);//sec_key加密:使用平台公钥
+        $secretKey->setSecKeyDecryptKey($this->mchPrivateKey);//sec_key解密:使用商户私钥
+        $url = "https://api.joinpay.com/fastpay";
+        try {
+            $response = RequestUtil::doRequest($url, $request, $secretKey);
+            $res['resp_codo'] = $response->getRespCode();
+            $res['biz_code'] = $response->getBizCode();
+            $res['biz_msg'] = $response->getBizMsg();
+            $res['data'] = $response->getData();
+            $res['secKey'] = $secKey;
+            $res['mch_order_no'] = $mch_order_no;
+            return $res;
+        } catch (Exception $e) {
+            print_r($e);die;
+        }
+    }
+    //签约
+    public function signing($secKey,$mch_order_no,$sms_code){
+        $data = [];
+        //$data["mch_no_trade"] = "888117500004672";
+        $data["mch_order_no"] = $mch_order_no;
+        $data["sms_code"] = $sms_code;
+
+        $request = new Request();
+        $request->setMethod("fastPay.agreement.smsSign");
+        $request->setVersion("1.0");
+        $request->setMchNo($this->mch_no_trade);
+        $request->setSignType("2");
+        $request->setRandStr(RandomUtil::randomStr(32));
+        $request->setData($data);
+        $request->setSecKey($secKey);//rsa有效
+        $secretKey = new SecretKey();
+        $secretKey->setReqSignKey($this->mchPrivateKey);//签名:使用商户私钥
+        $secretKey->setRespVerifyKey($this->platPublicKey);//验签:使用平台公钥
+        $secretKey->setSecKeyEncryptKey($this->platPublicKey);//sec_key加密:使用平台公钥
+        $secretKey->setSecKeyDecryptKey($this->mchPrivateKey);//sec_key解密:使用商户私钥
+        $url = "https://api.joinpay.com/fastpay";
+        try {
+            $response = RequestUtil::doRequest($url, $request, $secretKey);
+            $res['resp_codo'] = $response->getRespCode();
+            $res['biz_code'] = $response->getBizCode();
+            $res['biz_msg'] = $response->getBizMsg();
+            $res['data'] = $response->getData();
+            return $res;
+        } catch (Exception $e) {
+            print_r($e);
+        }
+    }
+
+
+    //支付发送短信
+    public function paySms($order_no,$money,$desc,$mid,$callback_url,$bank_card_no){
+        $secKey = RandomUtil::randomStr(16);
+        $data = [];
+        // $data["mch_order_no"] = '202206251446464089001232';
+        $data["mch_order_no"] = $order_no;
+        $data["order_amount"] = $money;
+        $data["mch_req_time"] = date('Y-m-d H:i:s', time());
+        $data["order_desc"] = $desc;
+        $data["callback_url"] = $callback_url;
+        $data["callback_param"] =$mid;
+        $data["bank_card_no"] = AESUtil::encryptECB($bank_card_no, $secKey);//加密
+
+        $request = new Request();
+        $request->setMethod("fastPay.agreement.paySms");
+        $request->setVersion("1.0");
+        $request->setMchNo($this->mch_no_trade);
+        $request->setSignType("2");
+        $request->setRandStr(RandomUtil::randomStr(32));
+        $request->setData($data);
+        $request->setSecKey($secKey);//rsa有效
+
+        $secretKey = new SecretKey();
+        $secretKey->setReqSignKey($this->mchPrivateKey);//签名:使用商户私钥
+        $secretKey->setRespVerifyKey($this->platPublicKey);//验签:使用平台公钥
+        $secretKey->setSecKeyEncryptKey($this->platPublicKey);//sec_key加密:使用平台公钥
+        $secretKey->setSecKeyDecryptKey($this->mchPrivateKey);//sec_key解密:使用商户私钥
+        $url = "https://api.joinpay.com/fastpay";
+        try {
+            $response = RequestUtil::doRequest($url, $request, $secretKey);
+            $res['resp_codo'] = $response->getRespCode();
+            $res['biz_code'] = $response->getBizCode();
+            $res['biz_msg'] = $response->getBizMsg();
+            $res['data'] = $response->getData();
+            $res['secKey'] = $secKey;
+            $res['mch_order_no'] = $order_no;
+            return $res;
+        } catch (Exception $e) {
+            print_r($e);
+        }
+    }
+
+
+    //支付
+    public function kuaijiePay($order_no,$sms_code){
+
+        $secKey = RandomUtil::randomStr(16);
+        $data = [];
+        $data["mch_order_no"] = $order_no;
+        $data["mch_req_time"] = date('Y-m-d H:i:s', time());
+        $data["sms_code"] = $sms_code;
+
+        $request = new Request();
+        $request->setMethod("fastPay.agreement.smsPay");
+        $request->setVersion("1.0");
+        $request->setMchNo($this->mch_no_trade);
+        $request->setSignType("2");
+        $request->setRandStr(RandomUtil::randomStr(32));
+        $request->setData($data);
+        $request->setSecKey($secKey);//rsa有效
+
+        $secretKey = new SecretKey();
+        $secretKey->setReqSignKey($this->mchPrivateKey);//签名:使用商户私钥
+        $secretKey->setRespVerifyKey($this->platPublicKey);//验签:使用平台公钥
+        $secretKey->setSecKeyEncryptKey($this->platPublicKey);//sec_key加密:使用平台公钥
+        $secretKey->setSecKeyDecryptKey($this->mchPrivateKey);//sec_key解密:使用商户私钥
+
+        $url = "https://api.joinpay.com/fastpay";
+        try {
+            $response = RequestUtil::doRequest($url, $request, $secretKey);
+            $res['resp_codo'] = $response->getRespCode();
+            $res['biz_code'] = $response->getBizCode();
+            $res['biz_msg'] = $response->getBizMsg();
+            $res['data'] = $response->getData();
+            return $res;
+        } catch (Exception $e) {
+            print_r($e);
+        }
+    }
+}

+ 81 - 0
app/common/library/Jiyan.php

@@ -0,0 +1,81 @@
+<?php
+namespace app\common\library;
+use think\Controller;
+
+header('Content-type:text/html;charset=utf-8');
+class Jiyan extends Controller
+{
+
+    public static function jy($lot_number,$captcha_output,$pass_token,$gen_time,$type)
+    {
+        //type 1:发送短信验证码验证   2:下单验证
+        error_reporting(0);
+        // 1.初始化极验参数信息
+        // 1.initialize geetest parameter
+        switch ($type){
+            case 1:
+                $captcha_id = "46c329019f54e6d6e2171bc93da4fc57";
+                $captcha_key = "fcea1180bef1b1a84d3acb6338a4200c";
+                break;
+            case 2:
+                $captcha_id = "f79240154d3834df7b73d5514d555fff";
+                $captcha_key = "97ad4e9039d04bc21222fc504152708e";
+                break;
+        }
+        $api_server = "http://gcaptcha4.geetest.com";
+
+        // 3.生成签名
+// 3.generate signature
+// 生成签名使用标准的hmac算法,使用用户当前完成验证的流水号lot_number作为原始消息message,使用客户验证私钥作为key
+// use standard hmac algorithms to generate signatures, and take the user's current verification serial number lot_number as the original message, and the client's verification private key as the key
+// 采用sha256散列算法将message和key进行单向散列生成最终的签名
+// use sha256 hash algorithm to hash message and key in one direction to generate the final signature
+        $sign_token = hash_hmac('sha256', $lot_number, $captcha_key);
+
+// 4.上传校验参数到极验二次验证接口, 校验用户验证状态
+// 4.upload verification parameters to the secondary verification interface of GeeTest to validate the user verification status
+// captcha_id 参数建议放在 url 后面, 方便请求异常时可以在日志中根据id快速定位到异常请求
+// geetest recommends to put captcha_id parameter after url, so that when a request exception occurs, it can be quickly located in the log according to the id
+        $query = array(
+            "lot_number" => $lot_number,
+            "captcha_output" => $captcha_output,
+            "pass_token" => $pass_token,
+            "gen_time" => $gen_time,
+            "sign_token" => $sign_token
+        );
+        $url = sprintf($api_server . "/validate" . "?captcha_id=%s", $captcha_id);
+        $res = self::post_request($url,$query);
+        $obj = json_decode($res,true);
+        return $obj;
+    }
+
+    // 注意处理接口异常情况,当请求极验二次验证接口异常时做出相应异常处理
+// pay attention to interface exceptions, and make corresponding exception handling when requesting GeeTest secondary verification interface exceptions or response status is not 200
+// 保证不会因为接口请求超时或服务未响应而阻碍业务流程
+// website's business will not be interrupted due to interface request timeout or server not-responding
+    public static function post_request($url, $postdata) {
+        $data = http_build_query($postdata);
+
+        $options    = array(
+            'http' => array(
+                'method'  => 'POST',
+                'header'  => "Content-type: application/x-www-form-urlencoded",
+                'content' => $data,
+                'timeout' => 5
+            )
+        );
+        $context = stream_context_create($options);
+        $result    = file_get_contents($url, false, $context);
+        if($http_response_header[0] != 'HTTP/1.1 200 OK'){
+            $result = array(
+                "result" => "success",
+                "reason" => "request geetest api fail"
+            );
+            return json_encode($result);
+        }else{
+            return $result;
+        }
+    }
+
+
+}

+ 148 - 0
app/common/library/JuheRecharge.php

@@ -0,0 +1,148 @@
+<?php
+namespace app\common\library;
+
+use app\common\model\Config;
+use think\Controller;
+// +----------------------------------------------------------------------
+// | JuhePHP [ NO ZUO NO DIE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2010-2015 http://juhe.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Author: Juhedata <info@juhe.cn-->
+// +----------------------------------------------------------------------
+
+//----------------------------------
+// 聚合数据-手机话费充值API调用类
+//----------------------------------
+class JuheRecharge {
+
+    private $appkey;
+
+    private $openid;
+
+    private $telCheckUrl = 'http://op.juhe.cn/ofpay/mobile/telcheck';
+
+    private $telQueryUrl = 'http://op.juhe.cn/ofpay/mobile/telquery';
+
+    private $submitUrl = 'http://op.juhe.cn/ofpay/mobile/onlineorder';
+
+    private $staUrl = 'http://op.juhe.cn/ofpay/mobile/ordersta';
+
+    public function __construct(){
+        $this->appkey = Config::get_values('juhe_appkey');
+        $this->openid = Config::get_values('juhe_openid');
+    }
+
+    /**
+     * 根据手机号码及面额查询是否支持充值
+     * @param  string $mobile   [手机号码]
+     * @param  int $pervalue [充值金额]
+     * @return  boolean
+     */
+    public function telcheck($mobile,$pervalue){
+        $params = 'key='.$this->appkey.'&phoneno='.$mobile.'&cardnum='.$pervalue;
+        $content = $this->juhecurl($this->telCheckUrl,$params);
+        $result = $this->_returnArray($content);
+        return $result;
+//        print_r($result);die;
+//        if($result['error_code'] == '0'){
+//            return true;
+//        }else{
+//            return false;
+//        }
+    }
+
+    /**
+     * 根据手机号码和面额获取商品信息
+     * @param  string $mobile   [手机号码]
+     * @param  int $pervalue [充值金额]
+     * @return  array
+     */
+    public function telquery($mobile,$pervalue){
+        $params = 'key='.$this->appkey.'&phoneno='.$mobile.'&cardnum='.$pervalue;
+        $content = $this->juhecurl($this->telQueryUrl,$params);
+        return $this->_returnArray($content);
+    }
+
+    /**
+     * 提交话费充值
+     * @param  [string] $mobile   [手机号码]
+     * @param  [int] $pervalue [充值面额]
+     * @param  [string] $orderid  [自定义单号]
+     * @return  [array]
+     */
+    public function telcz($mobile,$pervalue,$orderid){
+        $pervalue = floatval($pervalue);
+        $sign = md5($this->openid.$this->appkey.$mobile.$pervalue.$orderid);//校验值计算
+        $params = array(
+            'key' => $this->appkey,
+            'phoneno'   => $mobile,
+            'cardnum'   => $pervalue,
+            'orderid'   => $orderid,
+            'sign' => $sign
+        );
+        $content = $this->juhecurl($this->submitUrl,$params,1);
+        return $this->_returnArray($content);
+    }
+
+    /**
+     * 查询订单的充值状态
+     * @param  [string] $orderid [自定义单号]
+     * @return  [array]
+     */
+    public function sta($orderid){
+        $params = 'key='.$this->appkey.'&orderid='.$orderid;
+        $content = $this->juhecurl($this->staUrl,$params);
+        return $this->_returnArray($content);
+    }
+
+    /**
+     * 将JSON内容转为数据,并返回
+     * @param string $content [内容]
+     * @return array
+     */
+    public function _returnArray($content){
+        return json_decode($content,true);
+    }
+
+    /**
+     * 请求接口返回内容
+     * @param  string $url [请求的URL地址]
+     * @param  string $params [请求的参数]
+     * @param  int $ipost [是否采用POST形式]
+     * @return  string
+     */
+    public function juhecurl($url,$params=false,$ispost=0){
+        $httpInfo = array();
+        $ch = curl_init();
+
+        curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
+        curl_setopt( $ch, CURLOPT_USERAGENT , 'JuheData' );
+        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
+        curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
+        curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
+        if( $ispost )
+        {
+            curl_setopt( $ch , CURLOPT_POST , true );
+            curl_setopt( $ch , CURLOPT_POSTFIELDS , $params );
+            curl_setopt( $ch , CURLOPT_URL , $url );
+        }
+        else
+        {
+            if($params){
+                curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );
+            }else{
+                curl_setopt( $ch , CURLOPT_URL , $url);
+            }
+        }
+        $response = curl_exec( $ch );
+        if ($response === FALSE) {
+            //echo "cURL Error: " . curl_error($ch);
+            return false;
+        }
+        $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );
+        $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );
+        curl_close( $ch );
+        return $response;
+    }
+}

+ 144 - 0
app/common/library/Menu.php

@@ -0,0 +1,144 @@
+<?php
+
+namespace app\common\library;
+
+use app\admin\model\AuthRule;
+use fast\Tree;
+use think\Exception;
+use think\exception\PDOException;
+
+class Menu
+{
+
+    /**
+     * 创建菜单
+     * @param array $menu
+     * @param mixed $parent 父类的name或pid
+     */
+    public static function create($menu, $parent = 0)
+    {
+        if (!is_numeric($parent))
+        {
+            $parentRule = AuthRule::getByName($parent);
+            $pid = $parentRule ? $parentRule['id'] : 0;
+        }
+        else
+        {
+            $pid = $parent;
+        }
+        $allow = array_flip(['file', 'name', 'title', 'icon', 'condition', 'remark', 'ismenu']);
+        foreach ($menu as $k => $v)
+        {
+            $hasChild = isset($v['sublist']) && $v['sublist'] ? true : false;
+
+            $data = array_intersect_key($v, $allow);
+
+            $data['ismenu'] = isset($data['ismenu']) ? $data['ismenu'] : ($hasChild ? 1 : 0);
+            $data['icon'] = isset($data['icon']) ? $data['icon'] : ($hasChild ? 'fa fa-list' : 'fa fa-circle-o');
+            $data['pid'] = $pid;
+            $data['status'] = 'normal';
+            try
+            {
+                $menu = AuthRule::create($data);
+                if ($hasChild)
+                {
+                    self::create($v['sublist'], $menu->id);
+                }
+            }
+            catch (PDOException $e)
+            {
+                throw new Exception($e->getMessage());
+            }
+        }
+    }
+
+    /**
+     * 删除菜单
+     * @param string $name 规则name 
+     * @return boolean
+     */
+    public static function delete($name)
+    {
+        $ids = self::getAuthRuleIdsByName($name);
+        if (!$ids)
+        {
+            return false;
+        }
+        AuthRule::destroy($ids);
+        return true;
+    }
+
+    /**
+     * 启用菜单
+     * @param string $name
+     * @return boolean
+     */
+    public static function enable($name)
+    {
+        $ids = self::getAuthRuleIdsByName($name);
+        if (!$ids)
+        {
+            return false;
+        }
+        AuthRule::where('id', 'in', $ids)->update(['status' => 'normal']);
+        return true;
+    }
+
+    /**
+     * 禁用菜单
+     * @param string $name
+     * @return boolean
+     */
+    public static function disable($name)
+    {
+        $ids = self::getAuthRuleIdsByName($name);
+        if (!$ids)
+        {
+            return false;
+        }
+        AuthRule::where('id', 'in', $ids)->update(['status' => 'hidden']);
+        return true;
+    }
+
+    /**
+     * 导出指定名称的菜单规则
+     * @param string $name
+     * @return array
+     */
+    public static function export($name)
+    {
+        $ids = self::getAuthRuleIdsByName($name);
+        if (!$ids)
+        {
+            return [];
+        }
+        $menuList = [];
+        $menu = AuthRule::getByName($name);
+        if ($menu)
+        {
+            $ruleList = collection(AuthRule::where('id', 'in', $ids)->select())->toArray();
+            $menuList = Tree::instance()->init($ruleList)->getTreeArray($menu['id']);
+        }
+        return $menuList;
+    }
+
+    /**
+     * 根据名称获取规则IDS
+     * @param string $name
+     * @return array
+     */
+    public static function getAuthRuleIdsByName($name)
+    {
+        $ids = [];
+        $menu = AuthRule::getByName($name);
+        if ($menu)
+        {
+            // 必须将结果集转换为数组
+            $ruleList = collection(AuthRule::order('weigh', 'desc')->field('id,pid,name')->select())->toArray();
+            // 构造菜单数据
+            $ids = Tree::instance()->init($ruleList)->getChildrenIds($menu['id'], true);
+        }
+        return $ids;
+    }
+
+}

+ 245 - 0
app/common/library/PHPExcelService.php

@@ -0,0 +1,245 @@
+<?php
+namespace app\common\library;
+
+use crmeb\services\JsonService as Json;
+
+class PHPExcelService
+{
+    //PHPExcel实例化对象
+    private static $PHPExcel=null;
+    //表头计数
+    protected static $count;
+    //表头占行数
+    protected static $topNumber = 1;
+    //表能占据表行的字母对应self::$cellkey
+    protected static $cells;
+    //表头数据
+    protected static $data=[];
+    //文件名
+    protected static $title='导出';
+    //行宽
+    protected static $where=20;
+    //行高
+    protected static $height=50;
+    //表行名
+    private static $cellKey = array(
+        'A','B','C','D','E','F','G','H','I','J','K','L','M',
+        'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
+        'AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM',
+        'AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ'
+    );
+    //设置style
+    private static $styleArray = array(
+        'borders' => array(
+            'allborders' => array(
+//                PHPExcel_Style_Border里面有很多属性,想要其他的自己去看
+//                'style' => \PHPExcel_Style_Border::BORDER_THICK,//边框是粗的
+//                'style' => \PHPExcel_Style_Border::BORDER_DOUBLE,//双重的
+//                'style' => \PHPExcel_Style_Border::BORDER_HAIR,//虚线
+//                'style' => \PHPExcel_Style_Border::BORDER_MEDIUM,//实粗线
+//                'style' => \PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT,//虚粗线
+//                'style' => \PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT,//点虚粗线
+                'style' => \PHPExcel_Style_Border::BORDER_THIN,//细边框
+                //'color' => array('argb' => 'FFFF0000'),
+            ),
+        ),
+        'font'=>[
+            'bold'=>true
+        ],
+        'alignment'=>[
+            'horizontal'=>\PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+            'vertical'=>\PHPExcel_Style_Alignment::VERTICAL_CENTER
+        ]
+    );
+    /**
+     *初始化PHPExcel类
+     *@param $data array()
+     *@param $fun function()
+     * return
+     */
+    private static function initialize($data,$fun){
+        self::$PHPExcel= new \PHPExcel();
+        if($fun!==null && is_callable($fun)){
+            self::$styleArray=$fun();
+        }
+        if(!is_array($data)) exit(Json::fail('data 为数组'));
+        self::$data=$data;
+    }
+    /**
+     *设置字体格式
+     *@param $title string 必选
+     * return string
+     */
+    public static function setUtf8($title){
+        return "";
+        //return iconv('utf-8', 'gb2312', $title);
+    }
+    /**
+     *
+     * execl数据导出
+     * @param  $list 需要导出的数据 格式和以前的可是一样
+     * @param  $list 也可以为匿名函数 匿名函数参数有 $sheet PHPExcel->getActiveSheet(),self::$topNumber 从第几行设置,$cellkey 行号为数组,self::$cells现在设置的最大行号
+     *
+     * 特殊处理:合并单元格需要先对数据进行处理
+     */
+    public function setExcelContent($list=null)
+    {
+        $sheet=self::$PHPExcel->getActiveSheet();
+        foreach(self::$data as $key=>$val){
+            $row=self::$cellKey[$key];
+            $sheet->getColumnDimension($row)->setWidth(isset($val['w'])?$val['w']:self::$where);
+            $sheet->setCellValue($row.self::$topNumber,isset($val['name'])?$val['name']:$val);
+        }
+        $cellkey=array_slice(self::$cellKey,0,self::$count);
+        if($list!==null && is_array($list)){
+            foreach ($cellkey as $k=>$v){
+                foreach ($list as $key=>$val){
+                    if(isset($val[$k]) && !is_array($val[$k])){
+                        $sheet->setCellValue($v.(self::$topNumber+1+$key),$val[$k]);
+                    }else if(isset($val[$k]) && is_array($val[$k])){
+                        $str='';
+                        foreach ($val[$k] as $value){
+                            $str.=$value.chr(10);
+                        }
+                        $sheet->setCellValue($v.(self::$topNumber+1+$key),$str);
+                    }
+                }
+            }
+            $sheet->getDefaultRowDimension()->setRowHeight(self::$height);
+            //设置边框
+            $sheet->getStyle('A1:'.self::$cells.(count($list)+self::$topNumber))->applyFromArray(self::$styleArray);
+            //设置自动换行
+            $sheet->getStyle('A4:'.self::$cells.(count($list)+self::$topNumber))->getAlignment()->setWrapText(true);
+        }else if($list!==null && is_callable($list)){
+            $list($sheet,self::$topNumber,$cellkey,self::$cells)->applyFromArray(self::$styleArray);
+        }
+
+        return $this;
+    }
+    /**
+     * 保存表格数据,并下载
+     * @param
+     * @return
+     */
+    public function ExcelSave(){
+        error_reporting(0);
+        $objWriter=\PHPExcel_IOFactory::createWriter(self::$PHPExcel,'Excel2007');
+        $filename=self::$title.'--'.time().'.xlsx';
+        ob_end_clean();
+        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+        header('Content-Type: application/vnd.ms-excel');
+        header('Content-Type: application/octet-stream');
+        header('Content-Disposition: attachment; filename="' . $filename . '"');
+        header('Cache-Control: max-age=0');
+        $objWriter->save('php://output');
+        exit;
+    }
+
+    /**
+     * 设置头部信息
+     * @param $data array
+     * @param $fun function() 主要设置边框的粗细
+     * @return $this
+     */
+    public static function setExcelHeader($data,$fun=null)
+    {
+        self::initialize($data,$fun);
+
+        if(self::$count=count(self::$data)){
+            if(self::$count>count(self::$cellKey)){
+                return Json::fail('表头长度过长');
+            }
+            self::$cells=self::$cellKey[self::$count-1];
+        }else{
+            return Json::fail('data 参数二不能为空');
+        }
+        return new self;
+    }
+    /**
+     * 设置标题
+     * @param $title string || array ['title'=>'','name'=>'','info'=>[]]
+     * @param $Name string
+     * @param $info string || array;
+     * @param $funName function($style,$A,$A2) 自定义设置头部样式
+     * @return $this
+     */
+    public function setExcelTile($title='',$Name='',$info=[],$funName=null){
+        //设置参数
+        if(is_array($title)){
+            if(isset($title['title'])) $title=$title['title'];
+            if(isset($title['name'])) $Name=$title['name'];
+            if(isset($title['info'])) $info=$title['info'];
+        }
+        if(empty($title))
+            $title=self::$title;
+        else
+            self::$title=$title;
+        if(empty($Name)) $Name=time();
+        //设置Excel属性
+        self::$PHPExcel ->getProperties()
+            ->setCreator("Neo")
+            ->setLastModifiedBy("Neo")
+            ->setTitle(self::setUtf8($title))
+            ->setSubject($Name)
+            ->setDescription("")
+            ->setKeywords($Name)
+            ->setCategory("");
+        //self::$PHPExcel ->getActiveSheet()->setCellValue('A1', $title);
+        //文字居中
+        self::$PHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+        self::$PHPExcel->getActiveSheet()->getStyle('A2')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+        self::$PHPExcel->setActiveSheetIndex(0);
+        self::$PHPExcel->getActiveSheet()->setTitle($Name);
+
+        //self::$PHPExcel->getActiveSheet()->setCellValue('A2',self::setCellInfo($info));
+        //合并表头单元格
+        self::$PHPExcel->getActiveSheet()->mergeCells('A1:'.self::$cells.'1');
+        self::$PHPExcel->getActiveSheet()->mergeCells('A2:'.self::$cells.'2');
+
+        self::$PHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(40);
+        self::$PHPExcel->getActiveSheet()->getRowDimension(2)->setRowHeight(20);
+        //设置表头行高
+        if($funName!==null && is_callable($funName)){
+            $fontstyle=self::$PHPExcel->getActiveSheet();
+            $funName($fontstyle,'A1','A2');
+        }else{
+            //设置表头字体
+            //self::$PHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('黑体');
+            //self::$PHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
+           // self::$PHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
+//            self::$PHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setName('宋体');
+//            self::$PHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setSize(14);
+        }
+        self::$PHPExcel->getActiveSheet()->getStyle('A3:'.self::$cells.'3')->getFont()->setBold(true);
+
+        return $this;
+    }
+    /**
+     * 设置第二行标题内容
+     * @param $info  array (['name'=>'','site'=>'','phone'=>123] || ['我是表名','我是地址','我是手机号码'] ) || string 自定义
+     * @return string
+     */
+    private static function setCellInfo($info){
+        $content=['操作者:','导出日期:'.date('Y-m-d',time()),'地址:','电话:'];
+        if(is_array($info) && !empty($info)){
+            if(isset($info['name'])){
+                $content[0].=$info['name'];
+            }else{
+                $content[0].=isset($info[0])?$info[0]:'';
+            }
+            if(isset($info['site'])){
+                $content[2].=$info['site'];
+            }else{
+                $content[2].=isset($info[1])?$info[1]:'';
+            }
+            if(isset($info['phone'])){
+                $content[3].=$info['phone'];
+            }else{
+                $content[3].=isset($info[2])?$info[2]:'';
+            }
+            return implode(' ',$content);
+        }else if(is_string($info)){
+            return empty($info)?implode(' ',$content):$info;
+        }
+    }
+}

+ 16 - 0
app/common/library/Pay.php

@@ -0,0 +1,16 @@
+<?php
+namespace app\common\library;
+
+class Pay{
+    public static function close($type,$orderNo){
+        if($type=='zfbh5'){
+            AliPay::ali_pay_calcel($orderNo);
+        }elseif ($type=='wx'){
+            $res=retrunWxConfig()
+                ->close([
+                    'out_trade_no'=>$orderNo,
+                ]);
+            user_log('wxOrderClose',$res);
+        }
+    }
+}

+ 3223 - 0
app/common/library/QRcode.php

@@ -0,0 +1,3223 @@
+<?php
+   namespace app\common\library;
+	define('QR_MODE_NUL', -1);
+	define('QR_MODE_NUM', 0);
+	define('QR_MODE_AN', 1);
+	define('QR_MODE_8', 2);
+	define('QR_MODE_KANJI', 3);
+	define('QR_MODE_STRUCTURE', 4);
+
+	// Levels of error correction.
+
+	define('QR_ECLEVEL_L', 0);
+	define('QR_ECLEVEL_M', 1);
+	define('QR_ECLEVEL_Q', 2);
+	define('QR_ECLEVEL_H', 3);
+	
+	// Supported output formats
+	
+	define('QR_FORMAT_TEXT', 0);
+	define('QR_FORMAT_PNG',  1);
+	
+	class qrstr {
+		public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
+			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
+		}
+	}
+     
+    define('QR_CACHEABLE', false);       // use cache - more disk reads but less CPU power, masks and format templates are stored there
+    define('QR_CACHE_DIR', false);       // used when QR_CACHEABLE === true
+    define('QR_LOG_DIR', false);         // default error logs dir   
+    
+    define('QR_FIND_BEST_MASK', true);                                                          // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
+    define('QR_FIND_FROM_RANDOM', 2);                                                       // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
+    define('QR_DEFAULT_MASK', 2);                                                               // when QR_FIND_BEST_MASK === false
+                                                  
+    define('QR_PNG_MAXIMUM_SIZE',  1024);                                                       // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
+                                                  
+
+
+
+//---- qrtools.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Toolset, handy and debug utilites.
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+    class QRtools {
+    
+        //----------------------------------------------------------------------
+        public static function binarize($frame)
+        {
+            $len = count($frame);
+            foreach ($frame as &$frameLine) {
+                
+                for($i=0; $i<$len; $i++) {
+                    $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
+                }
+            }
+            
+            return $frame;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
+        {
+            $barcode_array = array();
+            
+            if (!is_array($mode))
+                $mode = explode(',', $mode);
+                
+            $eccLevel = 'L';
+                
+            if (count($mode) > 1) {
+                $eccLevel = $mode[1];
+            }
+                
+            $qrTab = QRcode::text($code, false, $eccLevel);
+            $size = count($qrTab);
+                
+            $barcode_array['num_rows'] = $size;
+            $barcode_array['num_cols'] = $size;
+            $barcode_array['bcode'] = array();
+                
+            foreach ($qrTab as $line) {
+                $arrAdd = array();
+                foreach(str_split($line) as $char)
+                    $arrAdd[] = ($char=='1')?1:0;
+                $barcode_array['bcode'][] = $arrAdd;
+            }
+                    
+            return $barcode_array;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function clearCache()
+        {
+            self::$frames = array();
+        }
+        
+        //----------------------------------------------------------------------
+        public static function buildCache()
+        {
+			QRtools::markTime('before_build_cache');
+			
+			$mask = new QRmask();
+            for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
+                $frame = QRspec::newFrame($a);
+                if (QR_IMAGE) {
+                    $fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
+                    QRimage::png(self::binarize($frame), $fileName, 1, 0);
+                }
+				
+				$width = count($frame);
+				$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+				for ($maskNo=0; $maskNo<8; $maskNo++)
+					$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
+            }
+			
+			QRtools::markTime('after_build_cache');
+        }
+
+        //----------------------------------------------------------------------
+        public static function log($outfile, $err)
+        {
+            if (QR_LOG_DIR !== false) {
+                if ($err != '') {
+                    if ($outfile !== false) {
+                        file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+                    } else {
+                        file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+                    }
+                }    
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public static function dumpMask($frame) 
+        {
+            $width = count($frame);
+            for($y=0;$y<$width;$y++) {
+                for($x=0;$x<$width;$x++) {
+                    echo ord($frame[$y][$x]).',';
+                }
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public static function markTime($markerId)
+        {
+            list($usec, $sec) = explode(" ", microtime());
+            $time = ((float)$usec + (float)$sec);
+            
+            if (!isset($GLOBALS['qr_time_bench']))
+                $GLOBALS['qr_time_bench'] = array();
+            
+            $GLOBALS['qr_time_bench'][$markerId] = $time;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function timeBenchmark()
+        {
+            self::markTime('finish');
+        
+            $lastTime = 0;
+            $startTime = 0;
+            $p = 0;
+
+            echo '<table cellpadding="3" cellspacing="1">
+                    <thead><tr style="border-bottom:1px solid silver"><td colspan="2" style="text-align:center">BENCHMARK</td></tr></thead>
+                    <tbody>';
+
+            foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
+                if ($p > 0) {
+                    echo '<tr><th style="text-align:right">till '.$markerId.': </th><td>'.number_format($thisTime-$lastTime, 6).'s</td></tr>';
+                } else {
+                    $startTime = $thisTime;
+                }
+                
+                $p++;
+                $lastTime = $thisTime;
+            }
+            
+            echo '</tbody><tfoot>
+                <tr style="border-top:2px solid black"><th style="text-align:right">TOTAL: </th><td>'.number_format($lastTime-$startTime, 6).'s</td></tr>
+            </tfoot>
+            </table>';
+        }
+        
+    }
+    
+    //##########################################################################
+    
+    QRtools::markTime('start');
+    
+
+
+
+//---- qrspec.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * QR Code specifications
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ *  or
+ * "Automatic identification and data capture techniques -- 
+ *  QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+    define('QRSPEC_VERSION_MAX', 40);
+    define('QRSPEC_WIDTH_MAX',   177);
+
+    define('QRCAP_WIDTH',        0);
+    define('QRCAP_WORDS',        1);
+    define('QRCAP_REMINDER',     2);
+    define('QRCAP_EC',           3);
+
+    class QRspec {
+    
+        public static $capacity = array(
+            array(  0,    0, 0, array(   0,    0,    0,    0)),
+            array( 21,   26, 0, array(   7,   10,   13,   17)), // 1
+            array( 25,   44, 7, array(  10,   16,   22,   28)),
+            array( 29,   70, 7, array(  15,   26,   36,   44)),
+            array( 33,  100, 7, array(  20,   36,   52,   64)),
+            array( 37,  134, 7, array(  26,   48,   72,   88)), // 5
+            array( 41,  172, 7, array(  36,   64,   96,  112)),
+            array( 45,  196, 0, array(  40,   72,  108,  130)),
+            array( 49,  242, 0, array(  48,   88,  132,  156)),
+            array( 53,  292, 0, array(  60,  110,  160,  192)),
+            array( 57,  346, 0, array(  72,  130,  192,  224)), //10
+            array( 61,  404, 0, array(  80,  150,  224,  264)),
+            array( 65,  466, 0, array(  96,  176,  260,  308)),
+            array( 69,  532, 0, array( 104,  198,  288,  352)),
+            array( 73,  581, 3, array( 120,  216,  320,  384)),
+            array( 77,  655, 3, array( 132,  240,  360,  432)), //15
+            array( 81,  733, 3, array( 144,  280,  408,  480)),
+            array( 85,  815, 3, array( 168,  308,  448,  532)),
+            array( 89,  901, 3, array( 180,  338,  504,  588)),
+            array( 93,  991, 3, array( 196,  364,  546,  650)),
+            array( 97, 1085, 3, array( 224,  416,  600,  700)), //20
+            array(101, 1156, 4, array( 224,  442,  644,  750)),
+            array(105, 1258, 4, array( 252,  476,  690,  816)),
+            array(109, 1364, 4, array( 270,  504,  750,  900)),
+            array(113, 1474, 4, array( 300,  560,  810,  960)),
+            array(117, 1588, 4, array( 312,  588,  870, 1050)), //25
+            array(121, 1706, 4, array( 336,  644,  952, 1110)),
+            array(125, 1828, 4, array( 360,  700, 1020, 1200)),
+            array(129, 1921, 3, array( 390,  728, 1050, 1260)),
+            array(133, 2051, 3, array( 420,  784, 1140, 1350)),
+            array(137, 2185, 3, array( 450,  812, 1200, 1440)), //30
+            array(141, 2323, 3, array( 480,  868, 1290, 1530)),
+            array(145, 2465, 3, array( 510,  924, 1350, 1620)),
+            array(149, 2611, 3, array( 540,  980, 1440, 1710)),
+            array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
+            array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
+            array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
+            array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
+            array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
+            array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
+            array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
+        );
+        
+        //----------------------------------------------------------------------
+        public static function getDataLength($version, $level)
+        {
+            return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
+        }
+        
+        //----------------------------------------------------------------------
+        public static function getECCLength($version, $level)
+        {
+            return self::$capacity[$version][QRCAP_EC][$level];
+        }
+        
+        //----------------------------------------------------------------------
+        public static function getWidth($version)
+        {
+            return self::$capacity[$version][QRCAP_WIDTH];
+        }
+        
+        //----------------------------------------------------------------------
+        public static function getRemainder($version)
+        {
+            return self::$capacity[$version][QRCAP_REMINDER];
+        }
+        
+        //----------------------------------------------------------------------
+        public static function getMinimumVersion($size, $level)
+        {
+
+            for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
+                $words  = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
+                if($words >= $size) 
+                    return $i;
+            }
+
+            return -1;
+        }
+    
+        //######################################################################
+        
+        public static $lengthTableBits = array(
+            array(10, 12, 14),
+            array( 9, 11, 13),
+            array( 8, 16, 16),
+            array( 8, 10, 12)
+        );
+        
+        //----------------------------------------------------------------------
+        public static function lengthIndicator($mode, $version)
+        {
+            if ($mode == QR_MODE_STRUCTURE)
+                return 0;
+                
+            if ($version <= 9) {
+                $l = 0;
+            } else if ($version <= 26) {
+                $l = 1;
+            } else {
+                $l = 2;
+            }
+
+            return self::$lengthTableBits[$mode][$l];
+        }
+        
+        //----------------------------------------------------------------------
+        public static function maximumWords($mode, $version)
+        {
+            if($mode == QR_MODE_STRUCTURE) 
+                return 3;
+                
+            if($version <= 9) {
+                $l = 0;
+            } else if($version <= 26) {
+                $l = 1;
+            } else {
+                $l = 2;
+            }
+
+            $bits = self::$lengthTableBits[$mode][$l];
+            $words = (1 << $bits) - 1;
+            
+            if($mode == QR_MODE_KANJI) {
+                $words *= 2; // the number of bytes is required
+            }
+
+            return $words;
+        }
+
+        // Error correction code -----------------------------------------------
+        // Table of the error correction code (Reed-Solomon block)
+        // See Table 12-16 (pp.30-36), JIS X0510:2004.
+
+        public static $eccTable = array(
+            array(array( 0,  0), array( 0,  0), array( 0,  0), array( 0,  0)),
+            array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)), // 1
+            array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)),
+            array(array( 1,  0), array( 1,  0), array( 2,  0), array( 2,  0)),
+            array(array( 1,  0), array( 2,  0), array( 2,  0), array( 4,  0)),
+            array(array( 1,  0), array( 2,  0), array( 2,  2), array( 2,  2)), // 5
+            array(array( 2,  0), array( 4,  0), array( 4,  0), array( 4,  0)),
+            array(array( 2,  0), array( 4,  0), array( 2,  4), array( 4,  1)),
+            array(array( 2,  0), array( 2,  2), array( 4,  2), array( 4,  2)),
+            array(array( 2,  0), array( 3,  2), array( 4,  4), array( 4,  4)),
+            array(array( 2,  2), array( 4,  1), array( 6,  2), array( 6,  2)), //10
+            array(array( 4,  0), array( 1,  4), array( 4,  4), array( 3,  8)),
+            array(array( 2,  2), array( 6,  2), array( 4,  6), array( 7,  4)),
+            array(array( 4,  0), array( 8,  1), array( 8,  4), array(12,  4)),
+            array(array( 3,  1), array( 4,  5), array(11,  5), array(11,  5)),
+            array(array( 5,  1), array( 5,  5), array( 5,  7), array(11,  7)), //15
+            array(array( 5,  1), array( 7,  3), array(15,  2), array( 3, 13)),
+            array(array( 1,  5), array(10,  1), array( 1, 15), array( 2, 17)),
+            array(array( 5,  1), array( 9,  4), array(17,  1), array( 2, 19)),
+            array(array( 3,  4), array( 3, 11), array(17,  4), array( 9, 16)),
+            array(array( 3,  5), array( 3, 13), array(15,  5), array(15, 10)), //20
+            array(array( 4,  4), array(17,  0), array(17,  6), array(19,  6)),
+            array(array( 2,  7), array(17,  0), array( 7, 16), array(34,  0)),
+            array(array( 4,  5), array( 4, 14), array(11, 14), array(16, 14)),
+            array(array( 6,  4), array( 6, 14), array(11, 16), array(30,  2)),
+            array(array( 8,  4), array( 8, 13), array( 7, 22), array(22, 13)), //25
+            array(array(10,  2), array(19,  4), array(28,  6), array(33,  4)),
+            array(array( 8,  4), array(22,  3), array( 8, 26), array(12, 28)),
+            array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
+            array(array( 7,  7), array(21,  7), array( 1, 37), array(19, 26)),
+            array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
+            array(array(13,  3), array( 2, 29), array(42,  1), array(23, 28)),
+            array(array(17,  0), array(10, 23), array(10, 35), array(19, 35)),
+            array(array(17,  1), array(14, 21), array(29, 19), array(11, 46)),
+            array(array(13,  6), array(14, 23), array(44,  7), array(59,  1)),
+            array(array(12,  7), array(12, 26), array(39, 14), array(22, 41)), //35
+            array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
+            array(array(17,  4), array(29, 14), array(49, 10), array(24, 46)),
+            array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
+            array(array(20,  4), array(40,  7), array(43, 22), array(10, 67)),
+            array(array(19,  6), array(18, 31), array(34, 34), array(20, 61)),//40
+        );                                                                       
+
+        //----------------------------------------------------------------------
+        // CACHEABLE!!!
+        
+        public static function getEccSpec($version, $level, array &$spec)
+        {
+            if (count($spec) < 5) {
+                $spec = array(0,0,0,0,0);
+            }
+
+            $b1   = self::$eccTable[$version][$level][0];
+            $b2   = self::$eccTable[$version][$level][1];
+            $data = self::getDataLength($version, $level);
+            $ecc  = self::getECCLength($version, $level);
+
+            if($b2 == 0) {
+                $spec[0] = $b1;
+                $spec[1] = (int)($data / $b1);
+                $spec[2] = (int)($ecc / $b1);
+                $spec[3] = 0; 
+                $spec[4] = 0;
+            } else {
+                $spec[0] = $b1;
+                $spec[1] = (int)($data / ($b1 + $b2));
+                $spec[2] = (int)($ecc  / ($b1 + $b2));
+                $spec[3] = $b2;
+                $spec[4] = $spec[1] + 1;
+            }
+        }
+
+        // Alignment pattern ---------------------------------------------------
+
+        // Positions of alignment patterns.
+        // This array includes only the second and the third position of the 
+        // alignment patterns. Rest of them can be calculated from the distance 
+        // between them.
+         
+        // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
+         
+        public static $alignmentPattern = array(      
+            array( 0,  0),
+            array( 0,  0), array(18,  0), array(22,  0), array(26,  0), array(30,  0), // 1- 5
+            array(34,  0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
+            array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
+            array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
+            array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
+            array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
+            array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
+            array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
+        );                                                                                  
+
+        
+        /** --------------------------------------------------------------------
+         * Put an alignment marker.
+         * @param frame
+         * @param width
+         * @param ox,oy center coordinate of the pattern
+         */
+        public static function putAlignmentMarker(array &$frame, $ox, $oy)
+        {
+            $finder = array(
+                "\xa1\xa1\xa1\xa1\xa1",
+                "\xa1\xa0\xa0\xa0\xa1",
+                "\xa1\xa0\xa1\xa0\xa1",
+                "\xa1\xa0\xa0\xa0\xa1",
+                "\xa1\xa1\xa1\xa1\xa1"
+            );                        
+            
+            $yStart = $oy-2;         
+            $xStart = $ox-2;
+            
+            for($y=0; $y<5; $y++) {
+                QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public static function putAlignmentPattern($version, &$frame, $width)
+        {
+            if($version < 2)
+                return;
+
+            $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
+            if($d < 0) {
+                $w = 2;
+            } else {
+                $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
+            }
+
+            if($w * $w - 3 == 1) {
+                $x = self::$alignmentPattern[$version][0];
+                $y = self::$alignmentPattern[$version][0];
+                self::putAlignmentMarker($frame, $x, $y);
+                return;
+            }
+
+            $cx = self::$alignmentPattern[$version][0];
+            for($x=1; $x<$w - 1; $x++) {
+                self::putAlignmentMarker($frame, 6, $cx);
+                self::putAlignmentMarker($frame, $cx,  6);
+                $cx += $d;
+            }
+
+            $cy = self::$alignmentPattern[$version][0];
+            for($y=0; $y<$w-1; $y++) {
+                $cx = self::$alignmentPattern[$version][0];
+                for($x=0; $x<$w-1; $x++) {
+                    self::putAlignmentMarker($frame, $cx, $cy);
+                    $cx += $d;
+                }
+                $cy += $d;
+            }
+        }
+
+        // Version information pattern -----------------------------------------
+
+		// Version information pattern (BCH coded).
+        // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
+        
+		// size: [QRSPEC_VERSION_MAX - 6]
+		
+        public static $versionPattern = array(
+            0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
+            0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
+            0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
+            0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
+            0x27541, 0x28c69
+        );
+
+        //----------------------------------------------------------------------
+        public static function getVersionPattern($version)
+        {
+            if($version < 7 || $version > QRSPEC_VERSION_MAX)
+                return 0;
+
+            return self::$versionPattern[$version -7];
+        }
+
+        // Format information --------------------------------------------------
+        // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
+        
+        public static $formatInfo = array(
+            array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
+            array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
+            array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
+            array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
+        );
+
+        public static function getFormatInfo($mask, $level)
+        {
+            if($mask < 0 || $mask > 7)
+                return 0;
+                
+            if($level < 0 || $level > 3)
+                return 0;                
+
+            return self::$formatInfo[$level][$mask];
+        }
+
+        // Frame ---------------------------------------------------------------
+        // Cache of initial frames.
+         
+        public static $frames = array();
+
+        /** --------------------------------------------------------------------
+         * Put a finder pattern.
+         * @param frame
+         * @param width
+         * @param ox,oy upper-left coordinate of the pattern
+         */
+        public static function putFinderPattern(&$frame, $ox, $oy)
+        {
+            $finder = array(
+                "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
+                "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+                "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+                "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+                "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+                "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+                "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
+            );                            
+            
+            for($y=0; $y<7; $y++) {
+                QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public static function createFrame($version)
+        {
+            $width = self::$capacity[$version][QRCAP_WIDTH];
+            $frameLine = str_repeat ("\0", $width);
+            $frame = array_fill(0, $width, $frameLine);
+
+            // Finder pattern
+            self::putFinderPattern($frame, 0, 0);
+            self::putFinderPattern($frame, $width - 7, 0);
+            self::putFinderPattern($frame, 0, $width - 7);
+            
+            // Separator
+            $yOffset = $width - 7;
+            
+            for($y=0; $y<7; $y++) {
+                $frame[$y][7] = "\xc0";
+                $frame[$y][$width - 8] = "\xc0";
+                $frame[$yOffset][7] = "\xc0";
+                $yOffset++;
+            }
+            
+            $setPattern = str_repeat("\xc0", 8);
+            
+            QRstr::set($frame, 0, 7, $setPattern);
+            QRstr::set($frame, $width-8, 7, $setPattern);
+            QRstr::set($frame, 0, $width - 8, $setPattern);
+        
+            // Format info
+            $setPattern = str_repeat("\x84", 9);
+            QRstr::set($frame, 0, 8, $setPattern);
+            QRstr::set($frame, $width - 8, 8, $setPattern, 8);
+            
+            $yOffset = $width - 8;
+
+            for($y=0; $y<8; $y++,$yOffset++) {
+                $frame[$y][8] = "\x84";
+                $frame[$yOffset][8] = "\x84";
+            }
+
+            // Timing pattern  
+            
+            for($i=1; $i<$width-15; $i++) {
+                $frame[6][7+$i] = chr(0x90 | ($i & 1));
+                $frame[7+$i][6] = chr(0x90 | ($i & 1));
+            }
+            
+            // Alignment pattern  
+            self::putAlignmentPattern($version, $frame, $width);
+            
+            // Version information 
+            if($version >= 7) {
+                $vinf = self::getVersionPattern($version);
+
+                $v = $vinf;
+                
+                for($x=0; $x<6; $x++) {
+                    for($y=0; $y<3; $y++) {
+                        $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
+                        $v = $v >> 1;
+                    }
+                }
+
+                $v = $vinf;
+                for($y=0; $y<6; $y++) {
+                    for($x=0; $x<3; $x++) {
+                        $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
+                        $v = $v >> 1;
+                    }
+                }
+            }
+    
+            // and a little bit...  
+            $frame[$width - 8][8] = "\x81";
+            
+            return $frame;
+        }
+
+        //----------------------------------------------------------------------
+        public static function debug($frame, $binary_mode = false)
+        {
+            if ($binary_mode) {
+            
+                    foreach ($frame as &$frameLine) {
+                        $frameLine = join('<span class="m">&nbsp;&nbsp;</span>', explode('0', $frameLine));
+                        $frameLine = join('&#9608;&#9608;', explode('1', $frameLine));
+                    }
+                    
+                    ?>
+                <style>
+                    .m { background-color: white; }
+                </style>
+                <?php
+                    echo '<pre><tt><br/ ><br/ ><br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
+                    echo join("<br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $frame);
+                    echo '</tt></pre><br/ ><br/ ><br/ ><br/ ><br/ ><br/ >';
+            
+            } else {
+            
+                foreach ($frame as &$frameLine) {
+                    $frameLine = join('<span class="m">&nbsp;</span>',  explode("\xc0", $frameLine));
+                    $frameLine = join('<span class="m">&#9618;</span>', explode("\xc1", $frameLine));
+                    $frameLine = join('<span class="p">&nbsp;</span>',  explode("\xa0", $frameLine));
+                    $frameLine = join('<span class="p">&#9618;</span>', explode("\xa1", $frameLine));
+                    $frameLine = join('<span class="s">&#9671;</span>', explode("\x84", $frameLine)); //format 0
+                    $frameLine = join('<span class="s">&#9670;</span>', explode("\x85", $frameLine)); //format 1
+                    $frameLine = join('<span class="x">&#9762;</span>', explode("\x81", $frameLine)); //special bit
+                    $frameLine = join('<span class="c">&nbsp;</span>',  explode("\x90", $frameLine)); //clock 0
+                    $frameLine = join('<span class="c">&#9719;</span>', explode("\x91", $frameLine)); //clock 1
+                    $frameLine = join('<span class="f">&nbsp;</span>',  explode("\x88", $frameLine)); //version
+                    $frameLine = join('<span class="f">&#9618;</span>', explode("\x89", $frameLine)); //version
+                    $frameLine = join('&#9830;', explode("\x01", $frameLine));
+                    $frameLine = join('&#8901;', explode("\0", $frameLine));
+                }
+                
+                ?>
+                <style>
+                    .p { background-color: yellow; }
+                    .m { background-color: #00FF00; }
+                    .s { background-color: #FF0000; }
+                    .c { background-color: aqua; }
+                    .x { background-color: pink; }
+                    .f { background-color: gold; }
+                </style>
+                <?php
+                echo "<pre><tt>";
+                echo join("<br/ >", $frame);
+                echo "</tt></pre>";
+            
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public static function serial($frame)
+        {
+            return gzcompress(join("\n", $frame), 9);
+        }
+        
+        //----------------------------------------------------------------------
+        public static function unserial($code)
+        {
+            return explode("\n", gzuncompress($code));
+        }
+        
+        //----------------------------------------------------------------------
+        public static function newFrame($version)
+        {
+            if($version < 1 || $version > QRSPEC_VERSION_MAX) 
+                return null;
+
+            if(!isset(self::$frames[$version])) {
+                
+                $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
+                
+                if (QR_CACHEABLE) {
+                    if (file_exists($fileName)) {
+                        self::$frames[$version] = self::unserial(file_get_contents($fileName));
+                    } else {
+                        self::$frames[$version] = self::createFrame($version);
+                        file_put_contents($fileName, self::serial(self::$frames[$version]));
+                    }
+                } else {
+                    self::$frames[$version] = self::createFrame($version);
+                }
+            }
+            
+            if(is_null(self::$frames[$version]))
+                return null;
+
+            return self::$frames[$version];
+        }
+
+        //----------------------------------------------------------------------
+        public static function rsBlockNum($spec)     { return $spec[0] + $spec[3]; }
+        public static function rsBlockNum1($spec)    { return $spec[0]; }
+        public static function rsDataCodes1($spec)   { return $spec[1]; }
+        public static function rsEccCodes1($spec)    { return $spec[2]; }
+        public static function rsBlockNum2($spec)    { return $spec[3]; }
+        public static function rsDataCodes2($spec)   { return $spec[4]; }
+        public static function rsEccCodes2($spec)    { return $spec[2]; }
+        public static function rsDataLength($spec)   { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]);    }
+        public static function rsEccLength($spec)    { return ($spec[0] + $spec[3]) * $spec[2]; }
+        
+    }
+
+
+
+//---- qrimage.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Image output of code using GD2
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+    define('QR_IMAGE', true);
+
+    class QRimage {
+    
+        //----------------------------------------------------------------------
+        public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE) 
+        {
+            $image = self::image($frame, $pixelPerPoint, $outerFrame);
+            
+            if ($filename === false) {
+                Header("Content-type: image/png");
+                ImagePng($image);
+            } else {
+                if($saveandprint===TRUE){
+                    ImagePng($image, $filename);
+                    header("Content-type: image/png");
+                    ImagePng($image);
+                }else{
+                    ImagePng($image, $filename);
+                }
+            }
+            
+            ImageDestroy($image);
+        }
+    
+        //----------------------------------------------------------------------
+        public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85) 
+        {
+            $image = self::image($frame, $pixelPerPoint, $outerFrame);
+            
+            if ($filename === false) {
+                Header("Content-type: image/jpeg");
+                ImageJpeg($image, null, $q);
+            } else {
+                ImageJpeg($image, $filename, $q);            
+            }
+            
+            ImageDestroy($image);
+        }
+    
+        //----------------------------------------------------------------------
+        private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4) 
+        {
+            $h = count($frame);
+            $w = strlen($frame[0]);
+            
+            $imgW = $w + 2*$outerFrame;
+            $imgH = $h + 2*$outerFrame;
+            
+            $base_image =ImageCreate($imgW, $imgH);
+            
+            $col[0] = ImageColorAllocate($base_image,255,255,255);
+            $col[1] = ImageColorAllocate($base_image,0,0,0);
+
+            imagefill($base_image, 0, 0, $col[0]);
+
+            for($y=0; $y<$h; $y++) {
+                for($x=0; $x<$w; $x++) {
+                    if ($frame[$y][$x] == '1') {
+                        ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]); 
+                    }
+                }
+            }
+            
+            $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
+            ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
+            ImageDestroy($base_image);
+            
+            return $target_image;
+        }
+    }
+
+
+
+//---- qrinput.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Input encoding class
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+    define('STRUCTURE_HEADER_BITS',  20);
+    define('MAX_STRUCTURED_SYMBOLS', 16);
+
+    class QRinputItem {
+    
+        public $mode;
+        public $size;
+        public $data;
+        public $bstream;
+
+        public function __construct($mode, $size, $data, $bstream = null) 
+        {
+            $setData = array_slice($data, 0, $size);
+            
+            if (count($setData) < $size) {
+                $setData = array_merge($setData, array_fill(0,$size-count($setData),0));
+            }
+        
+            if(!QRinput::check($mode, $size, $setData)) {
+                throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
+                return null;
+            }
+            
+            $this->mode = $mode;
+            $this->size = $size;
+            $this->data = $setData;
+            $this->bstream = $bstream;
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeModeNum($version)
+        {
+            try {
+            
+                $words = (int)($this->size / 3);
+                $bs = new QRbitstream();
+                
+                $val = 0x1;
+                $bs->appendNum(4, $val);
+                $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
+
+                for($i=0; $i<$words; $i++) {
+                    $val  = (ord($this->data[$i*3  ]) - ord('0')) * 100;
+                    $val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
+                    $val += (ord($this->data[$i*3+2]) - ord('0'));
+                    $bs->appendNum(10, $val);
+                }
+
+                if($this->size - $words * 3 == 1) {
+                    $val = ord($this->data[$words*3]) - ord('0');
+                    $bs->appendNum(4, $val);
+                } else if($this->size - $words * 3 == 2) {
+                    $val  = (ord($this->data[$words*3  ]) - ord('0')) * 10;
+                    $val += (ord($this->data[$words*3+1]) - ord('0'));
+                    $bs->appendNum(7, $val);
+                }
+
+                $this->bstream = $bs;
+                return 0;
+                
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeModeAn($version)
+        {
+            try {
+                $words = (int)($this->size / 2);
+                $bs = new QRbitstream();
+                
+                $bs->appendNum(4, 0x02);
+                $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
+
+                for($i=0; $i<$words; $i++) {
+                    $val  = (int)QRinput::lookAnTable(ord($this->data[$i*2  ])) * 45;
+                    $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
+
+                    $bs->appendNum(11, $val);
+                }
+
+                if($this->size & 1) {
+                    $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
+                    $bs->appendNum(6, $val);
+                }
+        
+                $this->bstream = $bs;
+                return 0;
+            
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeMode8($version)
+        {
+            try {
+                $bs = new QRbitstream();
+
+                $bs->appendNum(4, 0x4);
+                $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
+
+                for($i=0; $i<$this->size; $i++) {
+                    $bs->appendNum(8, ord($this->data[$i]));
+                }
+
+                $this->bstream = $bs;
+                return 0;
+            
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeModeKanji($version)
+        {
+            try {
+
+                $bs = new QRbitrtream();
+                
+                $bs->appendNum(4, 0x8);
+                $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
+
+                for($i=0; $i<$this->size; $i+=2) {
+                    $val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
+                    if($val <= 0x9ffc) {
+                        $val -= 0x8140;
+                    } else {
+                        $val -= 0xc140;
+                    }
+                    
+                    $h = ($val >> 8) * 0xc0;
+                    $val = ($val & 0xff) + $h;
+
+                    $bs->appendNum(13, $val);
+                }
+
+                $this->bstream = $bs;
+                return 0;
+            
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public function encodeModeStructure()
+        {
+            try {
+                $bs =  new QRbitstream();
+                
+                $bs->appendNum(4, 0x03);
+                $bs->appendNum(4, ord($this->data[1]) - 1);
+                $bs->appendNum(4, ord($this->data[0]) - 1);
+                $bs->appendNum(8, ord($this->data[2]));
+
+                $this->bstream = $bs;
+                return 0;
+            
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public function estimateBitStreamSizeOfEntry($version)
+        {
+            $bits = 0;
+
+            if($version == 0) 
+                $version = 1;
+
+            switch($this->mode) {
+                case QR_MODE_NUM:        $bits = QRinput::estimateBitsModeNum($this->size);    break;
+                case QR_MODE_AN:        $bits = QRinput::estimateBitsModeAn($this->size);    break;
+                case QR_MODE_8:            $bits = QRinput::estimateBitsMode8($this->size);    break;
+                case QR_MODE_KANJI:        $bits = QRinput::estimateBitsModeKanji($this->size);break;
+                case QR_MODE_STRUCTURE:    return STRUCTURE_HEADER_BITS;            
+                default:
+                    return 0;
+            }
+
+            $l = QRspec::lengthIndicator($this->mode, $version);
+            $m = 1 << $l;
+            $num = (int)(($this->size + $m - 1) / $m);
+
+            $bits += $num * (4 + $l);
+
+            return $bits;
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeBitStream($version)
+        {
+            try {
+            
+                unset($this->bstream);
+                $words = QRspec::maximumWords($this->mode, $version);
+                
+                if($this->size > $words) {
+                
+                    $st1 = new QRinputItem($this->mode, $words, $this->data);
+                    $st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
+
+                    $st1->encodeBitStream($version);
+                    $st2->encodeBitStream($version);
+                    
+                    $this->bstream = new QRbitstream();
+                    $this->bstream->append($st1->bstream);
+                    $this->bstream->append($st2->bstream);
+                    
+                    unset($st1);
+                    unset($st2);
+                    
+                } else {
+                    
+                    $ret = 0;
+                    
+                    switch($this->mode) {
+                        case QR_MODE_NUM:        $ret = $this->encodeModeNum($version);    break;
+                        case QR_MODE_AN:        $ret = $this->encodeModeAn($version);    break;
+                        case QR_MODE_8:            $ret = $this->encodeMode8($version);    break;
+                        case QR_MODE_KANJI:        $ret = $this->encodeModeKanji($version);break;
+                        case QR_MODE_STRUCTURE:    $ret = $this->encodeModeStructure();    break;
+                        
+                        default:
+                            break;
+                    }
+                    
+                    if($ret < 0)
+                        return -1;
+                }
+
+                return $this->bstream->size();
+            
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+    };
+    
+    //##########################################################################
+
+    class QRinput {
+
+        public $items;
+        
+        private $version;
+        private $level;
+        
+        //----------------------------------------------------------------------
+        public function __construct($version = 0, $level = QR_ECLEVEL_L)
+        {
+            if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
+                throw new Exception('Invalid version no');
+                return NULL;
+            }
+            
+            $this->version = $version;
+            $this->level = $level;
+        }
+        
+        //----------------------------------------------------------------------
+        public function getVersion()
+        {
+            return $this->version;
+        }
+        
+        //----------------------------------------------------------------------
+        public function setVersion($version)
+        {
+            if($version < 0 || $version > QRSPEC_VERSION_MAX) {
+                throw new Exception('Invalid version no');
+                return -1;
+            }
+
+            $this->version = $version;
+
+            return 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function getErrorCorrectionLevel()
+        {
+            return $this->level;
+        }
+
+        //----------------------------------------------------------------------
+        public function setErrorCorrectionLevel($level)
+        {
+            if($level > QR_ECLEVEL_H) {
+                throw new Exception('Invalid ECLEVEL');
+                return -1;
+            }
+
+            $this->level = $level;
+
+            return 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function appendEntry(QRinputItem $entry)
+        {
+            $this->items[] = $entry;
+        }
+        
+        //----------------------------------------------------------------------
+        public function append($mode, $size, $data)
+        {
+            try {
+                $entry = new QRinputItem($mode, $size, $data);
+                $this->items[] = $entry;
+                return 0;
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        
+        public function insertStructuredAppendHeader($size, $index, $parity)
+        {
+            if( $size > MAX_STRUCTURED_SYMBOLS ) {
+                throw new Exception('insertStructuredAppendHeader wrong size');
+            }
+            
+            if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
+                throw new Exception('insertStructuredAppendHeader wrong index');
+            }
+
+            $buf = array($size, $index, $parity);
+            
+            try {
+                $entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
+                array_unshift($this->items, $entry);
+                return 0;
+            } catch (Exception $e) {
+                return -1;
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public function calcParity()
+        {
+            $parity = 0;
+            
+            foreach($this->items as $item) {
+                if($item->mode != QR_MODE_STRUCTURE) {
+                    for($i=$item->size-1; $i>=0; $i--) {
+                        $parity ^= $item->data[$i];
+                    }
+                }
+            }
+
+            return $parity;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function checkModeNum($size, $data)
+        {
+            for($i=0; $i<$size; $i++) {
+                if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        //----------------------------------------------------------------------
+        public static function estimateBitsModeNum($size)
+        {
+            $w = (int)$size / 3;
+            $bits = $w * 10;
+            
+            switch($size - $w * 3) {
+                case 1:
+                    $bits += 4;
+                    break;
+                case 2:
+                    $bits += 7;
+                    break;
+                default:
+                    break;
+            }
+
+            return $bits;
+        }
+        
+        //----------------------------------------------------------------------
+        public static $anTable = array(
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
+             0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1,
+            -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+            25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+        );
+        
+        //----------------------------------------------------------------------
+        public static function lookAnTable($c)
+        {
+            return (($c > 127)?-1:self::$anTable[$c]);
+        }
+        
+        //----------------------------------------------------------------------
+        public static function checkModeAn($size, $data)
+        {
+            for($i=0; $i<$size; $i++) {
+                if (self::lookAnTable(ord($data[$i])) == -1) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function estimateBitsModeAn($size)
+        {
+            $w = (int)($size / 2);
+            $bits = $w * 11;
+            
+            if($size & 1) {
+                $bits += 6;
+            }
+
+            return $bits;
+        }
+    
+        //----------------------------------------------------------------------
+        public static function estimateBitsMode8($size)
+        {
+            return $size * 8;
+        }
+        
+        //----------------------------------------------------------------------
+        public function estimateBitsModeKanji($size)
+        {
+            return (int)(($size / 2) * 13);
+        }
+        
+        //----------------------------------------------------------------------
+        public static function checkModeKanji($size, $data)
+        {
+            if($size & 1)
+                return false;
+
+            for($i=0; $i<$size; $i+=2) {
+                $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
+                if( $val < 0x8140 
+                || ($val > 0x9ffc && $val < 0xe040) 
+                || $val > 0xebbf) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        /***********************************************************************
+         * Validation
+         **********************************************************************/
+
+        public static function check($mode, $size, $data)
+        {
+            if($size <= 0) 
+                return false;
+
+            switch($mode) {
+                case QR_MODE_NUM:       return self::checkModeNum($size, $data);   break;
+                case QR_MODE_AN:        return self::checkModeAn($size, $data);    break;
+                case QR_MODE_KANJI:     return self::checkModeKanji($size, $data); break;
+                case QR_MODE_8:         return true; break;
+                case QR_MODE_STRUCTURE: return true; break;
+                
+                default:
+                    break;
+            }
+
+            return false;
+        }
+        
+        
+        //----------------------------------------------------------------------
+        public function estimateBitStreamSize($version)
+        {
+            $bits = 0;
+
+            foreach($this->items as $item) {
+                $bits += $item->estimateBitStreamSizeOfEntry($version);
+            }
+
+            return $bits;
+        }
+        
+        //----------------------------------------------------------------------
+        public function estimateVersion()
+        {
+            $version = 0;
+            $prev = 0;
+            do {
+                $prev = $version;
+                $bits = $this->estimateBitStreamSize($prev);
+                $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+                if ($version < 0) {
+                    return -1;
+                }
+            } while ($version > $prev);
+
+            return $version;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function lengthOfCode($mode, $version, $bits)
+        {
+            $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
+            switch($mode) {
+                case QR_MODE_NUM:
+                    $chunks = (int)($payload / 10);
+                    $remain = $payload - $chunks * 10;
+                    $size = $chunks * 3;
+                    if($remain >= 7) {
+                        $size += 2;
+                    } else if($remain >= 4) {
+                        $size += 1;
+                    }
+                    break;
+                case QR_MODE_AN:
+                    $chunks = (int)($payload / 11);
+                    $remain = $payload - $chunks * 11;
+                    $size = $chunks * 2;
+                    if($remain >= 6) 
+                        $size++;
+                    break;
+                case QR_MODE_8:
+                    $size = (int)($payload / 8);
+                    break;
+                case QR_MODE_KANJI:
+                    $size = (int)(($payload / 13) * 2);
+                    break;
+                case QR_MODE_STRUCTURE:
+                    $size = (int)($payload / 8);
+                    break;
+                default:
+                    $size = 0;
+                    break;
+            }
+            
+            $maxsize = QRspec::maximumWords($mode, $version);
+            if($size < 0) $size = 0;
+            if($size > $maxsize) $size = $maxsize;
+
+            return $size;
+        }
+        
+        //----------------------------------------------------------------------
+        public function createBitStream()
+        {
+            $total = 0;
+
+            foreach($this->items as $item) {
+                $bits = $item->encodeBitStream($this->version);
+                
+                if($bits < 0) 
+                    return -1;
+                    
+                $total += $bits;
+            }
+
+            return $total;
+        }
+        
+        //----------------------------------------------------------------------
+        public function convertData()
+        {
+            $ver = $this->estimateVersion();
+            if($ver > $this->getVersion()) {
+                $this->setVersion($ver);
+            }
+
+            for(;;) {
+                $bits = $this->createBitStream();
+                
+                if($bits < 0) 
+                    return -1;
+                    
+                $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+                if($ver < 0) {
+                    throw new Exception('WRONG VERSION');
+                    return -1;
+                } else if($ver > $this->getVersion()) {
+                    $this->setVersion($ver);
+                } else {
+                    break;
+                }
+            }
+
+            return 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function appendPaddingBit(&$bstream)
+        {
+            $bits = $bstream->size();
+            $maxwords = QRspec::getDataLength($this->version, $this->level);
+            $maxbits = $maxwords * 8;
+
+            if ($maxbits == $bits) {
+                return 0;
+            }
+
+            if ($maxbits - $bits < 5) {
+                return $bstream->appendNum($maxbits - $bits, 0);
+            }
+
+            $bits += 4;
+            $words = (int)(($bits + 7) / 8);
+
+            $padding = new QRbitstream();
+            $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
+            
+            if($ret < 0) 
+                return $ret;
+
+            $padlen = $maxwords - $words;
+            
+            if($padlen > 0) {
+                
+                $padbuf = array();
+                for($i=0; $i<$padlen; $i++) {
+                    $padbuf[$i] = ($i&1)?0x11:0xec;
+                }
+                
+                $ret = $padding->appendBytes($padlen, $padbuf);
+                
+                if($ret < 0)
+                    return $ret;
+                
+            }
+
+            $ret = $bstream->append($padding);
+            
+            return $ret;
+        }
+
+        //----------------------------------------------------------------------
+        public function mergeBitStream()
+        {
+            if($this->convertData() < 0) {
+                return null;
+            }
+
+            $bstream = new QRbitstream();
+            
+            foreach($this->items as $item) {
+                $ret = $bstream->append($item->bstream);
+                if($ret < 0) {
+                    return null;
+                }
+            }
+
+            return $bstream;
+        }
+
+        //----------------------------------------------------------------------
+        public function getBitStream()
+        {
+
+            $bstream = $this->mergeBitStream();
+            
+            if($bstream == null) {
+                return null;
+            }
+            
+            $ret = $this->appendPaddingBit($bstream);
+            if($ret < 0) {
+                return null;
+            }
+
+            return $bstream;
+        }
+        
+        //----------------------------------------------------------------------
+        public function getByteStream()
+        {
+            $bstream = $this->getBitStream();
+            if($bstream == null) {
+                return null;
+            }
+            
+            return $bstream->toByte();
+        }
+    }
+        
+        
+    
+
+
+
+//---- qrbitstream.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Bitstream class
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+     
+    class QRbitstream {
+    
+        public $data = array();
+        
+        //----------------------------------------------------------------------
+        public function size()
+        {
+            return count($this->data);
+        }
+        
+        //----------------------------------------------------------------------
+        public function allocate($setLength)
+        {
+            $this->data = array_fill(0, $setLength, 0);
+            return 0;
+        }
+    
+        //----------------------------------------------------------------------
+        public static function newFromNum($bits, $num)
+        {
+            $bstream = new QRbitstream();
+            $bstream->allocate($bits);
+            
+            $mask = 1 << ($bits - 1);
+            for($i=0; $i<$bits; $i++) {
+                if($num & $mask) {
+                    $bstream->data[$i] = 1;
+                } else {
+                    $bstream->data[$i] = 0;
+                }
+                $mask = $mask >> 1;
+            }
+
+            return $bstream;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function newFromBytes($size, $data)
+        {
+            $bstream = new QRbitstream();
+            $bstream->allocate($size * 8);
+            $p=0;
+
+            for($i=0; $i<$size; $i++) {
+                $mask = 0x80;
+                for($j=0; $j<8; $j++) {
+                    if($data[$i] & $mask) {
+                        $bstream->data[$p] = 1;
+                    } else {
+                        $bstream->data[$p] = 0;
+                    }
+                    $p++;
+                    $mask = $mask >> 1;
+                }
+            }
+
+            return $bstream;
+        }
+        
+        //----------------------------------------------------------------------
+        public function append(QRbitstream $arg)
+        {
+            if (is_null($arg)) {
+                return -1;
+            }
+            
+            if($arg->size() == 0) {
+                return 0;
+            }
+            
+            if($this->size() == 0) {
+                $this->data = $arg->data;
+                return 0;
+            }
+            
+            $this->data = array_values(array_merge($this->data, $arg->data));
+
+            return 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function appendNum($bits, $num)
+        {
+            if ($bits == 0) 
+                return 0;
+
+            $b = QRbitstream::newFromNum($bits, $num);
+            
+            if(is_null($b))
+                return -1;
+
+            $ret = $this->append($b);
+            unset($b);
+
+            return $ret;
+        }
+
+        //----------------------------------------------------------------------
+        public function appendBytes($size, $data)
+        {
+            if ($size == 0) 
+                return 0;
+
+            $b = QRbitstream::newFromBytes($size, $data);
+            
+            if(is_null($b))
+                return -1;
+
+            $ret = $this->append($b);
+            unset($b);
+
+            return $ret;
+        }
+        
+        //----------------------------------------------------------------------
+        public function toByte()
+        {
+        
+            $size = $this->size();
+
+            if($size == 0) {
+                return array();
+            }
+            
+            $data = array_fill(0, (int)(($size + 7) / 8), 0);
+            $bytes = (int)($size / 8);
+
+            $p = 0;
+            
+            for($i=0; $i<$bytes; $i++) {
+                $v = 0;
+                for($j=0; $j<8; $j++) {
+                    $v = $v << 1;
+                    $v |= $this->data[$p];
+                    $p++;
+                }
+                $data[$i] = $v;
+            }
+            
+            if($size & 7) {
+                $v = 0;
+                for($j=0; $j<($size & 7); $j++) {
+                    $v = $v << 1;
+                    $v |= $this->data[$p];
+                    $p++;
+                }
+                $data[$bytes] = $v;
+            }
+
+            return $data;
+        }
+
+    }
+
+
+
+
+//---- qrsplit.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Input splitting classes
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ *  or
+ * "Automatic identification and data capture techniques -- 
+ *  QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+    class QRsplit {
+
+        public $dataStr = '';
+        public $input;
+        public $modeHint;
+
+        //----------------------------------------------------------------------
+        public function __construct($dataStr, $input, $modeHint) 
+        {
+            $this->dataStr  = $dataStr;
+            $this->input    = $input;
+            $this->modeHint = $modeHint;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function isdigitat($str, $pos)
+        {    
+            if ($pos >= strlen($str))
+                return false;
+            
+            return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
+        }
+        
+        //----------------------------------------------------------------------
+        public static function isalnumat($str, $pos)
+        {
+            if ($pos >= strlen($str))
+                return false;
+                
+            return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
+        }
+
+        //----------------------------------------------------------------------
+        public function identifyMode($pos)
+        {
+            if ($pos >= strlen($this->dataStr)) 
+                return QR_MODE_NUL;
+                
+            $c = $this->dataStr[$pos];
+            
+            if(self::isdigitat($this->dataStr, $pos)) {
+                return QR_MODE_NUM;
+            } else if(self::isalnumat($this->dataStr, $pos)) {
+                return QR_MODE_AN;
+            } else if($this->modeHint == QR_MODE_KANJI) {
+            
+                if ($pos+1 < strlen($this->dataStr)) 
+                {
+                    $d = $this->dataStr[$pos+1];
+                    $word = (ord($c) << 8) | ord($d);
+                    if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
+                        return QR_MODE_KANJI;
+                    }
+                }
+            }
+
+            return QR_MODE_8;
+        } 
+        
+        //----------------------------------------------------------------------
+        public function eatNum()
+        {
+            $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+            $p = 0;
+            while(self::isdigitat($this->dataStr, $p)) {
+                $p++;
+            }
+            
+            $run = $p;
+            $mode = $this->identifyMode($p);
+            
+            if($mode == QR_MODE_8) {
+                $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+                     + QRinput::estimateBitsMode8(1)         // + 4 + l8
+                     - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+                if($dif > 0) {
+                    return $this->eat8();
+                }
+            }
+            if($mode == QR_MODE_AN) {
+                $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+                     + QRinput::estimateBitsModeAn(1)        // + 4 + la
+                     - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
+                if($dif > 0) {
+                    return $this->eatAn();
+                }
+            }
+            
+            $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
+            if($ret < 0)
+                return -1;
+
+            return $run;
+        }
+        
+        //----------------------------------------------------------------------
+        public function eatAn()
+        {
+            $la = QRspec::lengthIndicator(QR_MODE_AN,  $this->input->getVersion());
+            $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+            $p = 0;
+            
+            while(self::isalnumat($this->dataStr, $p)) {
+                if(self::isdigitat($this->dataStr, $p)) {
+                    $q = $p;
+                    while(self::isdigitat($this->dataStr, $q)) {
+                        $q++;
+                    }
+                    
+                    $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
+                         + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+                         - QRinput::estimateBitsModeAn($q); // - 4 - la
+                         
+                    if($dif < 0) {
+                        break;
+                    } else {
+                        $p = $q;
+                    }
+                } else {
+                    $p++;
+                }
+            }
+
+            $run = $p;
+
+            if(!self::isalnumat($this->dataStr, $p)) {
+                $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
+                     + QRinput::estimateBitsMode8(1) // + 4 + l8
+                      - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+                if($dif > 0) {
+                    return $this->eat8();
+                }
+            }
+
+            $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
+            if($ret < 0)
+                return -1;
+
+            return $run;
+        }
+        
+        //----------------------------------------------------------------------
+        public function eatKanji()
+        {
+            $p = 0;
+            
+            while($this->identifyMode($p) == QR_MODE_KANJI) {
+                $p += 2;
+            }
+            
+            $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
+            if($ret < 0)
+                return -1;
+
+            return $run;
+        }
+
+        //----------------------------------------------------------------------
+        public function eat8()
+        {
+            $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
+            $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+            $p = 1;
+            $dataStrLen = strlen($this->dataStr);
+            
+            while($p < $dataStrLen) {
+                
+                $mode = $this->identifyMode($p);
+                if($mode == QR_MODE_KANJI) {
+                    break;
+                }
+                if($mode == QR_MODE_NUM) {
+                    $q = $p;
+                    while(self::isdigitat($this->dataStr, $q)) {
+                        $q++;
+                    }
+                    $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+                         + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+                         - QRinput::estimateBitsMode8($q); // - 4 - l8
+                    if($dif < 0) {
+                        break;
+                    } else {
+                        $p = $q;
+                    }
+                } else if($mode == QR_MODE_AN) {
+                    $q = $p;
+                    while(self::isalnumat($this->dataStr, $q)) {
+                        $q++;
+                    }
+                    $dif = QRinput::estimateBitsMode8($p)  // + 4 + l8
+                         + QRinput::estimateBitsModeAn($q - $p) + 4 + $la
+                         - QRinput::estimateBitsMode8($q); // - 4 - l8
+                    if($dif < 0) {
+                        break;
+                    } else {
+                        $p = $q;
+                    }
+                } else {
+                    $p++;
+                }
+            }
+
+            $run = $p;
+            $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
+            
+            if($ret < 0)
+                return -1;
+
+            return $run;
+        }
+
+        //----------------------------------------------------------------------
+        public function splitString()
+        {
+            while (strlen($this->dataStr) > 0)
+            {
+                if($this->dataStr == '')
+                    return 0;
+
+                $mode = $this->identifyMode(0);
+                
+                switch ($mode) {
+                    case QR_MODE_NUM: $length = $this->eatNum(); break;
+                    case QR_MODE_AN:  $length = $this->eatAn(); break;
+                    case QR_MODE_KANJI:
+                        if ($hint == QR_MODE_KANJI)
+                                $length = $this->eatKanji();
+                        else    $length = $this->eat8();
+                        break;
+                    default: $length = $this->eat8(); break;
+                
+                }
+
+                if($length == 0) return 0;
+                if($length < 0)  return -1;
+                
+                $this->dataStr = substr($this->dataStr, $length);
+            }
+        }
+
+        //----------------------------------------------------------------------
+        public function toUpper()
+        {
+            $stringLen = strlen($this->dataStr);
+            $p = 0;
+            
+            while ($p<$stringLen) {
+                $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
+                if($mode == QR_MODE_KANJI) {
+                    $p += 2;
+                } else {
+                    if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) {
+                        $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
+                    }
+                    $p++;
+                }
+            }
+
+            return $this->dataStr;
+        }
+
+        //----------------------------------------------------------------------
+        public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true)
+        {
+            if(is_null($string) || $string == '\0' || $string == '') {
+                throw new Exception('empty string!!!');
+            }
+
+            $split = new QRsplit($string, $input, $modeHint);
+            
+            if(!$casesensitive)
+                $split->toUpper();
+                
+            return $split->splitString();
+        }
+    }
+
+
+
+//---- qrrscode.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Reed-Solomon error correction support
+ * 
+ * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
+ * (libfec is released under the GNU Lesser General Public License.)
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+    class QRrsItem {
+    
+        public $mm;                  // Bits per symbol 
+        public $nn;                  // Symbols per block (= (1<<mm)-1) 
+        public $alpha_to = array();  // log lookup table 
+        public $index_of = array();  // Antilog lookup table 
+        public $genpoly = array();   // Generator polynomial 
+        public $nroots;              // Number of generator roots = number of parity symbols 
+        public $fcr;                 // First consecutive root, index form 
+        public $prim;                // Primitive element, index form 
+        public $iprim;               // prim-th root of 1, index form 
+        public $pad;                 // Padding bytes in shortened block 
+        public $gfpoly;
+    
+        //----------------------------------------------------------------------
+        public function modnn($x)
+        {
+            while ($x >= $this->nn) {
+                $x -= $this->nn;
+                $x = ($x >> $this->mm) + ($x & $this->nn);
+            }
+            
+            return $x;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+        {
+            // Common code for intializing a Reed-Solomon control block (char or int symbols)
+            // Copyright 2004 Phil Karn, KA9Q
+            // May be used under the terms of the GNU Lesser General Public License (LGPL)
+
+            $rs = null;
+            
+            // Check parameter ranges
+            if($symsize < 0 || $symsize > 8)                     return $rs;
+            if($fcr < 0 || $fcr >= (1<<$symsize))                return $rs;
+            if($prim <= 0 || $prim >= (1<<$symsize))             return $rs;
+            if($nroots < 0 || $nroots >= (1<<$symsize))          return $rs; // Can't have more roots than symbol values!
+            if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
+
+            $rs = new QRrsItem();
+            $rs->mm = $symsize;
+            $rs->nn = (1<<$symsize)-1;
+            $rs->pad = $pad;
+
+            $rs->alpha_to = array_fill(0, $rs->nn+1, 0);
+            $rs->index_of = array_fill(0, $rs->nn+1, 0);
+          
+            // PHP style macro replacement ;)
+            $NN =& $rs->nn;
+            $A0 =& $NN;
+            
+            // Generate Galois field lookup tables
+            $rs->index_of[0] = $A0; // log(zero) = -inf
+            $rs->alpha_to[$A0] = 0; // alpha**-inf = 0
+            $sr = 1;
+          
+            for($i=0; $i<$rs->nn; $i++) {
+                $rs->index_of[$sr] = $i;
+                $rs->alpha_to[$i] = $sr;
+                $sr <<= 1;
+                if($sr & (1<<$symsize)) {
+                    $sr ^= $gfpoly;
+                }
+                $sr &= $rs->nn;
+            }
+            
+            if($sr != 1){
+                // field generator polynomial is not primitive!
+                $rs = NULL;
+                return $rs;
+            }
+
+            /* Form RS code generator polynomial from its roots */
+            $rs->genpoly = array_fill(0, $nroots+1, 0);
+        
+            $rs->fcr = $fcr;
+            $rs->prim = $prim;
+            $rs->nroots = $nroots;
+            $rs->gfpoly = $gfpoly;
+
+            /* Find prim-th root of 1, used in decoding */
+            for($iprim=1;($iprim % $prim) != 0;$iprim += $rs->nn)
+            ; // intentional empty-body loop!
+            
+            $rs->iprim = (int)($iprim / $prim);
+            $rs->genpoly[0] = 1;
+            
+            for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
+                $rs->genpoly[$i+1] = 1;
+
+                // Multiply rs->genpoly[] by  @**(root + x)
+                for ($j = $i; $j > 0; $j--) {
+                    if ($rs->genpoly[$j] != 0) {
+                        $rs->genpoly[$j] = $rs->genpoly[$j-1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)];
+                    } else {
+                        $rs->genpoly[$j] = $rs->genpoly[$j-1];
+                    }
+                }
+                // rs->genpoly[0] can never be zero
+                $rs->genpoly[0] = $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[0]] + $root)];
+            }
+            
+            // convert rs->genpoly[] to index form for quicker encoding
+            for ($i = 0; $i <= $nroots; $i++)
+                $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
+
+            return $rs;
+        }
+        
+        //----------------------------------------------------------------------
+        public function encode_rs_char($data, &$parity)
+        {
+            $MM       =& $this->mm;
+            $NN       =& $this->nn;
+            $ALPHA_TO =& $this->alpha_to;
+            $INDEX_OF =& $this->index_of;
+            $GENPOLY  =& $this->genpoly;
+            $NROOTS   =& $this->nroots;
+            $FCR      =& $this->fcr;
+            $PRIM     =& $this->prim;
+            $IPRIM    =& $this->iprim;
+            $PAD      =& $this->pad;
+            $A0       =& $NN;
+
+            $parity = array_fill(0, $NROOTS, 0);
+
+            for($i=0; $i< ($NN-$NROOTS-$PAD); $i++) {
+                
+                $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
+                if($feedback != $A0) {      
+                    // feedback term is non-zero
+            
+                    // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+                    // always be for the polynomials constructed by init_rs()
+                    $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback);
+            
+                    for($j=1;$j<$NROOTS;$j++) {
+                        $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS-$j])];
+                    }
+                }
+                
+                // Shift 
+                array_shift($parity);
+                if($feedback != $A0) {
+                    array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]);
+                } else {
+                    array_push($parity, 0);
+                }
+            }
+        }
+    }
+    
+    //##########################################################################
+    
+    class QRrs {
+    
+        public static $items = array();
+        
+        //----------------------------------------------------------------------
+        public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+        {
+            foreach(self::$items as $rs) {
+                if($rs->pad != $pad)       continue;
+                if($rs->nroots != $nroots) continue;
+                if($rs->mm != $symsize)    continue;
+                if($rs->gfpoly != $gfpoly) continue;
+                if($rs->fcr != $fcr)       continue;
+                if($rs->prim != $prim)     continue;
+
+                return $rs;
+            }
+
+            $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
+            array_unshift(self::$items, $rs);
+
+            return $rs;
+        }
+    }
+
+
+
+//---- qrmask.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Masking
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+	define('N1', 3);
+	define('N2', 3);
+	define('N3', 40);
+	define('N4', 10);
+
+	class QRmask {
+	
+		public $runLength = array();
+		
+		//----------------------------------------------------------------------
+		public function __construct() 
+        {
+            $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
+        }
+        
+        //----------------------------------------------------------------------
+        public function writeFormatInformation($width, &$frame, $mask, $level)
+        {
+            $blacks = 0;
+            $format =  QRspec::getFormatInfo($mask, $level);
+
+            for($i=0; $i<8; $i++) {
+                if($format & 1) {
+                    $blacks += 2;
+                    $v = 0x85;
+                } else {
+                    $v = 0x84;
+                }
+                
+                $frame[8][$width - 1 - $i] = chr($v);
+                if($i < 6) {
+                    $frame[$i][8] = chr($v);
+                } else {
+                    $frame[$i + 1][8] = chr($v);
+                }
+                $format = $format >> 1;
+            }
+            
+            for($i=0; $i<7; $i++) {
+                if($format & 1) {
+                    $blacks += 2;
+                    $v = 0x85;
+                } else {
+                    $v = 0x84;
+                }
+                
+                $frame[$width - 7 + $i][8] = chr($v);
+                if($i == 0) {
+                    $frame[8][7] = chr($v);
+                } else {
+                    $frame[8][6 - $i] = chr($v);
+                }
+                
+                $format = $format >> 1;
+            }
+
+            return $blacks;
+        }
+        
+        //----------------------------------------------------------------------
+        public function mask0($x, $y) { return ($x+$y)&1;                       }
+        public function mask1($x, $y) { return ($y&1);                          }
+        public function mask2($x, $y) { return ($x%3);                          }
+        public function mask3($x, $y) { return ($x+$y)%3;                       }
+        public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
+        public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3;           }
+        public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1;       }
+        public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1;     }
+        
+        //----------------------------------------------------------------------
+        private function generateMaskNo($maskNo, $width, $frame)
+        {
+            $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+            
+            for($y=0; $y<$width; $y++) {
+                for($x=0; $x<$width; $x++) {
+                    if(ord($frame[$y][$x]) & 0x80) {
+                        $bitMask[$y][$x] = 0;
+                    } else {
+                        $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
+                        $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
+                    }
+                    
+                }
+            }
+            
+            return $bitMask;
+        }
+        
+        //----------------------------------------------------------------------
+        public static function serial($bitFrame)
+        {
+            $codeArr = array();
+            
+            foreach ($bitFrame as $line)
+                $codeArr[] = join('', $line);
+                
+            return gzcompress(join("\n", $codeArr), 9);
+        }
+        
+        //----------------------------------------------------------------------
+        public static function unserial($code)
+        {
+            $codeArr = array();
+            
+            $codeLines = explode("\n", gzuncompress($code));
+            foreach ($codeLines as $line)
+                $codeArr[] = str_split($line);
+            
+            return $codeArr;
+        }
+        
+        //----------------------------------------------------------------------
+        public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false) 
+        {
+            $b = 0;
+            $bitMask = array();
+            
+            $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
+
+            if (QR_CACHEABLE) {
+                if (file_exists($fileName)) {
+                    $bitMask = self::unserial(file_get_contents($fileName));
+                } else {
+                    $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+                    if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
+                        mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
+                    file_put_contents($fileName, self::serial($bitMask));
+                }
+            } else {
+                $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+            }
+
+            if ($maskGenOnly)
+                return;
+                
+            $d = $s;
+
+            for($y=0; $y<$width; $y++) {
+                for($x=0; $x<$width; $x++) {
+                    if($bitMask[$y][$x] == 1) {
+                        $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
+                    }
+                    $b += (int)(ord($d[$y][$x]) & 1);
+                }
+            }
+
+            return $b;
+        }
+        
+        //----------------------------------------------------------------------
+        public function makeMask($width, $frame, $maskNo, $level)
+        {
+            $masked = array_fill(0, $width, str_repeat("\0", $width));
+            $this->makeMaskNo($maskNo, $width, $frame, $masked);
+            $this->writeFormatInformation($width, $masked, $maskNo, $level);
+       
+            return $masked;
+        }
+        
+        //----------------------------------------------------------------------
+        public function calcN1N3($length)
+        {
+            $demerit = 0;
+
+            for($i=0; $i<$length; $i++) {
+                
+                if($this->runLength[$i] >= 5) {
+                    $demerit += (N1 + ($this->runLength[$i] - 5));
+                }
+                if($i & 1) {
+                    if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
+                        $fact = (int)($this->runLength[$i] / 3);
+                        if(($this->runLength[$i-2] == $fact) &&
+                           ($this->runLength[$i-1] == $fact) &&
+                           ($this->runLength[$i+1] == $fact) &&
+                           ($this->runLength[$i+2] == $fact)) {
+                            if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
+                                $demerit += N3;
+                            } else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
+                                $demerit += N3;
+                            }
+                        }
+                    }
+                }
+            }
+            return $demerit;
+        }
+        
+        //----------------------------------------------------------------------
+        public function evaluateSymbol($width, $frame)
+        {
+            $head = 0;
+            $demerit = 0;
+
+            for($y=0; $y<$width; $y++) {
+                $head = 0;
+                $this->runLength[0] = 1;
+                
+                $frameY = $frame[$y];
+                
+                if ($y>0)
+                    $frameYM = $frame[$y-1];
+                
+                for($x=0; $x<$width; $x++) {
+                    if(($x > 0) && ($y > 0)) {
+                        $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
+                        $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
+                        
+                        if(($b22 | ($w22 ^ 1))&1) {                                                                     
+                            $demerit += N2;
+                        }
+                    }
+                    if(($x == 0) && (ord($frameY[$x]) & 1)) {
+                        $this->runLength[0] = -1;
+                        $head = 1;
+                        $this->runLength[$head] = 1;
+                    } else if($x > 0) {
+                        if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
+                            $head++;
+                            $this->runLength[$head] = 1;
+                        } else {
+                            $this->runLength[$head]++;
+                        }
+                    }
+                }
+    
+                $demerit += $this->calcN1N3($head+1);
+            }
+
+            for($x=0; $x<$width; $x++) {
+                $head = 0;
+                $this->runLength[0] = 1;
+                
+                for($y=0; $y<$width; $y++) {
+                    if($y == 0 && (ord($frame[$y][$x]) & 1)) {
+                        $this->runLength[0] = -1;
+                        $head = 1;
+                        $this->runLength[$head] = 1;
+                    } else if($y > 0) {
+                        if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
+                            $head++;
+                            $this->runLength[$head] = 1;
+                        } else {
+                            $this->runLength[$head]++;
+                        }
+                    }
+                }
+            
+                $demerit += $this->calcN1N3($head+1);
+            }
+
+            return $demerit;
+        }
+        
+        
+        //----------------------------------------------------------------------
+        public function mask($width, $frame, $level)
+        {
+            $minDemerit = PHP_INT_MAX;
+            $bestMaskNum = 0;
+            $bestMask = array();
+            
+            $checked_masks = array(0,1,2,3,4,5,6,7);
+            
+            if (QR_FIND_FROM_RANDOM !== false) {
+            
+                $howManuOut = 8-(QR_FIND_FROM_RANDOM % 9);
+                for ($i = 0; $i <  $howManuOut; $i++) {
+                    $remPos = rand (0, count($checked_masks)-1);
+                    unset($checked_masks[$remPos]);
+                    $checked_masks = array_values($checked_masks);
+                }
+            
+            }
+            
+            $bestMask = $frame;
+             
+            foreach($checked_masks as $i) {
+                $mask = array_fill(0, $width, str_repeat("\0", $width));
+
+                $demerit = 0;
+                $blacks = 0;
+                $blacks  = $this->makeMaskNo($i, $width, $frame, $mask);
+                $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
+                $blacks  = (int)(100 * $blacks / ($width * $width));
+                $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
+                $demerit += $this->evaluateSymbol($width, $mask);
+                
+                if($demerit < $minDemerit) {
+                    $minDemerit = $demerit;
+                    $bestMask = $mask;
+                    $bestMaskNum = $i;
+                }
+            }
+            
+            return $bestMask;
+        }
+        
+        //----------------------------------------------------------------------
+    }
+
+
+
+
+//---- qrencode.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Main encoder classes.
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ 
+    class QRrsblock {
+        public $dataLength;
+        public $data = array();
+        public $eccLength;
+        public $ecc = array();
+        
+        public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
+        {
+            $rs->encode_rs_char($data, $ecc);
+        
+            $this->dataLength = $dl;
+            $this->data = $data;
+            $this->eccLength = $el;
+            $this->ecc = $ecc;
+        }
+    };
+    
+    //##########################################################################
+
+    class QRrawcode {
+        public $version;
+        public $datacode = array();
+        public $ecccode = array();
+        public $blocks;
+        public $rsblocks = array(); //of RSblock
+        public $count;
+        public $dataLength;
+        public $eccLength;
+        public $b1;
+        
+        //----------------------------------------------------------------------
+        public function __construct(QRinput $input)
+        {
+            $spec = array(0,0,0,0,0);
+            
+            $this->datacode = $input->getByteStream();
+            if(is_null($this->datacode)) {
+                throw new Exception('null imput string');
+            }
+
+            QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
+
+            $this->version = $input->getVersion();
+            $this->b1 = QRspec::rsBlockNum1($spec);
+            $this->dataLength = QRspec::rsDataLength($spec);
+            $this->eccLength = QRspec::rsEccLength($spec);
+            $this->ecccode = array_fill(0, $this->eccLength, 0);
+            $this->blocks = QRspec::rsBlockNum($spec);
+            
+            $ret = $this->init($spec);
+            if($ret < 0) {
+                throw new Exception('block alloc error');
+                return null;
+            }
+
+            $this->count = 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function init(array $spec)
+        {
+            $dl = QRspec::rsDataCodes1($spec);
+            $el = QRspec::rsEccCodes1($spec);
+            $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+            
+
+            $blockNo = 0;
+            $dataPos = 0;
+            $eccPos = 0;
+            for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
+                $ecc = array_slice($this->ecccode,$eccPos);
+                $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el,  $ecc, $rs);
+                $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+                
+                $dataPos += $dl;
+                $eccPos += $el;
+                $blockNo++;
+            }
+
+            if(QRspec::rsBlockNum2($spec) == 0)
+                return 0;
+
+            $dl = QRspec::rsDataCodes2($spec);
+            $el = QRspec::rsEccCodes2($spec);
+            $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+            
+            if($rs == NULL) return -1;
+            
+            for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
+                $ecc = array_slice($this->ecccode,$eccPos);
+                $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+                $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+                
+                $dataPos += $dl;
+                $eccPos += $el;
+                $blockNo++;
+            }
+
+            return 0;
+        }
+        
+        //----------------------------------------------------------------------
+        public function getCode()
+        {
+            $ret;
+
+            if($this->count < $this->dataLength) {
+                $row = $this->count % $this->blocks;
+                $col = $this->count / $this->blocks;
+                if($col >= $this->rsblocks[0]->dataLength) {
+                    $row += $this->b1;
+                }
+                $ret = $this->rsblocks[$row]->data[$col];
+            } else if($this->count < $this->dataLength + $this->eccLength) {
+                $row = ($this->count - $this->dataLength) % $this->blocks;
+                $col = ($this->count - $this->dataLength) / $this->blocks;
+                $ret = $this->rsblocks[$row]->ecc[$col];
+            } else {
+                return 0;
+            }
+            $this->count++;
+            
+            return $ret;
+        }
+    }
+
+    //##########################################################################
+    
+    class QRcode {
+    
+        public $version;
+        public $width;
+        public $data; 
+        
+        //----------------------------------------------------------------------
+        public function encodeMask(QRinput $input, $mask)
+        {
+            if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
+                throw new Exception('wrong version');
+            }
+            if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
+                throw new Exception('wrong level');
+            }
+
+            $raw = new QRrawcode($input);
+            
+            QRtools::markTime('after_raw');
+            
+            $version = $raw->version;
+            $width = QRspec::getWidth($version);
+            $frame = QRspec::newFrame($version);
+            
+            $filler = new FrameFiller($width, $frame);
+            if(is_null($filler)) {
+                return NULL;
+            }
+
+            // inteleaved data and ecc codes
+            for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
+                $code = $raw->getCode();
+                $bit = 0x80;
+                for($j=0; $j<8; $j++) {
+                    $addr = $filler->next();
+                    $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
+                    $bit = $bit >> 1;
+                }
+            }
+            
+            QRtools::markTime('after_filler');
+            
+            unset($raw);
+            
+            // remainder bits
+            $j = QRspec::getRemainder($version);
+            for($i=0; $i<$j; $i++) {
+                $addr = $filler->next();
+                $filler->setFrameAt($addr, 0x02);
+            }
+            
+            $frame = $filler->frame;
+            unset($filler);
+            
+            
+            // masking
+            $maskObj = new QRmask();
+            if($mask < 0) {
+            
+                if (QR_FIND_BEST_MASK) {
+                    $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
+                } else {
+                    $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
+                }
+            } else {
+                $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
+            }
+            
+            if($masked == NULL) {
+                return NULL;
+            }
+            
+            QRtools::markTime('after_mask');
+            
+            $this->version = $version;
+            $this->width = $width;
+            $this->data = $masked;
+            
+            return $this;
+        }
+    
+        //----------------------------------------------------------------------
+        public function encodeInput(QRinput $input)
+        {
+            return $this->encodeMask($input, -1);
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeString8bit($string, $version, $level)
+        {
+            if(string == NULL) {
+                throw new Exception('empty string!');
+                return NULL;
+            }
+
+            $input = new QRinput($version, $level);
+            if($input == NULL) return NULL;
+
+            $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
+            if($ret < 0) {
+                unset($input);
+                return NULL;
+            }
+            return $this->encodeInput($input);
+        }
+
+        //----------------------------------------------------------------------
+        public function encodeString($string, $version, $level, $hint, $casesensitive)
+        {
+
+            if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
+                throw new Exception('bad hint');
+                return NULL;
+            }
+
+            $input = new QRinput($version, $level);
+            if($input == NULL) return NULL;
+
+            $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
+            if($ret < 0) {
+                return NULL;
+            }
+
+            return $this->encodeInput($input);
+        }
+        
+        //----------------------------------------------------------------------
+        public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false) 
+        {
+            $enc = QRencode::factory($level, $size, $margin);
+            return $enc->encodePNG($text, $outfile, $saveandprint=false);
+        }
+
+        //----------------------------------------------------------------------
+        public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4) 
+        {
+            $enc = QRencode::factory($level, $size, $margin);
+            return $enc->encode($text, $outfile);
+        }
+
+        //----------------------------------------------------------------------
+        public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4) 
+        {
+            $enc = QRencode::factory($level, $size, $margin);
+            return $enc->encodeRAW($text, $outfile);
+        }
+    }
+    
+    //##########################################################################
+    
+    class FrameFiller {
+    
+        public $width;
+        public $frame;
+        public $x;
+        public $y;
+        public $dir;
+        public $bit;
+        
+        //----------------------------------------------------------------------
+        public function __construct($width, &$frame)
+        {
+            $this->width = $width;
+            $this->frame = $frame;
+            $this->x = $width - 1;
+            $this->y = $width - 1;
+            $this->dir = -1;
+            $this->bit = -1;
+        }
+        
+        //----------------------------------------------------------------------
+        public function setFrameAt($at, $val)
+        {
+            $this->frame[$at['y']][$at['x']] = chr($val);
+        }
+        
+        //----------------------------------------------------------------------
+        public function getFrameAt($at)
+        {
+            return ord($this->frame[$at['y']][$at['x']]);
+        }
+        
+        //----------------------------------------------------------------------
+        public function next()
+        {
+            do {
+            
+                if($this->bit == -1) {
+                    $this->bit = 0;
+                    return array('x'=>$this->x, 'y'=>$this->y);
+                }
+
+                $x = $this->x;
+                $y = $this->y;
+                $w = $this->width;
+
+                if($this->bit == 0) {
+                    $x--;
+                    $this->bit++;
+                } else {
+                    $x++;
+                    $y += $this->dir;
+                    $this->bit--;
+                }
+
+                if($this->dir < 0) {
+                    if($y < 0) {
+                        $y = 0;
+                        $x -= 2;
+                        $this->dir = 1;
+                        if($x == 6) {
+                            $x--;
+                            $y = 9;
+                        }
+                    }
+                } else {
+                    if($y == $w) {
+                        $y = $w - 1;
+                        $x -= 2;
+                        $this->dir = -1;
+                        if($x == 6) {
+                            $x--;
+                            $y -= 8;
+                        }
+                    }
+                }
+                if($x < 0 || $y < 0) return null;
+
+                $this->x = $x;
+                $this->y = $y;
+
+            } while(ord($this->frame[$y][$x]) & 0x80);
+                        
+            return array('x'=>$x, 'y'=>$y);
+        }
+        
+    } ;
+    
+    //##########################################################################    
+    
+    class QRencode {
+    
+        public $casesensitive = true;
+        public $eightbit = false;
+        
+        public $version = 0;
+        public $size = 3;
+        public $margin = 4;
+        
+        public $structured = 0; // not supported yet
+        
+        public $level = QR_ECLEVEL_L;
+        public $hint = QR_MODE_8;
+        
+        //----------------------------------------------------------------------
+        public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+        {
+            $enc = new QRencode();
+            $enc->size = $size;
+            $enc->margin = $margin;
+            
+            switch ($level.'') {
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                        $enc->level = $level;
+                    break;
+                case 'l':
+                case 'L':
+                        $enc->level = QR_ECLEVEL_L;
+                    break;
+                case 'm':
+                case 'M':
+                        $enc->level = QR_ECLEVEL_M;
+                    break;
+                case 'q':
+                case 'Q':
+                        $enc->level = QR_ECLEVEL_Q;
+                    break;
+                case 'h':
+                case 'H':
+                        $enc->level = QR_ECLEVEL_H;
+                    break;
+            }
+            
+            return $enc;
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodeRAW($intext, $outfile = false) 
+        {
+            $code = new QRcode();
+
+            if($this->eightbit) {
+                $code->encodeString8bit($intext, $this->version, $this->level);
+            } else {
+                $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+            }
+            
+            return $code->data;
+        }
+
+        //----------------------------------------------------------------------
+        public function encode($intext, $outfile = false) 
+        {
+            $code = new QRcode();
+
+            if($this->eightbit) {
+                $code->encodeString8bit($intext, $this->version, $this->level);
+            } else {
+                $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+            }
+            
+            QRtools::markTime('after_encode');
+            
+            if ($outfile!== false) {
+                file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
+            } else {
+                return QRtools::binarize($code->data);
+            }
+        }
+        
+        //----------------------------------------------------------------------
+        public function encodePNG($intext, $outfile = false,$saveandprint=false) 
+        {
+            try {
+            
+                ob_start();
+                $tab = $this->encode($intext);
+                $err = ob_get_contents();
+                ob_end_clean();
+                
+                if ($err != '')
+                    QRtools::log($outfile, $err);
+                
+                $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
+                
+                QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
+            
+            } catch (Exception $e) {
+            
+                QRtools::log($outfile, $e->getMessage());
+            
+            }
+        }
+    }
+
+

+ 129 - 0
app/common/library/Shande.php

@@ -0,0 +1,129 @@
+<?php
+namespace app\common\library;
+use think\Controller;
+use function EasyWeChat\Kernel\Support\get_client_ip;
+
+date_default_timezone_set('Asia/Shanghai');
+header('Content-type:text/html;charset=utf-8');
+//require_once './class/common.php';
+//require_once './class/H5FastPay.php';
+
+require_once env('root_path').'application/common/library/shande/Common.php';
+require_once env('root_path').'application/common/library/shande/H5FastPay.php';
+
+class Shande extends Controller
+{
+    // 统一下单接口
+    // https://open.sandpay.com.cn/product/detail/43308/43720/43721
+    public static function orderPay($order_no,$amout,$body,$notifyurl,$frontUrl)
+    {
+        $client = new \H5FastPay;
+        // 参数
+        $client->body = array(
+            'orderCode'   => $order_no,
+            //'totalAmount' => '000000000012',
+            'totalAmount' => $amout,
+            'subject'     => $body,
+            'body'        => $body,
+            'payMode'     => 'sand_h5',
+            'clientIp'    => get_client_ip(),
+            //'notifyUrl'   => 'http://192.168.1.66/sandpay-qr-phpdemo/notifyurl.php',
+            'notifyUrl'   => $notifyurl,
+            //'frontUrl'    => 'http://192.168.1.66/sandpay-qr-phpdemo/notifyurl.php',
+            'frontUrl'    => $frontUrl,
+        );
+        // 返回结果
+        $ret = $client->request('orderPay');
+        return $ret;
+    }
+
+    // 订单查询接口
+    public function orderQuery()
+    {
+        $client = new \H5FastPay;
+        // 参数, 每次需要重新赋值
+        $client->body = array(
+            'orderCode' => date('YmdHis', time()) + '0601',
+            'extend'    => ''
+        );
+        // 返回结果
+        $ret = $client->request('orderQuery');
+        echo '<pre class="myCode">';
+        print_r($ret);
+        echo '</pre>';
+    }
+
+    // 退款申请
+    public function orderRefund()
+    {
+        $client = new \H5FastPay;
+        // 参数
+        $client->body = array(
+            'orderCode'          => 'Y20181204170925675836', //新的订单号
+            'oriOrderCode'       => '2017091551421977', //原订单号
+            'refundAmount'       => '000000000012', //退款金额
+            'refundMarketAmount' => '000000000012', //退营销金额
+            'notifyUrl'          => 'http://192.168.22.171/sandpay-qr-phpdemo.bak/test/dist/notifyUrl.php',
+            'refundReason'       => 'test',
+            'extend'             => ''
+        );
+        // 返回结果
+        $ret = $client->request('orderRefund');
+        echo '<pre class="myCode">';
+        print_r($ret);
+        echo '</pre>';
+    }
+
+    // 异步通知通用接口
+    public function notify()
+    {
+        $client = new H5FastPay;
+        $sign   = $_POST['sign']; //签名
+        $data   = stripslashes($_POST['data']); //支付数据
+
+        // 验签
+        try {
+            $verifyFlag = $client->verify($data, $sign);
+            if ($verifyFlag) {
+                echo '签名正确';
+            } else {
+                echo '签名错误';
+            }
+        } catch (\Exception $e) {
+            echo $e->getMessage();
+        }
+    }
+
+    // 商户自主重发异步通知接口
+    public function orderMcAutoNotice()
+    {
+        $client = new H5FastPay;
+        // 参数
+        $client->body = array(
+            'orderCode'  => 'Y201805071725592',
+            'noticeType' => '00',
+        );
+        // 返回结果
+        $ret = $client->request('orderMcAutoNotice');
+        echo '<pre class="myCode">';
+        print_r($ret);
+        echo '</pre>';
+    }
+
+    // 对账单申请接口
+    public function clearfileDownload()
+    {
+        $client = new H5FastPay;
+        // 参数
+        $client->body = array(
+            'clearDate' => '20200611', // 结算日期
+            'fileType'  => '1', // 文件返回类型
+            'extend'    => ''
+        );
+        // 返回值
+        $ret = $client->request('clearfileDownload');
+        echo '<pre class="myCode">';
+        print_r($ret);
+        echo '</pre>';
+    }
+}

+ 158 - 0
app/common/library/Token.php

@@ -0,0 +1,158 @@
+<?php
+
+namespace app\common\library;
+
+use app\common\library\token\Driver;
+use think\App;
+use think\Config;
+use think\Log;
+
+/**
+ * Token操作类
+ */
+class Token
+{
+    /**
+     * @var array Token的实例
+     */
+    public static $instance = [];
+
+    /**
+     * @var object 操作句柄
+     */
+    public static $handler;
+
+    /**
+     * 连接Token驱动
+     * @access public
+     * @param  array $options 配置数组
+     * @param  bool|string $name Token连接标识 true 强制重新连接
+     * @return Driver
+     */
+    public static function connect(array $options = [], $name = false)
+    {
+        $type = !empty($options['type']) ? $options['type'] : 'File';
+
+        if (false === $name) {
+            $name = md5(serialize($options));
+        }
+
+        if (true === $name || !isset(self::$instance[$name])) {
+            $class = false === strpos($type, '\\') ?
+                '\\app\\common\\library\\token\\driver\\' . ucwords($type) :
+                $type;
+
+            // 记录初始化信息
+            App::$debug && Log::record('[ TOKEN ] INIT ' . $type, 'info');
+
+            if (true === $name) {
+                return new $class($options);
+            }
+
+            self::$instance[$name] = new $class($options);
+        }
+
+        return self::$instance[$name];
+    }
+
+    /**
+     * 自动初始化Token
+     * @access public
+     * @param  array $options 配置数组
+     * @return Driver
+     */
+    public static function init(array $options = [])
+    {
+        if (is_null(self::$handler)) {
+            if (empty($options) && 'complex' == Config::get('token.type')) {
+                $default = Config::get('token.default');
+                // 获取默认Token配置,并连接
+                $options = Config::get('token.' . $default['type']) ?: $default;
+            } elseif (empty($options)) {
+                $options = Config::get('token');
+            }
+            self::$handler = self::connect($options);
+        }
+
+        return self::$handler;
+    }
+
+    /**
+     * 判断Token是否可用(check别名)
+     * @access public
+     * @param  string $token Token标识
+     * @return bool
+     */
+    public static function has($token, $user_id)
+    {
+        return self::check($token, $user_id);
+    }
+
+    /**
+     * 判断Token是否可用
+     * @param string $token Token标识
+     * @return bool
+     */
+    public static function check($token, $user_id)
+    {
+        return self::init()->check($token, $user_id);
+    }
+
+    /**
+     * 读取Token
+     * @access public
+     * @param  string $token Token标识
+     * @param  mixed $default 默认值
+     * @return mixed
+     */
+    public static function get($token, $default = false)
+    {
+        return self::init()->get($token, $default);
+    }
+
+    /**
+     * 写入Token
+     * @access public
+     * @param  string $token Token标识
+     * @param  mixed $user_id 存储数据
+     * @param  int|null $expire 有效时间 0为永久
+     * @return boolean
+     */
+    public static function set($token, $user_id, $expire = null)
+    {
+        return self::init()->set($token, $user_id, $expire);
+    }
+
+    /**
+     * 删除Token(delete别名)
+     * @access public
+     * @param  string $token Token标识
+     * @return boolean
+     */
+    public static function rm($token)
+    {
+        return self::delete($token);
+    }
+
+    /**
+     * 删除Token
+     * @param string $token 标签名
+     * @return bool
+     */
+    public static function delete($token)
+    {
+        return self::init()->delete($token);
+    }
+
+    /**
+     * 清除Token
+     * @access public
+     * @param  string $token Token标记
+     * @return boolean
+     */
+    public static function clear($user_id = null)
+    {
+        return self::init()->clear($user_id);
+    }
+
+}

+ 8 - 0
app/common/library/UserException.php

@@ -0,0 +1,8 @@
+<?php
+namespace app\common\library;
+
+use think\Exception;
+
+class UserException extends Exception{
+
+}

+ 189 - 0
app/common/library/WxMerchPay.php

@@ -0,0 +1,189 @@
+<?php
+namespace app\common\library;
+
+use think\Controller;
+use app\common\model\Config;
+
+class WxMerchPay extends Controller
+{
+    //企业付款到微信零钱,PHP接口调用方法
+    /*
+      配置参数
+      */
+    /*
+  配置参数
+  */
+    public function __construct()
+    {
+        $this->appid = Config::get_values('wechat_appid');
+        $this->api_key = Config::get_values('wechat_mch_key');
+        $this->mch_id = Config::get_values('wechat_mch_id');
+    }
+//    private $config = array(
+//        'appid' => "wx57f0ba125c0f9351" ,//"wxcf1dded808489e2c",    /*微信开放平台上的应用id*/
+//        'mch_id' => "1526848461",//"1440493402",   /*微信申请成功之后邮件中的商户id*/
+//        'api_key' => "quanminchuangquanminchuang123521"    /*在微信商户平台上自己设定的api密钥 32位*/
+//    );
+
+
+    /**
+     * [xmltoarray xml格式转换为数组]
+     * @param [type] $xml [xml]
+     * @return [type]  [xml 转化为array]
+     */
+    function xmltoarray($xml) {
+        //禁止引用外部xml实体
+        libxml_disable_entity_loader(true);
+        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
+        $val = json_decode(json_encode($xmlstring),true);
+        return $val;
+    }
+
+    /**
+     * [arraytoxml 将数组转换成xml格式(简单方法):]
+     * @param [type] $data [数组]
+     * @return [type]  [array 转 xml]
+     */
+    function arraytoxml($data){
+        $str='<xml>';
+        foreach($data as $k=>$v) {
+            $str.='<'.$k.'>'.$v.'</'.$k.'>';
+        }
+        $str.='</xml>';
+        return $str;
+    }
+
+    /**
+     * [createNoncestr 生成随机字符串]
+     * @param integer $length [长度]
+     * @return [type]   [字母大小写加数字]
+     */
+    function createNoncestr($length =32){
+        $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789";
+        $str ="";
+
+        for($i=0;$i<$length;$i++){
+            $str.= substr($chars, mt_rand(0, strlen($chars)-1), 1);
+        }
+        return $str;
+    }
+
+    /**
+     * [curl_post_ssl 发送curl_post数据]
+     * @param [type] $url  [发送地址]
+     * @param [type] $xmldata [发送文件格式]
+     * @param [type] $second [设置执行最长秒数]
+     * @param [type] $aHeader [设置头部]
+     * @return [type]   [description]
+     */
+    function curl_post_ssl($url, $xmldata, $second = 30, $aHeader = array()){
+        $isdir = dirname(__DIR__) . "/wxcert/";//证书位置;绝对路径
+        $ch = curl_init();//初始化curl
+        curl_setopt($ch, CURLOPT_TIMEOUT, $second);//设置执行最长秒数
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
+        curl_setopt($ch, CURLOPT_URL, $url);//抓取指定网页
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 终止从服务端进行验证
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//
+        curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');//证书类型
+        curl_setopt($ch, CURLOPT_SSLCERT, $isdir . 'apiclient_cert.pem');//证书位置
+        curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');//CURLOPT_SSLKEY中规定的私钥的加密类型
+        curl_setopt($ch, CURLOPT_SSLKEY, $isdir . 'apiclient_key.pem');//证书位置
+        curl_setopt($ch, CURLOPT_CAINFO, 'PEM');
+        curl_setopt($ch, CURLOPT_CAINFO, $isdir . 'rootca.pem');
+        if (count($aHeader) >= 1) {
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $aHeader);//设置头部
+        }
+        curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);//全部数据使用HTTP协议中的"POST"操作来发送
+
+        $data = curl_exec($ch);//执行回话
+        if ($data) {
+            curl_close($ch);
+            return $data;
+        } else {
+            $error = curl_errno($ch);
+            echo "call faild, errorCode:$error\n";
+            curl_close($ch);
+            return false;
+        }
+    }
+
+
+    /**
+     * [sendMoney 企业付款到零钱]
+     * @param [type] $amount  [发送的金额(分)目前发送金额不能少于1元]
+     * @param [type] $re_openid [发送人的 openid]
+     * @param string $desc  [企业付款描述信息 (必填)]
+     * @param string $check_name [收款用户姓名 (选填)]
+     * @return [type]    [description]
+     */
+    function sendMoney($amount,$re_openid,$partner_trade_no,$desc='测试',$check_name=''){
+
+        $total_amount = (100) * $amount;
+        $data=array(
+            'mch_appid'=> $this->appid,//商户账号appid
+            'mchid'=>  $this->mch_id,//商户号
+            'nonce_str'=>$this->createNoncestr(),//随机字符串
+            'partner_trade_no'=> $partner_trade_no,//商户订单号
+            'openid'=> $re_openid,//用户openid
+            'check_name'=>'NO_CHECK',//校验用户姓名选项,
+            're_user_name'=> $check_name,//收款用户姓名
+            'amount'=>$total_amount,//金额
+            'desc'=> $desc,//企业付款描述信息
+            'spbill_create_ip'=> request()->ip(),//Ip地址
+        );
+
+        //生成签名算法
+        $secrect_key=$this->api_key;///这个就是个API密码。MD5 32位。
+        $data=array_filter($data);
+        ksort($data);
+        $str='';
+        foreach($data as $k=>$v) {
+            $str.=$k.'='.$v.'&';
+        }
+        $str.='key='.$secrect_key;
+        $data['sign']=md5($str);
+        //生成签名算法
+
+        $xml=$this->arraytoxml($data);
+
+        $url='https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers'; //调用接口
+        $res=$this->curl_post_ssl($url,$xml);
+        $return=$this->xmltoarray($res);
+
+        return $return;
+
+//        print_r($return);
+//        die;
+        //返回来的结果是xml,最后转换成数组
+        /*
+        array(9) {
+         ["return_code"]=>
+         string(7) "SUCCESS"
+         ["return_msg"]=>
+         array(0) {
+         }
+         ["mch_appid"]=>
+         string(18) "wx57676786465544b2a5"
+         ["mchid"]=>
+         string(10) "143345612"
+         ["nonce_str"]=>
+         string(32) "iw6TtHdOySMAfS81qcnqXojwUMn8l8mY"
+         ["result_code"]=>
+         string(7) "SUCCESS"
+         ["partner_trade_no"]=>
+         string(18) "201807011410504098"
+         ["payment_no"]=>
+         string(28) "1000018301201807019357038738"
+         ["payment_time"]=>
+         string(19) "2018-07-01 14:56:35"
+        }
+        */
+
+
+//        $responseObj = simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA);
+       // echo $res= $responseObj->return_code; //SUCCESS 如果返回来SUCCESS,则发生成功,处理自己的逻辑
+      //  return $responseObj;
+    }
+
+}

+ 394 - 0
app/common/library/WxPay.php

@@ -0,0 +1,394 @@
+<?php
+namespace app\common\library;
+
+use app\common\model\Config;
+use think\Controller;
+use think\Facade;
+use EasyWeChat\Factory;
+
+class WxPay extends Controller
+{
+    /*
+   配置参数
+   */
+    public function __construct()
+    {
+       // $this->appid = Config::get_values('small_wechat_id');
+        $this->appid = Config::get_values('wechat_appid');
+        $this->api_key = Config::get_values('wechat_mch_key');
+        $this->mch_id = Config::get_values('wechat_mch_id');
+
+    }
+//    private $config = array(
+//        'appid' => "wx57f0ba125c0f9351" ,//"wxcf1dded808489e2c",    /*微信开放平台上的应用id*/
+//        'mch_id' => "1526848461",//"1440493402",   /*微信申请成功之后邮件中的商户id*/
+//        'api_key' => "quanminchuangquanminchuang123521"    /*在微信商户平台上自己设定的api密钥 32位*/
+//    );
+
+    public function retrunconfig(){
+        $config = [
+           // 'app_id' => Config::get_values('small_wechat_id'),
+            'app_id' => Config::get_values('wechat_appid'),
+            'mch_id' =>Config::get_values('wechat_mch_id'),
+            'key' =>Config::get_values('wechat_mch_key'),
+            'sub_mch_id'=>'1612529165'
+        ];
+        return $config;
+    }
+
+    public function retrunconfig2(){
+        $config = [
+            'app_id' => Config::get_values('wechat_appid'),
+            'mch_id' =>Config::get_values('wechat_mch_id'),
+            'key' =>Config::get_values('wechat_mch_key'),
+            'sub_mch_id'=>'1612529165'
+        ];
+        return $config;
+    }
+
+    //获取预支付订单
+    public function getPrePayOrder($body, $out_trade_no, $total_fee, $notify_url,$come,$openid){
+
+        $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+
+        $onoce_str = $this->getRandChar(32);
+
+        $data["appid"] =  $this->appid;
+        $data["body"] = $body;
+        $data["mch_id"] = $this->mch_id;
+        $data["nonce_str"] = $onoce_str;
+        $data["notify_url"] = $notify_url;
+        $data["out_trade_no"] = $out_trade_no;
+        $data["spbill_create_ip"] = $this->get_client_ip();
+        $data["total_fee"] = floatval($total_fee);
+        //$data["trade_type"] = $come=='weixin' ? "JSAPI" : "APP";
+        $data["trade_type"] = "APP";
+        $data['sign_type'] = "MD5";
+//        if ($come=='weixin'){
+//            $data['openid'] = $openid;
+//        }
+        $s = $this->getSign($data);
+
+        $data["sign"] = $s;
+
+        $xml = $this->arrayToXml($data);
+
+        $response = $this->postXmlCurl($xml, $url);
+
+        //将微信返回的结果xml转成数组
+       //return $this->xmlstr_to_array($response);
+        return $this->xmlToArray($response);
+    }
+
+
+    public function wxrefund($out_trade_no,$out_refund_no,$total_fee,$refund_fee)
+    {
+        $param = array(
+            'appid'=> $this->appid,
+            'mch_id'=> $this->mch_id,
+            'nonce_str'=>  $this->getRandChar(32),
+            'out_trade_no'=>$out_trade_no,
+            'out_refund_no'=>$out_refund_no,//订单号
+          //  'transaction_id'=> $transactionId,//微信订单号
+            'total_fee'=> $total_fee*100,
+            'refund_fee'=>$refund_fee*100
+        );
+
+        $param['sign'] = $this->getSign($param);
+        $xmldata = $this->arrayToXml($param);
+        $xmlresult = $this->postXmlSSLCurl($xmldata,'https://api.mch.weixin.qq.com/secapi/pay/refund');
+        $result = $this->xmlToArray($xmlresult);
+        return $result;
+    }
+
+
+    //执行第二次签名,才能返回给客户端使用
+    public function getOrder($prepayId){
+        $data["appid"] = $this->appid;
+        $data["noncestr"] = $this->getRandChar(32);
+        $data["package"] = "Sign=WXPay";
+       // $data['package'] = "prepay_id=".$prepayId;
+        $data["partnerid"] = $this->mch_id;
+        $data["prepayid"] = $prepayId;
+        $data["signType"] = "MD5";
+        $data["timestamp"] = '' . time() . '';
+        $s = $this->getSign($data, false);
+        $data["sign"] = $s;
+
+        return $data;
+    }
+
+    /*
+        生成签名
+    */
+    function getSign($Obj)
+    {
+        foreach ($Obj as $k => $v)
+        {
+            $Parameters[strtolower($k)] = $v;
+        }
+        //签名步骤一:按字典序排序参数
+        ksort($Parameters);
+        $String = $this->formatBizQueryParaMap($Parameters, false);
+        //echo "【string】 =".$String."</br>";
+        //签名步骤二:在string后加入KEY
+        $String = $String."&key=".$this->api_key;
+//        echo "<textarea style='width: 50%; height: 150px;'>$String</textarea> <br />";
+        //签名步骤三:MD5加密
+        $result_ = strtoupper(md5($String));
+        return $result_;
+    }
+
+
+
+
+    //获取指定长度的随机字符串
+    function getRandChar($length){
+        $str = null;
+        $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
+        $max = strlen($strPol)-1;
+
+        for($i=0;$i<$length;$i++){
+            $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
+        }
+
+        return $str;
+    }
+
+    //数组转xml
+    function arrayToXml($arr)
+    {
+        $xml = "<xml>";
+        foreach ($arr as $key=>$val)
+        {
+
+            if (is_numeric($val))
+            {
+                $xml.="<".$key.">".$val."</".$key.">";
+
+            }
+            else
+                $xml.="<".$key."><![CDATA[".$val."]]></".$key.">";
+        }
+        $xml.="</xml>";
+        return $xml;
+    }
+
+    //post https请求,CURLOPT_POSTFIELDS xml格式
+    function postXmlCurl($xml,$url,$second=30)
+    {
+        //初始化curl
+        $ch = curl_init();
+        //超时时间
+        curl_setopt($ch,CURLOPT_TIMEOUT,$second);
+        //这里设置代理,如果有的话
+        //curl_setopt($ch,CURLOPT_PROXY, '8.8.8.8');
+        //curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
+        curl_setopt($ch,CURLOPT_URL, $url);
+        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
+        curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
+        //设置header
+        curl_setopt($ch, CURLOPT_HEADER, FALSE);
+        //要求结果为字符串且输出到屏幕上
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+        //post提交方式
+        curl_setopt($ch, CURLOPT_POST, TRUE);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
+        //运行curl
+        $data = curl_exec($ch);
+        //返回结果
+        if($data)
+        {
+            curl_close($ch);
+            return $data;
+        }
+        else
+        {
+            $error = curl_errno($ch);
+            echo "curl出错,错误码:$error"."<br>";
+            echo "<a href='http://curl.haxx.se/libcurl/c/libcurl-errors.html'>错误原因查询</a></br>";
+            curl_close($ch);
+            return false;
+        }
+    }
+
+
+
+   //需要使用证书的请求
+    private function postXmlSSLCurl($xml,$url,$second=30)
+    {
+        $ch = curl_init();
+        //超时时间
+        curl_setopt($ch,CURLOPT_TIMEOUT,$second);
+        //这里设置代理,如果有的话
+        //curl_setopt($ch,CURLOPT_PROXY, '8.8.8.8');
+        //curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
+        curl_setopt($ch,CURLOPT_URL, $url);
+        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
+        curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
+        //设置header
+        curl_setopt($ch,CURLOPT_HEADER,FALSE);
+        //要求结果为字符串且输出到屏幕上
+        curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
+        //设置证书
+        //使用证书:cert 与 key 分别属于两个.pem文件
+        //默认格式为PEM,可以注释
+        curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
+        curl_setopt($ch,CURLOPT_SSLCERT, dirname(__DIR__) . '/wxcert/apiclient_cert.pem');
+        //默认格式为PEM,可以注释
+        curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
+        curl_setopt($ch,CURLOPT_SSLKEY, dirname(__DIR__) . '/wxcert/apiclient_key.pem');
+        //post提交方式
+        curl_setopt($ch,CURLOPT_POST, true);
+        curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
+        $data = curl_exec($ch);
+        //返回结果
+        if($data){
+            curl_close($ch);
+            return $data;
+        }
+        else {
+            $error = curl_errno($ch);
+            echo "curl出错,错误码:$error"."<br>";
+            curl_close($ch);
+            return false;
+        }
+    }
+    /*
+        获取当前服务器的IP
+    */
+    function get_client_ip()
+    {
+        if ($_SERVER['REMOTE_ADDR']) {
+            $cip = $_SERVER['REMOTE_ADDR'];
+        } elseif (getenv("REMOTE_ADDR")) {
+            $cip = getenv("REMOTE_ADDR");
+        } elseif (getenv("HTTP_CLIENT_IP")) {
+            $cip = getenv("HTTP_CLIENT_IP");
+        } else {
+            $cip = "unknown";
+        }
+        return $cip;
+    }
+
+    //将数组转成uri字符串
+    function formatBizQueryParaMap($paraMap, $urlencode)
+    {
+        $buff = "";
+        ksort($paraMap);
+        foreach ($paraMap as $k => $v)
+        {
+            if($urlencode)
+            {
+                $v = urlencode($v);
+            }
+            $buff .= strtolower($k) . "=" . $v . "&";
+        }
+        $reqPar;
+        if (strlen($buff) > 0)
+        {
+            $reqPar = substr($buff, 0, strlen($buff)-1);
+        }
+        return $reqPar;
+    }
+
+    /**
+    xml转成数组
+     */
+//    function xmlstr_to_array($xmlstr) {
+//        $doc = new DOMDocument();
+//        $doc->loadXML($xmlstr);
+//        return $this->domnode_to_array($doc->documentElement);
+//    }
+    function domnode_to_array($node) {
+        $output = array();
+        switch ($node->nodeType) {
+            case XML_CDATA_SECTION_NODE:
+            case XML_TEXT_NODE:
+                $output = trim($node->textContent);
+                break;
+            case XML_ELEMENT_NODE:
+                for ($i=0, $m=$node->childNodes->length; $i<$m; $i++) {
+                    $child = $node->childNodes->item($i);
+                    $v = $this->domnode_to_array($child);
+                    if(isset($child->tagName)) {
+                        $t = $child->tagName;
+                        if(!isset($output[$t])) {
+                            $output[$t] = array();
+                        }
+                        $output[$t][] = $v;
+                    }
+                    elseif($v) {
+                        $output = (string) $v;
+                    }
+                }
+                if(is_array($output)) {
+                    if($node->attributes->length) {
+                        $a = array();
+                        foreach($node->attributes as $attrName => $attrNode) {
+                            $a[$attrName] = (string) $attrNode->value;
+                        }
+                        $output['@attributes'] = $a;
+                    }
+                    foreach ($output as $t => $v) {
+                        if(is_array($v) && count($v)==1 && $t!='@attributes') {
+                            $output[$t] = $v[0];
+                        }
+                    }
+                }
+                break;
+        }
+        return $output;
+    }
+//    public function xmltoarray( $xml )
+//    {
+//        $arr = $this->xml_to_array($xml);
+//        $key = array_keys($arr);
+//        return $arr[$key[0]];
+//    }
+
+    /**
+     * 	作用:将xml转为array
+     */
+    public function xmlToArray($xml)
+    {
+        //将XML转为array
+        $array_data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
+        return $array_data;
+    }
+
+
+    public function xml_to_array( $xml )
+    {
+        $reg = "/<(\\w+)[^>]*?>([\\x00-\\xFF]*?)<\\/\\1>/";
+        if(preg_match_all($reg, $xml, $matches))
+        {
+            $count = count($matches[0]);
+            $arr = array();
+            for($i = 0; $i < $count; $i++)
+            {
+                $key = $matches[1][$i];
+                $val = $this->xml_to_array( $matches[2][$i] );  // 递归
+                if(array_key_exists($key, $arr))
+                {
+                    if(is_array($arr[$key]))
+                    {
+                        if(!array_key_exists(0,$arr[$key]))
+                        {
+                            $arr[$key] = array($arr[$key]);
+                        }
+                    }else{
+                        $arr[$key] = array($arr[$key]);
+                    }
+                    $arr[$key][] = $val;
+                }else{
+                    $arr[$key] = $val;
+                }
+            }
+            return $arr;
+        }else{
+            return $xml;
+        }
+    }
+
+}

+ 188 - 0
app/common/library/alipay/aop/AlipayMobilePublicMultiMediaClient.php

@@ -0,0 +1,188 @@
+<?php
+
+/**
+ * 多媒体文件客户端
+ * @author yikai.hu
+ * @version $Id: AlipayMobilePublicMultiMediaClient.php, v 0.1 Aug 15, 2014 10:19:01 AM yikai.hu Exp $
+ */
+
+include("AlipayMobilePublicMultiMediaExecute.php");
+
+class AlipayMobilePublicMultiMediaClient
+{
+    private $DEFAULT_CHARSET = 'UTF-8';
+    private $METHOD_POST = "POST";
+    private $METHOD_GET = "GET";
+    private $SIGN = 'sign'; //get name
+
+    private $timeout = 10;// 超时时间
+    private $serverUrl;
+    private $appId;
+    private $privateKey;
+    private $prodCode;
+    private $format = 'json'; //todo
+    private $sign_type = 'RSA'; //todo
+
+    private $charset;
+    private $apiVersion = "1.0";
+    private $apiMethodName = "alipay.mobile.public.multimedia.download";
+    private $media_id = "L21pZnMvVDFQV3hYWGJKWFhYYUNucHJYP3Q9YW13ZiZ4c2lnPTU0MzRhYjg1ZTZjNWJmZTMxZGJiNjIzNDdjMzFkNzkw575";
+    //此处写死的,实际开发中,请传入
+
+    private $connectTimeout = 3000;
+    private $readTimeout = 15000;
+
+    function __construct($serverUrl = '', $appId = '', $partner_private_key = '', $format = '', $charset = 'GBK')
+    {
+        $this->serverUrl = $serverUrl;
+        $this->appId = $appId;
+        $this->privateKey = $partner_private_key;
+        $this->format = $format;
+        $this->charset = $charset;
+    }
+
+    /**
+     * getContents 获取网址内容
+     * @param $request
+     * @return text | bin
+     */
+    public function getContents()
+    {
+        $datas = array(
+            "app_id" => $this->appId,
+            "method" => $this->METHOD_POST,
+            "sign_type" => $this->sign_type,
+            "version" => $this->apiVersion,
+            "timestamp" => date('Y-m-d H:i:s'),//yyyy-MM-dd HH:mm:ss
+            "biz_content" => '{"mediaId":"' . $this->media_id . '"}',
+            "charset" => $this->charset
+        );
+
+        //要提交的数据
+        $data_sign = $this->buildGetUrl($datas);
+
+        $post_data = $data_sign;
+        //初始化 curl
+        $ch = curl_init();
+        //设置目标服务器
+        curl_setopt($ch, CURLOPT_URL, $this->serverUrl);
+        curl_setopt($ch, CURLOPT_HEADER, TRUE);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        //超时时间
+        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
+
+        if ($this->METHOD_POST == 'POST') {
+            // post数据
+            curl_setopt($ch, CURLOPT_POST, 1);
+            // post的变量
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
+        }
+
+
+        $output = curl_exec($ch);
+        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+        curl_close($ch);
+
+        echo $output;
+
+        $datas = explode("\r\n\r\n", $output, 2);
+        $header = $datas[0];
+
+        if ($httpCode == '200') {
+            $body = $datas[1];
+        } else {
+            $body = '';
+
+        }
+
+        return $this->execute($header, $body, $httpCode);
+    }
+
+    /**
+     *
+     * @param $request
+     * @return text | bin
+     */
+    public function execute($header = '', $body = '', $httpCode = '')
+    {
+        $exe = new AlipayMobilePublicMultiMediaExecute($header, $body, $httpCode);
+        return $exe;
+    }
+
+    public function buildGetUrl($query = array())
+    {
+        if (!is_array($query)) {
+            //exit;
+        }
+        //排序参数,
+        $data = $this->buildQuery($query);
+
+        // 私钥密码
+        $passphrase = '';
+        $key_width = 64;
+
+        //私钥
+        $privateKey = $this->privateKey;
+        $p_key = array();
+        //如果私钥是 1行
+        if (!stripos($privateKey, "\n")) {
+            $i = 0;
+            while ($key_str = substr($privateKey, $i * $key_width, $key_width)) {
+                $p_key[] = $key_str;
+                $i++;
+            }
+        } else {
+            //echo '一行?';
+        }
+        $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . implode("\n", $p_key);
+        $privateKey = $privateKey . "\n-----END RSA PRIVATE KEY-----";
+
+        //私钥
+        $private_id = openssl_pkey_get_private($privateKey, $passphrase);
+
+        // 签名
+        $signature = '';
+
+        if ("RSA2" == $this->sign_type) {
+
+            openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA256);
+        } else {
+
+            openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA1);
+        }
+
+        openssl_free_key($private_id);
+
+        //加密后的内容通常含有特殊字符,需要编码转换下
+        $signature = base64_encode($signature);
+
+        $signature = urlencode($signature);
+
+        //$signature = 'XjUN6YM1Mc9HXebKMv7GTLy7gmyhktyOgKk2/Jf+cz4DtP6udkzTdpkjW2j/Z4ZSD7xD6CNYI1Spz4yS93HPT0a5X9LgFWYY8SaADqe+ArXg+FBSiTwUz49SE//Xd9+LEiIRsSFkbpkuiGoO6mqJmB7vXjlD5lx6qCM3nb41wb8=';
+
+        $out = $data . '&' . $this->SIGN . '=' . $signature;
+
+        return $out;
+    }
+
+    /*
+     * 查询参数排序 a-z
+     * */
+    public function buildQuery($query)
+    {
+        if (!$query) {
+            return null;
+        }
+        //将要 参数 排序
+        ksort($query);
+
+        //重新组装参数
+        $params = array();
+        foreach ($query as $key => $value) {
+            $params[] = $key . '=' . $value;
+        }
+        $data = implode('&', $params);
+        return $data;
+    }
+
+}

+ 115 - 0
app/common/library/alipay/aop/AlipayMobilePublicMultiMediaExecute.php

@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * 多媒体文件客户端
+ * @author yuanwai.wang
+ * @version $Id: AlipayMobilePublicMultiMediaExecute.php, v 0.1 Aug 15, 2014 10:19:01 AM yuanwai.wang Exp $
+ */
+
+//namespace alipay\api ;
+
+
+class AlipayMobilePublicMultiMediaExecute
+{
+
+    private $code = 200;
+    private $msg = '';
+    private $body = '';
+    private $params = '';
+
+    private $fileSuffix = array(
+        "image/jpeg" => 'jpg', //+
+        "text/plain" => 'text'
+    );
+
+    /*
+     * @$header : 头部
+     * */
+    function __construct($header, $body, $httpCode)
+    {
+        $this->code = $httpCode;
+        $this->msg = '';
+        $this->params = $header;
+        $this->body = $body;
+    }
+
+    /**
+     *
+     * @return text | bin
+     */
+    public function getCode()
+    {
+        return $this->code;
+    }
+
+    /**
+     *
+     * @return text | bin
+     */
+    public function getMsg()
+    {
+        return $this->msg;
+    }
+
+    /**
+     *
+     * @return text | bin
+     */
+    public function getType()
+    {
+        $subject = $this->params;
+        $pattern = '/Content\-Type:([^;]+)/';
+        preg_match($pattern, $subject, $matches);
+        if ($matches) {
+            $type = $matches[1];
+        } else {
+            $type = 'application/download';
+        }
+
+        return str_replace(' ', '', $type);
+    }
+
+    /**
+     *
+     * @return text | bin
+     */
+    public function getContentLength()
+    {
+        $subject = $this->params;
+        $pattern = '/Content-Length:\s*([^\n]+)/';
+        preg_match($pattern, $subject, $matches);
+        return (int)(isset($matches[1]) ? $matches[1] : '');
+    }
+
+
+    public function getFileSuffix($fileType)
+    {
+        $type = isset($this->fileSuffix[$fileType]) ? $this->fileSuffix[$fileType] : 'text/plain';
+        if (!$type) {
+            $type = 'json';
+        }
+        return $type;
+    }
+
+
+    /**
+     *
+     * @return text | bin
+     */
+    public function getBody()
+    {
+        //header('Content-type: image/jpeg');
+        return $this->body;
+    }
+
+    /**
+     * 获取参数
+     * @return text | bin
+     */
+    public function getParams()
+    {
+        return $this->params;
+    }
+
+
+}

+ 1237 - 0
app/common/library/alipay/aop/AopCertClient.php

@@ -0,0 +1,1237 @@
+<?php
+
+require_once 'AopEncrypt.php';
+require_once 'AopCertification.php';
+require_once 'EncryptParseItem.php';
+require_once 'EncryptResponseData.php';
+require_once 'SignData.php';
+
+class AopCertClient
+{
+    //应用证书地址
+    public $appCertSN;
+
+    //支付宝公钥证书地址
+    public $alipayCertSN;
+
+    //支付宝根证书地址
+    public $alipayRootCertSN;
+
+    //支付宝根证书地址
+    public $alipayRootCertContent;
+
+    //是否校验支付宝公钥证书
+    public $isCheckAlipayPublicCert;
+
+    //应用ID
+    public $appId;
+
+    //私钥文件路径
+    public $rsaPrivateKeyFilePath;
+
+    //私钥值
+    public $rsaPrivateKey;
+
+    //网关
+    public $gatewayUrl = "https://openapi.alipay.com/gateway.do";
+    //返回数据格式
+    public $format = "json";
+
+    //api版本
+    public $apiVersion = "1.0";
+
+    // 表单提交字符集编码
+    public $postCharset = "UTF-8";
+
+    //使用文件读取文件格式,请只传递该值
+    public $alipayPublicKey = null;
+
+    //使用读取字符串格式,请只传递该值
+    public $alipayrsaPublicKey;
+
+    public $debugInfo = false;
+
+    //签名类型
+    public $signType = "RSA";
+
+    //加密密钥和类型
+    public $encryptKey;
+
+    public $encryptType = "AES";
+
+    protected $alipaySdkVersion = "alipay-sdk-php-2020-04-15";
+
+    private $fileCharset = "UTF-8";
+
+    private $RESPONSE_SUFFIX = "_response";
+
+    private $ERROR_RESPONSE = "error_response";
+
+    private $SIGN_NODE_NAME = "sign";
+
+    private $ALIPAY_CERT_SN = "alipay_cert_sn";
+
+
+    //加密XML节点名称
+    private $ENCRYPT_XML_NODE_NAME = "response_encrypted";
+
+    private $needEncrypt = false;
+
+    private $targetServiceUrl = "";
+
+    /**
+     * 从证书中提取序列号
+     * @param $cert
+     * @return string
+     */
+    public function getCertSN($certPath)
+    {
+        $cert = file_get_contents($certPath);
+        $ssl = openssl_x509_parse($cert);
+        $SN = md5(array2string(array_reverse($ssl['issuer'])) . $ssl['serialNumber']);
+        return $SN;
+    }
+
+    /**
+     * 提取根证书序列号
+     * @param $cert  根证书
+     * @return string|null
+     */
+    public function getRootCertSN($certPath)
+    {
+        $cert = file_get_contents($certPath);
+        $this->alipayRootCertContent = $cert;
+        $array = explode("-----END CERTIFICATE-----", $cert);
+        $SN = null;
+        for ($i = 0; $i < count($array) - 1; $i++) {
+            $ssl[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----");
+            if(strpos($ssl[$i]['serialNumber'],'0x') === 0){
+                $ssl[$i]['serialNumber'] = $this->hex2dec($ssl[$i]['serialNumber']);
+            }
+            if ($ssl[$i]['signatureTypeLN'] == "sha1WithRSAEncryption" || $ssl[$i]['signatureTypeLN'] == "sha256WithRSAEncryption") {
+                if ($SN == null) {
+                    $SN = md5(array2string(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
+                } else {
+
+                    $SN = $SN . "_" . md5(array2string(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
+                }
+            }
+        }
+        return $SN;
+    }
+
+    /**
+     * 0x转高精度数字
+     * @param $hex
+     * @return int|string
+     */
+    function hex2dec($hex)
+    {
+        $dec = 0;
+        $len = strlen($hex);
+        for ($i = 1; $i <= $len; $i++) {
+            $dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
+        }
+        return round($dec,0);
+    }
+
+    /**
+     * 从证书中提取公钥
+     * @param $cert
+     * @return mixed
+     */
+    public function getPublicKey($certPath)
+    {
+        $cert = file_get_contents($certPath);
+        $pkey = openssl_pkey_get_public($cert);
+        $keyData = openssl_pkey_get_details($pkey);
+        $public_key = str_replace('-----BEGIN PUBLIC KEY-----', '', $keyData['key']);
+        $public_key = trim(str_replace('-----END PUBLIC KEY-----', '', $public_key));
+        return $public_key;
+    }
+
+
+    /**
+     * 验证签名
+     * 在使用本方法前,必须初始化AopCertClient且传入公钥参数。
+     * 公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     *
+     * @param $params
+     * @param $rsaPublicKeyFilePath
+     * @param string $signType
+     * @return bool
+     */
+    public function rsaCheckV1($params, $rsaPublicKeyFilePath,$signType='RSA') {
+        $sign = $params['sign'];
+        unset($params['sign']);
+        unset($params['sign_type']);
+        return $this->verify($this->getCheckSignContent($params), $sign, $rsaPublicKeyFilePath,$signType);
+    }
+
+    /**
+     * 验证签名
+     * 在使用本方法前,必须初始化AopCertClient且传入公钥参数。
+     * 公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     *
+     * @param $params
+     * @param $rsaPublicKeyFilePath
+     * @param string $signType
+     * @return bool
+     */
+    public function rsaCheckV2($params, $rsaPublicKeyFilePath, $signType='RSA') {
+        $sign = $params['sign'];
+        unset($params['sign']);
+        unset($params['sign_type']);
+        return $this->verify($this->getCheckSignContent($params), $sign, $rsaPublicKeyFilePath, $signType);
+    }
+
+
+    function getCheckSignContent($params)
+    {
+        ksort($params);
+
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            // 转换成目标字符集
+            $v = $this->characet($v, $this->postCharset);
+
+            if ($i == 0) {
+                $stringToBeSigned .= "$k" . "=" . "$v";
+            } else {
+                $stringToBeSigned .= "&" . "$k" . "=" . "$v";
+            }
+            $i++;
+        }
+
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+
+    /**
+     *  在使用本方法前,必须初始化AopCertClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function checkSignAndDecrypt($params, $rsaPublicKeyPem, $rsaPrivateKeyPem, $isCheckSign, $isDecrypt, $signType='RSA') {
+        $charset = $params['charset'];
+        $bizContent = $params['biz_content'];
+        if ($isCheckSign) {
+            if (!$this->rsaCheckV2($params, $rsaPublicKeyPem, $signType)) {
+                echo "<br/>checkSign failure<br/>";
+                exit;
+            }
+        }
+        if ($isDecrypt) {
+            return $this->rsaDecrypt($bizContent, $rsaPrivateKeyPem, $charset);
+        }
+
+        return $bizContent;
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopCertClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function encryptAndSign($bizContent, $rsaPublicKeyPem, $rsaPrivateKeyPem, $charset, $isEncrypt, $isSign, $signType='RSA') {
+        // 加密,并签名
+        if ($isEncrypt && $isSign) {
+            $encrypted = $this->rsaEncrypt($bizContent, $rsaPublicKeyPem, $charset);
+            $sign = $this->sign($encrypted, $signType);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$encrypted</response><encryption_type>RSA</encryption_type><sign>$sign</sign><sign_type>$signType</sign_type></alipay>";
+            return $response;
+        }
+        // 加密,不签名
+        if ($isEncrypt && (!$isSign)) {
+            $encrypted = $this->rsaEncrypt($bizContent, $rsaPublicKeyPem, $charset);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$encrypted</response><encryption_type>$signType</encryption_type></alipay>";
+            return $response;
+        }
+        // 不加密,但签名
+        if ((!$isEncrypt) && $isSign) {
+            $sign = $this->sign($bizContent, $signType);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$bizContent</response><sign>$sign</sign><sign_type>$signType</sign_type></alipay>";
+            return $response;
+        }
+        // 不加密,不签名
+        $response = "<?xml version=\"1.0\" encoding=\"$charset\"?>$bizContent";
+        return $response;
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopCertClient且传入公私钥参数。
+     **/
+    public function rsaEncrypt($data, $rsaPublicKeyFilePath, $charset) {
+        if($this->checkEmpty($this->alipayPublicKey)){
+            //读取字符串
+            $pubKey= $this->alipayrsaPublicKey;
+            $res = "-----BEGIN PUBLIC KEY-----\n" .
+                wordwrap($pubKey, 64, "\n", true) .
+                "\n-----END PUBLIC KEY-----";
+        }else {
+            //读取公钥文件
+            $pubKey = file_get_contents($rsaPublicKeyFilePath);
+            //转换为openssl格式密钥
+            $res = openssl_get_publickey($pubKey);
+        }
+
+        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
+        $blocks = $this->splitCN($data, 0, 30, $charset);
+        $chrtext  = null;
+        $encodes  = array();
+        foreach ($blocks as $n => $block) {
+            if (!openssl_public_encrypt($block, $chrtext , $res)) {
+                echo "<br/>" . openssl_error_string() . "<br/>";
+            }
+            $encodes[] = $chrtext ;
+        }
+        $chrtext = implode(",", $encodes);
+
+        return base64_encode($chrtext);
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopCertClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function rsaDecrypt($data, $rsaPrivateKeyPem, $charset) {
+
+        if($this->checkEmpty($this->rsaPrivateKeyFilePath)){
+            //读字符串
+            $priKey=$this->rsaPrivateKey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        }else {
+            $priKey = file_get_contents($this->rsaPrivateKeyFilePath);
+            $res = openssl_get_privatekey($priKey);
+        }
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+        //转换为openssl格式密钥
+        $decodes = explode(',', $data);
+        $strnull = "";
+        $dcyCont = "";
+        foreach ($decodes as $n => $decode) {
+            if (!openssl_private_decrypt($decode, $dcyCont, $res)) {
+                echo "<br/>" . openssl_error_string() . "<br/>";
+            }
+            $strnull .= $dcyCont;
+        }
+        return $strnull;
+    }
+
+    function splitCN($cont, $n = 0, $subnum, $charset) {
+        //$len = strlen($cont) / 3;
+        $arrr = array();
+        for ($i = $n; $i < strlen($cont); $i += $subnum) {
+            $res = $this->subCNchar($cont, $i, $subnum, $charset);
+            if (!empty ($res)) {
+                $arrr[] = $res;
+            }
+        }
+
+        return $arrr;
+    }
+
+    function subCNchar($str, $start = 0, $length, $charset = "gbk") {
+        if (strlen($str) <= $length) {
+            return $str;
+        }
+        $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
+        $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
+        $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
+        $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
+        preg_match_all($re[$charset], $str, $match);
+        $slice = join("", array_slice($match[0], $start, $length));
+        return $slice;
+    }
+
+    /**
+     * 生成用于调用收银台SDK的字符串
+     * @param $request SDK接口的请求参数对象
+     * @param $appAuthToken 三方应用授权token
+     * @return string
+     */
+    public function sdkExecute($request, $appAuthToken = null) {
+
+        $this->setupCharsets($request);
+        $params['app_id'] = $this->appId;
+        $params['method'] = $request->getApiMethodName();
+        $params['format'] = $this->format;
+        $params['sign_type'] = $this->signType;
+        $params['timestamp'] = date("Y-m-d H:i:s");
+        $params['alipay_sdk'] = $this->alipaySdkVersion;
+        $params['charset'] = $this->postCharset;
+        $version = $request->getApiVersion();
+        $params['version'] = $this->checkEmpty($version) ? $this->apiVersion : $version;
+        $params["app_cert_sn"] = $this->appCertSN;
+        $params["alipay_root_cert_sn"] = $this->alipayRootCertSN;
+        if ($notify_url = $request->getNotifyUrl()) {
+            $params['notify_url'] = $notify_url;
+        }
+        $params['app_auth_token'] = $appAuthToken;
+        $dict = $request->getApiParas();
+        $params['biz_content'] = $dict['biz_content'];
+        ksort($params);
+        $params['sign'] = $this->generateSign($params, $this->signType);
+        foreach ($params as &$value) {
+            $value = $this->characet($value, $params['charset']);
+        }
+        return http_build_query($params);
+    }
+
+
+    /**
+     * 页面提交执行方法
+     * @param $request 跳转类接口的request
+     * @param string $httpmethod 提交方式,两个值可选:post、get;
+     * @param null $appAuthToken 三方应用授权token
+     * @return 构建好的、签名后的最终跳转URL(GET)或String形式的form(POST)
+     * @throws Exception
+     */
+    public function pageExecute($request, $httpmethod = "POST", $appAuthToken = null) {
+
+        $this->setupCharsets($request);
+        if (strcasecmp($this->fileCharset, $this->postCharset)) {
+            throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
+        }
+        $iv=null;
+        if(!$this->checkEmpty($request->getApiVersion())){
+            $iv=$request->getApiVersion();
+        }else{
+            $iv=$this->apiVersion;
+        }
+
+        //组装系统参数
+        $sysParams["app_id"] = $this->appId;
+        $sysParams["version"] = $iv;
+        $sysParams["format"] = $this->format;
+        $sysParams["sign_type"] = $this->signType;
+        $sysParams["method"] = $request->getApiMethodName();
+        $sysParams["timestamp"] = date("Y-m-d H:i:s");
+        $sysParams["alipay_sdk"] = $this->alipaySdkVersion;
+        $sysParams["terminal_type"] = $request->getTerminalType();
+        $sysParams["terminal_info"] = $request->getTerminalInfo();
+        $sysParams["prod_code"] = $request->getProdCode();
+        $sysParams["notify_url"] = $request->getNotifyUrl();
+        $sysParams["return_url"] = $request->getReturnUrl();
+        $sysParams["charset"] = $this->postCharset;
+        $sysParams["app_auth_token"] = $appAuthToken;
+        $sysParams["app_cert_sn"] = $this->appCertSN;
+        $sysParams["alipay_root_cert_sn"] = $this->alipayRootCertSN;
+
+        //获取业务参数
+        $apiParams = $request->getApiParas();
+        if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){
+            $sysParams["encrypt_type"] = $this->encryptType;
+            if ($this->checkEmpty($apiParams['biz_content'])) {
+                throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
+            }
+            if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+                throw new Exception(" encryptType and encryptKey must not null! ");
+            }
+            if ("AES" != $this->encryptType) {
+                throw new Exception("加密类型只支持AES");
+            }
+            // 执行加密
+            $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
+            $apiParams['biz_content'] = $enCryptContent;
+        }
+        $totalParams = array_merge($apiParams, $sysParams);
+        //待签名字符串
+        $preSignStr = $this->getSignContent($totalParams);
+        //签名
+        $totalParams["sign"] = $this->generateSign($totalParams, $this->signType);
+
+        if ("GET" == strtoupper($httpmethod)) {
+            //value做urlencode
+            $preString=$this->getSignContentUrlencode($totalParams);
+            //拼接GET请求串
+            $requestUrl = $this->gatewayUrl."?".$preString;
+            return $requestUrl;
+        } else {
+            //拼接表单字符串
+            return $this->buildRequestForm($totalParams);
+        }
+    }
+
+    //此方法对value做urlencode
+    public function getSignContentUrlencode($params) {
+        ksort($params);
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
+
+                if ($i == 0) {
+                    $stringToBeSigned .= "$k" . "=" . urlencode($v);
+                } else {
+                    $stringToBeSigned .= "&" . "$k" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+
+    /**
+     * 建立请求,以表单HTML形式构造(默认)
+     * @param $para_temp 请求参数数组
+     * @return 提交表单HTML文本
+     */
+    protected function buildRequestForm($para_temp) {
+        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$this->gatewayUrl."?charset=".trim($this->postCharset)."' method='POST'>";
+        while (list ($key, $val) = $this->fun_adm_each($para_temp)) {
+            if (false === $this->checkEmpty($val)) {
+                //$val = $this->characet($val, $this->postCharset);
+                $val = str_replace("'","&apos;",$val);
+                //$val = str_replace("\"","&quot;",$val);
+                $sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>";
+            }
+        }
+        //submit按钮控件请不要含有name属性
+        $sHtml = $sHtml."<input type='submit' value='ok' style='display:none;''></form>";
+        $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";
+        return $sHtml;
+    }
+
+    protected function fun_adm_each(&$array)
+    {
+        $res = array();
+        $key = key($array);
+        if ($key !== null) {
+            next($array);
+            $res[1] = $res['value'] = $array[$key];
+            $res[0] = $res['key'] = $key;
+        } else {
+            $res = false;
+        }
+        return $res;
+    }
+
+    public function execute($request, $authToken = null, $appInfoAuthtoken = null,$targetAppId = null) {
+        $this->setupCharsets($request);
+        //如果两者编码不一致,会出现签名验签或者乱码
+        if (strcasecmp($this->fileCharset, $this->postCharset)) {
+            throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
+        }
+        $iv = null;
+        if (!$this->checkEmpty($request->getApiVersion())) {
+            $iv = $request->getApiVersion();
+        } else {
+            $iv = $this->apiVersion;
+        }
+        //组装系统参数
+        $sysParams["app_id"] = $this->appId;
+        $sysParams["version"] = $iv;
+        $sysParams["format"] = $this->format;
+        $sysParams["sign_type"] = $this->signType;
+        $sysParams["method"] = $request->getApiMethodName();
+        $sysParams["timestamp"] = date("Y-m-d H:i:s");
+        $sysParams["auth_token"] = $authToken;
+        $sysParams["alipay_sdk"] = $this->alipaySdkVersion;
+        $sysParams["terminal_type"] = $request->getTerminalType();
+        $sysParams["terminal_info"] = $request->getTerminalInfo();
+        $sysParams["prod_code"] = $request->getProdCode();
+        $sysParams["notify_url"] = $request->getNotifyUrl();
+        $sysParams["charset"] = $this->postCharset;
+        $sysParams["app_auth_token"] = $appInfoAuthtoken;
+        $sysParams["app_cert_sn"] = $this->appCertSN;
+        $sysParams["alipay_root_cert_sn"] = $this->alipayRootCertSN;
+        $sysParams["target_app_id"] = $targetAppId;
+        if(!$this->checkEmpty($this->targetServiceUrl)){
+            $sysParams["ws_service_url"] = $this->targetServiceUrl;
+        }
+
+        //获取业务参数
+        $apiParams = $request->getApiParas();
+
+        if (method_exists($request,"getNeedEncrypt") && $request->getNeedEncrypt()){
+            $sysParams["encrypt_type"] = $this->encryptType;
+            if ($this->checkEmpty($apiParams['biz_content'])) {
+                throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
+            }
+            if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+                throw new Exception(" encryptType and encryptKey must not null! ");
+            }
+            if ("AES" != $this->encryptType) {
+                throw new Exception("加密类型只支持AES");
+            }
+            // 执行加密
+            $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
+            $apiParams['biz_content'] = $enCryptContent;
+        }
+
+        //签名
+        $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
+
+        //系统参数放入GET请求串
+        $requestUrl = $this->gatewayUrl . "?";
+        foreach ($sysParams as $sysParamKey => $sysParamValue) {
+            $requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
+        }
+        $requestUrl = substr($requestUrl, 0, -1);
+
+        //发起HTTP请求
+        try {
+            $resp = $this->curl($requestUrl, $apiParams);
+        } catch (Exception $e) {
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
+            return false;
+        }
+
+        //解析AOP返回结果
+        $respWellFormed = false;
+
+        // 将返回结果转换本地文件编码
+        $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+        $signData = null;
+
+        if ("json" == $this->format) {
+            $respObject = json_decode($r);
+            if (null !== $respObject) {
+                $respWellFormed = true;
+                $signData = $this->parserJSONSignData($request, $resp, $respObject);
+            }
+        } else if ("xml" == $this->format) {
+            $disableLibxmlEntityLoader = libxml_disable_entity_loader(true);
+            $respObject = @ simplexml_load_string($resp);
+            if (false !== $respObject) {
+                $respWellFormed = true;
+                $signData = $this->parserXMLSignData($request, $resp);
+            }
+            libxml_disable_entity_loader($disableLibxmlEntityLoader);
+        }
+
+        //返回的HTTP文本不是标准JSON或者XML,记下错误日志
+        if (false === $respWellFormed) {
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
+            return false;
+        }
+
+        // 验签
+        $this->checkResponseSign($request, $signData, $resp, $respObject);
+
+        // 解密
+        if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){
+
+            if ("json" == $this->format) {
+                $resp = $this->encryptJSONSignSource($request, $resp);
+                // 将返回结果转换本地文件编码
+                $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+                $respObject = json_decode($r);
+            }else{
+                $resp = $this->encryptXMLSignSource($request, $resp);
+                $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+                $disableLibxmlEntityLoader = libxml_disable_entity_loader(true);
+                $respObject = @ simplexml_load_string($r);
+                libxml_disable_entity_loader($disableLibxmlEntityLoader);
+            }
+        }
+        return $respObject;
+    }
+
+
+    /**
+     * 设置编码格式
+     * @param $request
+     */
+    private function setupCharsets($request) {
+        if ($this->checkEmpty($this->postCharset)) {
+            $this->postCharset = 'UTF-8';
+        }
+        $str = preg_match('/[\x80-\xff]/', $this->appId) ? $this->appId : print_r($request, true);
+        $this->fileCharset = mb_detect_encoding($str, "UTF-8, GBK") == 'UTF-8' ? 'UTF-8' : 'GBK';
+    }
+
+    /**
+     * 校验$value是否非空
+     *  if not set ,return true;
+     *    if is null , return true;
+     **/
+    protected function checkEmpty($value) {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    /**
+     * 加签
+     * @param $params
+     * @param string $signType
+     * @return mixed
+     */
+    public function generateSign($params, $signType = "RSA") {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
+
+    public function rsaSign($params, $signType = "RSA") {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
+
+    protected function sign($data, $signType = "RSA") {
+        if($this->checkEmpty($this->rsaPrivateKeyFilePath)){
+            $priKey=$this->rsaPrivateKey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        }else {
+            $priKey = file_get_contents($this->rsaPrivateKeyFilePath);
+            $res = openssl_get_privatekey($priKey);
+        }
+
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+
+        if ("RSA2" == $signType) {
+            openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
+        } else {
+            openssl_sign($data, $sign, $res);
+        }
+
+        if(!$this->checkEmpty($this->rsaPrivateKeyFilePath)){
+            openssl_free_key($res);
+        }
+        $sign = base64_encode($sign);
+        return $sign;
+    }
+
+    public function getSignContent($params) {
+        ksort($params);
+
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
+
+                if ($i == 0) {
+                    $stringToBeSigned .= "$k" . "=" . "$v";
+                } else {
+                    $stringToBeSigned .= "&" . "$k" . "=" . "$v";
+                }
+                $i++;
+            }
+        }
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+
+    /**
+     * RSA单独签名方法,未做字符串处理,字符串处理见getSignContent()
+     * @param $data 待签名字符串
+     * @param $privatekey 商户私钥,根据keyfromfile来判断是读取字符串还是读取文件,false:填写私钥字符串去回车和空格 true:填写私钥文件路径
+     * @param $signType 签名方式,RSA:SHA1     RSA2:SHA256
+     * @param $keyfromfile 私钥获取方式,读取字符串还是读文件
+     * @return string
+     */
+    public function alonersaSign($data,$privatekey,$signType = "RSA",$keyfromfile=false) {
+        if(!$keyfromfile){
+            $priKey=$privatekey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        }
+        else{
+            $priKey = file_get_contents($privatekey);
+            $res = openssl_get_privatekey($priKey);
+        }
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+        if ("RSA2" == $signType) {
+            openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
+        } else {
+            openssl_sign($data, $sign, $res);
+        }
+        if($keyfromfile){
+            openssl_free_key($res);
+        }
+        $sign = base64_encode($sign);
+        return $sign;
+    }
+
+    /**
+     * 转换字符集编码
+     * @param $data
+     * @param $targetCharset
+     * @return string
+     */
+    function characet($data, $targetCharset) {
+
+        if (!empty($data)) {
+            $fileType = $this->fileCharset;
+            if (strcasecmp($fileType, $targetCharset) != 0) {
+                $data = mb_convert_encoding($data, $targetCharset, $fileType);
+            }
+        }
+        return $data;
+    }
+
+    /**
+     * 发送curl请求
+     * @param $url
+     * @param null $postFields
+     * @return bool|string
+     * @throws Exception
+     */
+    protected function curl($url, $postFields = null) {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_FAILONERROR, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+        $postBodyString = "";
+        $encodeArray = Array();
+        $postMultipart = false;
+
+        if (is_array($postFields) && 0 < count($postFields)) {
+            foreach ($postFields as $k => $v) {
+                if ("@" != substr($v, 0, 1)) //判断是不是文件上传
+                {
+                    $postBodyString .= "$k=" . urlencode($this->characet($v, $this->postCharset)) . "&";
+                    $encodeArray[$k] = $this->characet($v, $this->postCharset);
+                } else //文件上传用multipart/form-data,否则用www-form-urlencoded
+                {
+                    $postMultipart = true;
+                    $encodeArray[$k] = new \CURLFile(substr($v, 1));
+                }
+            }
+            unset ($k, $v);
+            curl_setopt($ch, CURLOPT_POST, true);
+            if ($postMultipart) {
+                curl_setopt($ch, CURLOPT_POSTFIELDS, $encodeArray);
+            } else {
+                curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString, 0, -1));
+            }
+        }
+
+        if (!$postMultipart) {
+            $headers = array('content-type: application/x-www-form-urlencoded;charset=' . $this->postCharset);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        }
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        $reponse = curl_exec($ch);
+        if (curl_errno($ch)) {
+            throw new Exception(curl_error($ch), 0);
+        } else {
+            $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            if (200 !== $httpStatusCode) {
+                throw new Exception($reponse, $httpStatusCode);
+            }
+        }
+        curl_close($ch);
+        return $reponse;
+    }
+
+    protected function getMillisecond() {
+        list($s1, $s2) = explode(' ', microtime());
+        return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
+    }
+
+    /**
+     * 打印日志信息
+     * @param $apiName
+     * @param $requestUrl
+     * @param $errorCode
+     * @param $responseTxt
+     */
+    protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt) {
+        $logData = array(
+            date("Y-m-d H:i:s"),
+            $apiName,
+            $this->appId,
+            PHP_OS,
+            $this->alipaySdkVersion,
+            $requestUrl,
+            $errorCode,
+            str_replace("\n", "", $responseTxt)
+        );
+        echo json_encode($logData);
+    }
+
+    /**
+     * Json格式签名内容
+     * @param $request
+     * @param $responseContent
+     * @param $responseJSON
+     * @return SignData
+     */
+    function parserJSONSignData($request, $responseContent, $responseJSON) {
+        $signData = new SignData();
+        $signData->sign = $this->parserJSONSign($responseJSON);
+        $signData->signSourceData = $this->parserJSONSignSource($request, $responseContent);
+        return $signData;
+    }
+
+    function parserJSONSign($responseJSon) {
+        return $responseJSon->sign;
+    }
+
+    function parserJSONSignSource($request, $responseContent) {
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        if ($rootIndex > 0) {
+            return $this->parserJSONSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+            return $this->parserJSONSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+            return null;
+        }
+    }
+
+    function parserJSONSource($responseContent, $nodeName, $nodeIndex) {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
+        if(strrpos($responseContent, $this->ALIPAY_CERT_SN)){
+            $signIndex = strrpos($responseContent, "\"" . $this->ALIPAY_CERT_SN . "\"");
+        }else{
+            $signIndex = strrpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
+        }
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+        $indexLen = $signDataEndIndex - $signDataStartIndex;
+        if ($indexLen < 0) {
+            return null;
+        }
+        return substr($responseContent, $signDataStartIndex, $indexLen);
+    }
+
+    /**
+     * XML格式签名内容
+     * @param $request
+     * @param $responseContent
+     * @return SignData
+     */
+    function parserXMLSignData($request, $responseContent) {
+        $signData = new SignData();
+        $signData->sign = $this->parserXMLSign($responseContent);
+        $signData->signSourceData = $this->parserXMLSignSource($request, $responseContent);
+        return $signData;
+    }
+
+    function parserXMLSign($responseContent) {
+        if(strrpos($responseContent, $this->ALIPAY_CERT_SN)){
+            $signNodeName = "<" . $this->ALIPAY_CERT_SN . ">";
+            $signEndNodeName = "</" . $this->ALIPAY_CERT_SN . ">";
+        }else{
+            $signNodeName = "<" . $this->SIGN_NODE_NAME . ">";
+            $signEndNodeName = "</" . $this->SIGN_NODE_NAME . ">";
+        }
+
+        $indexOfSignNode = strpos($responseContent, $signNodeName);
+        $indexOfSignEndNode = strpos($responseContent, $signEndNodeName);
+        if ($indexOfSignNode < 0 || $indexOfSignEndNode < 0) {
+            return null;
+        }
+        $nodeIndex = ($indexOfSignNode + strlen($signNodeName));
+        $indexLen = $indexOfSignEndNode - $nodeIndex;
+        if ($indexLen < 0) {
+            return null;
+        }
+        // 签名
+        return substr($responseContent, $nodeIndex, $indexLen);
+    }
+
+    function parserXMLSignSource($request, $responseContent) {
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        if ($rootIndex > 0) {
+            return $this->parserXMLSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+            return $this->parserXMLSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+            return null;
+        }
+    }
+
+
+    function parserXMLSource($responseContent, $nodeName, $nodeIndex) {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
+        if(strrpos($responseContent, $this->ALIPAY_CERT_SN)){
+            $signIndex = strrpos($responseContent, "<" . $this->ALIPAY_CERT_SN . ">");
+        }else{
+            $signIndex = strrpos($responseContent, "<" . $this->SIGN_NODE_NAME . ">");
+        }
+
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+        $indexLen = $signDataEndIndex - $signDataStartIndex + 1;
+
+        if ($indexLen < 0) {
+            return null;
+        }
+        return substr($responseContent, $signDataStartIndex, $indexLen);
+    }
+
+
+    /**
+     * 验签
+     * @param $request
+     * @param $signData
+     * @param $resp
+     * @param $respObject
+     * @throws Exception
+     */
+    public function checkResponseSign($request, $signData, $resp, $respObject) {
+        if (!$this->checkEmpty($this->alipayPublicKey) || !$this->checkEmpty($this->alipayrsaPublicKey)) {
+            if ($signData == null || $this->checkEmpty($signData->sign) || $this->checkEmpty($signData->signSourceData)) {
+                throw new Exception(" check sign Fail! The reason : signData is Empty");
+            }
+            // 获取结果sub_code
+            $responseSubCode = $this->parserResponseSubCode($request, $resp, $respObject, $this->format);
+            if (!$this->checkEmpty($responseSubCode) || ($this->checkEmpty($responseSubCode) && !$this->checkEmpty($signData->sign))) {
+                $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+
+                if (!$checkResult) {
+
+                    //请求网关下载新的支付宝公钥证书
+                    if(!$respObject->alipay_cert_sn && ($request->getApiMethodName()=="alipay.open.app.alipaycert.download")){
+                        throw new Exception(" check sign Fail! The reason : alipay_cert_sn is Empty");
+                    }
+                    //组装系统参数
+                    $sysParams["app_id"] = $this->appId;
+                    $sysParams["format"] = $this->format;
+                    $sysParams["sign_type"] = $this->signType;
+                    $sysParams["method"] = "alipay.open.app.alipaycert.download";
+                    $sysParams["timestamp"] = date("Y-m-d H:i:s");
+                    $sysParams["alipay_sdk"] = $this->alipaySdkVersion;
+                    $sysParams["terminal_type"] = $request->getTerminalType();
+                    $sysParams["terminal_info"] = $request->getTerminalInfo();
+                    $sysParams["prod_code"] = $request->getProdCode();
+                    $sysParams["notify_url"] = $request->getNotifyUrl();
+                    $sysParams["charset"] = $this->postCharset;
+                    $sysParams["app_cert_sn"] = $this->appCertSN;
+                    $sysParams["alipay_root_cert_sn"] = $this->alipayRootCertSN;
+                    //获取业务参数
+                    $apiParas = array();
+                    $apiParas["biz_content"] = "{\"alipay_cert_sn\":\"".$respObject->alipay_cert_sn."\"}";
+                    $apiParams = $apiParas;
+
+                    //签名
+                    $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
+
+                    //系统参数放入GET请求串
+                    $requestUrl = $this->gatewayUrl . "?";
+                    foreach ($sysParams as $sysParamKey => $sysParamValue) {
+                        $requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
+                    }
+                    $requestUrl = substr($requestUrl, 0, -1);
+                    //发起HTTP请求
+                    try {
+                        $resp = $this->curl($requestUrl, $apiParams);
+                    } catch (Exception $e) {
+                        $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
+                        return false;
+                    }
+
+                    // 将返回结果转换本地文件编码
+                    $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+
+                    $respObject = json_decode($r);
+                    $resultCode = $respObject->alipay_open_app_alipaycert_download_response->code;
+                    $certContent = $respObject->alipay_open_app_alipaycert_download_response->alipay_cert_content;
+
+                    if (!empty($resultCode) && $resultCode == 10000 && !empty($certContent)) {
+                        $cert = base64_decode($certContent);
+                        $certCheck = true;
+                        if(!empty($this->alipayRootCertContent) && $this->isCheckAlipayPublicCert){
+                            $certCheck = isTrusted($cert,$this->alipayRootCertContent);
+                        }
+                        if($certCheck){
+                            $pkey = openssl_pkey_get_public($cert);
+                            $keyData = openssl_pkey_get_details($pkey);
+                            $public_key = str_replace('-----BEGIN PUBLIC KEY-----', '', $keyData['key']);
+                            $public_key = trim(str_replace('-----END PUBLIC KEY-----', '', $public_key));
+                            $this->alipayrsaPublicKey = $public_key;
+                            $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayrsaPublicKey, $this->signType);
+                        }else{
+                            //如果下载下来的支付宝公钥证书使用根证书检查失败直接抛异常
+                            throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                        }
+                    }
+
+                    if(!$checkResult){
+                        if (strpos($signData->signSourceData, "\\/") > 0) {
+                            $signData->signSourceData = str_replace("\\/", "/", $signData->signSourceData);
+                            $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+                            if (!$checkResult) {
+                                throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                            }
+                        } else {
+                            throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                        }
+                    }
+
+                }
+            }
+        }
+    }
+
+
+    function parserResponseSubCode($request, $responseContent, $respObject, $format) {
+        if ("json" == $format) {
+            $apiName = $request->getApiMethodName();
+            $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+            $errorNodeName = $this->ERROR_RESPONSE;
+            $rootIndex = strpos($responseContent, $rootNodeName);
+            $errorIndex = strpos($responseContent, $errorNodeName);
+            if ($rootIndex > 0) {
+                // 内部节点对象
+                $rInnerObject = $respObject->$rootNodeName;
+            } elseif ($errorIndex > 0) {
+                $rInnerObject = $respObject->$errorNodeName;
+            } else {
+                return null;
+            }
+            // 存在属性则返回对应值
+            if (isset($rInnerObject->sub_code)) {
+                return $rInnerObject->sub_code;
+            } else {
+                return null;
+            }
+        } elseif ("xml" == $format) {
+            // xml格式sub_code在同一层级
+            return $respObject->sub_code;
+        }
+    }
+
+    function verify($data, $sign, $rsaPublicKeyFilePath, $signType = 'RSA') {
+        if($this->checkEmpty($this->alipayPublicKey)){
+            $pubKey= $this->alipayrsaPublicKey;
+            $res = "-----BEGIN PUBLIC KEY-----\n" .
+                wordwrap($pubKey, 64, "\n", true) .
+                "\n-----END PUBLIC KEY-----";
+        }else {
+            //读取公钥文件
+            $pubKey = file_get_contents($rsaPublicKeyFilePath);
+            //转换为openssl格式密钥
+            $res = openssl_get_publickey($pubKey);
+        }
+        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
+        //调用openssl内置方法验签,返回bool值
+        $result = FALSE;
+        if ("RSA2" == $signType) {
+            $result = (openssl_verify($data, base64_decode($sign), $res, OPENSSL_ALGO_SHA256)===1);
+        } else {
+            $result = (openssl_verify($data, base64_decode($sign), $res)===1);
+        }
+        if(!$this->checkEmpty($this->alipayPublicKey)) {
+            //释放资源
+            openssl_free_key($res);
+        }
+        return $result;
+    }
+
+
+    // 获取加密内容
+    private function encryptJSONSignSource($request, $responseContent) {
+        $parsetItem = $this->parserEncryptJSONSignSource($request, $responseContent);
+        $bodyIndexContent = substr($responseContent, 0, $parsetItem->startIndex);
+        $bodyEndContent = substr($responseContent, $parsetItem->endIndex, strlen($responseContent) + 1 - $parsetItem->endIndex);
+        $bizContent = decrypt($parsetItem->encryptContent, $this->encryptKey);
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
+    }
+
+
+    private function parserEncryptJSONSignSource($request, $responseContent) {
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        if ($rootIndex > 0) {
+            return $this->parserEncryptJSONItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+            return $this->parserEncryptJSONItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+            return null;
+        }
+    }
+
+    private function parserEncryptJSONItem($responseContent, $nodeName, $nodeIndex) {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
+        if(strrpos($responseContent, $this->ALIPAY_CERT_SN)){
+            $signIndex = strpos($responseContent, "\"" . $this->ALIPAY_CERT_SN . "\"");
+        }else{
+            $signIndex = strpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
+        }
+
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+        if ($signDataEndIndex < 0) {
+            $signDataEndIndex = strlen($responseContent)-1 ;
+        }
+        $indexLen = $signDataEndIndex - $signDataStartIndex;
+        $encContent = substr($responseContent, $signDataStartIndex+1, $indexLen-2);
+        $encryptParseItem = new EncryptParseItem();
+        $encryptParseItem->encryptContent = $encContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $signDataEndIndex;
+        return $encryptParseItem;
+    }
+
+    // 获取加密内容
+    private function encryptXMLSignSource($request, $responseContent) {
+        $parsetItem = $this->parserEncryptXMLSignSource($request, $responseContent);
+        $bodyIndexContent = substr($responseContent, 0, $parsetItem->startIndex);
+        $bodyEndContent = substr($responseContent, $parsetItem->endIndex, strlen($responseContent) + 1 - $parsetItem->endIndex);
+        $bizContent = decrypt($parsetItem->encryptContent, $this->encryptKey);
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
+
+    }
+
+    private function parserEncryptXMLSignSource($request, $responseContent) {
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        if ($rootIndex > 0) {
+            return $this->parserEncryptXMLItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+            return $this->parserEncryptXMLItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+            return null;
+        }
+    }
+
+    private function parserEncryptXMLItem($responseContent, $nodeName, $nodeIndex) {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
+        $xmlStartNode="<".$this->ENCRYPT_XML_NODE_NAME.">";
+        $xmlEndNode="</".$this->ENCRYPT_XML_NODE_NAME.">";
+        $indexOfXmlNode=strpos($responseContent,$xmlEndNode);
+        if($indexOfXmlNode<0){
+            $item = new EncryptParseItem();
+            $item->encryptContent = null;
+            $item->startIndex = 0;
+            $item->endIndex = 0;
+            return $item;
+        }
+        $startIndex=$signDataStartIndex+strlen($xmlStartNode);
+        $bizContentLen=$indexOfXmlNode-$startIndex;
+        $bizContent=substr($responseContent,$startIndex,$bizContentLen);
+        $encryptParseItem = new EncryptParseItem();
+        $encryptParseItem->encryptContent = $bizContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $indexOfXmlNode+strlen($xmlEndNode);
+        return $encryptParseItem;
+    }
+
+    function echoDebug($content) {
+        if ($this->debugInfo) {
+            echo "<br/>" . $content;
+        }
+    }
+}

+ 527 - 0
app/common/library/alipay/aop/AopCertification.php

@@ -0,0 +1,527 @@
+<?php
+
+/**
+ * 验证支付宝公钥证书是否可信
+ * @param $alipayCert 支付宝公钥证书
+ * @param $rootCert 支付宝根证书
+ */
+function isTrusted($alipayCert, $rootCert)
+{
+    $alipayCerts = readPemCertChain($alipayCert);
+    $rootCerts = readPemCertChain($rootCert);
+    if (verifyCertChain($alipayCerts, $rootCerts)) {
+        return verifySignature($alipayCert, $rootCert);
+    } else {
+        return false;
+    }
+
+}
+
+function verifySignature($alipayCert, $rootCert)
+{
+    $alipayCertArray = explode("-----END CERTIFICATE-----", $alipayCert);
+    $rootCertArray = explode("-----END CERTIFICATE-----", $rootCert);
+    $length = count($rootCertArray) - 1;
+    $checkSign = isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $alipayCertArray[1] . "-----END CERTIFICATE-----");
+    if (!$checkSign) {
+        $checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $alipayCertArray[0] . "-----END CERTIFICATE-----");
+        if ($checkSign) {
+            $issuer = openssl_x509_parse($alipayCertArray[0] . "-----END CERTIFICATE-----")['issuer'];
+            for ($i = 0; $i < $length; $i++) {
+                $subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
+                if ($issuer == $subject) {
+                    isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $rootCertArray[$i] . $rootCertArray);
+                    return $checkSign;
+                }
+            }
+        } else {
+            return $checkSign;
+        }
+    } else {
+        $issuer = openssl_x509_parse($alipayCertArray[1] . "-----END CERTIFICATE-----")['issuer'];
+        for ($i = 0; $i < $length; $i++) {
+            $subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
+            if ($issuer == $subject) {
+                $checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $rootCertArray[$i] . "-----END CERTIFICATE-----");
+                return $checkSign;
+            }
+        }
+        return $checkSign;
+    }
+}
+
+function readPemCertChain($cert)
+{
+    $array = explode("-----END CERTIFICATE-----", $cert);
+    $certs[] = null;
+    for ($i = 0; $i < count($array) - 1; $i++) {
+        $certs[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----");
+    }
+    return $certs;
+}
+
+function verifyCert($prev, $rootCerts)
+{
+    $nowTime = time();
+    if ($nowTime < $prev['validFrom_time_t']) {
+        echo "证书未激活";
+        return false;
+    }
+    if ($nowTime > $prev['validTo_time_t']) {
+        echo "证书已经过期";
+        return false;
+    }
+    $subjectMap = null;
+    for ($i = 0; $i < count($rootCerts); $i++) {
+        $subjectDN = array2string($rootCerts[$i]['subject']);
+        $subjectMap[$subjectDN] = $rootCerts[$i];
+    }
+    $issuerDN = array2string(($prev['issuer']));
+    if (!array_key_exists($issuerDN, $subjectMap)) {
+        echo "证书链验证失败";
+        return false;
+    }
+    return true;
+}
+
+/**
+ * 验证证书链是否是信任证书库中证书签发的
+ * @param $alipayCerts 目标验证证书列表
+ * @param $rootCerts 可信根证书列表
+ */
+function verifyCertChain($alipayCerts, $rootCerts)
+{
+    $sorted = sortByDn($alipayCerts);
+    if (!$sorted) {
+        echo "证书链验证失败:不是完整的证书链";
+        return false;
+    }
+    //先验证第一个证书是不是信任库中证书签发的
+    $prev = $alipayCerts[0];
+    $firstOK = verifyCert($prev, $rootCerts);
+    $length = count($alipayCerts);
+    if (!$firstOK || $length == 1) {
+        return $firstOK;
+    }
+
+    $nowTime = time();
+    //验证证书链
+    for ($i = 1; $i < $length; $i++) {
+        $cert = $alipayCerts[$i];
+        if ($nowTime < $cert['validFrom_time_t']) {
+            echo "证书未激活";
+            return false;
+        }
+        if ($nowTime > $cert['validTo_time_t']) {
+            echo "证书已经过期";
+            return false;
+        }
+    }
+    return true;
+}
+
+/**
+ * 将证书链按照完整的签发顺序进行排序,排序后证书链为:[issuerA, subjectA]-[issuerA, subjectB]-[issuerB, subjectC]-[issuerC, subjectD]...
+ * @param $certs 证书链
+ */
+function sortByDn(&$certs)
+{
+    //是否包含自签名证书
+    $hasSelfSignedCert = false;
+    $subjectMap = null;
+    $issuerMap = null;
+    for ($i = 0; $i < count($certs); $i++) {
+        if (isSelfSigned($certs[$i])) {
+            if ($hasSelfSignedCert) {
+                return false;
+            }
+            $hasSelfSignedCert = true;
+        }
+        $subjectDN = array2string($certs[$i]['subject']);
+        $issuerDN = array2string(($certs[$i]['issuer']));
+        $subjectMap[$subjectDN] = $certs[$i];
+        $issuerMap[$issuerDN] = $certs[$i];
+    }
+    $certChain = null;
+    addressingUp($subjectMap, $certChain, $certs[0]);
+    addressingDown($issuerMap, $certChain, $certs[0]);
+
+    //说明证书链不完整
+    if (count($certs) != count($certChain)) {
+        return false;
+    }
+    //将证书链复制到原先的数据
+    for ($i = 0; $i < count($certs); $i++) {
+        $certs[$i] = $certChain[count($certs) - $i - 1];
+    }
+    return true;
+}
+
+/**
+ * 验证证书是否是自签发的
+ * @param $cert 目标证书
+ */
+function isSelfSigned($cert)
+{
+    $subjectDN = array2string($cert['subject']);
+    $issuerDN = array2string($cert['issuer']);
+    return ($subjectDN == $issuerDN);
+}
+
+
+function array2string($array)
+{
+    $string = [];
+    if ($array && is_array($array)) {
+        foreach ($array as $key => $value) {
+            $string[] = $key . '=' . $value;
+        }
+    }
+    return implode(',', $string);
+}
+
+/**
+ * 向上构造证书链
+ * @param $subjectMap 主题和证书的映射
+ * @param $certChain 证书链
+ * @param $current 当前需要插入证书链的证书,include
+ */
+function addressingUp($subjectMap, &$certChain, $current)
+{
+    $certChain[] = $current;
+    if (isSelfSigned($current)) {
+        return;
+    }
+    $issuerDN = array2string($current['issuer']);
+
+    if (!array_key_exists($issuerDN, $subjectMap)) {
+        return;
+    }
+    addressingUp($subjectMap, $certChain, $subjectMap[$issuerDN]);
+}
+
+/**
+ * 向下构造证书链
+ * @param $issuerMap 签发者和证书的映射
+ * @param $certChain 证书链
+ * @param $current 当前需要插入证书链的证书,exclude
+ */
+function addressingDown($issuerMap, &$certChain, $current)
+{
+    $subjectDN = array2string($current['subject']);
+    if (!array_key_exists($subjectDN, $issuerMap)) {
+        return $certChain;
+    }
+    $certChain[] = $issuerMap[$subjectDN];
+    addressingDown($issuerMap, $certChain, $issuerMap[$subjectDN]);
+}
+
+
+/**
+ * Extract signature from der encoded cert.
+ * Expects x509 der encoded certificate consisting of a section container
+ * containing 2 sections and a bitstream.  The bitstream contains the
+ * original encrypted signature, encrypted by the public key of the issuing
+ * signer.
+ * @param string $der
+ * @return string on success
+ * @return bool false on failures
+ */
+function extractSignature($der = false)
+{
+    if (strlen($der) < 5) {
+        return false;
+    }
+    // skip container sequence
+    $der = substr($der, 4);
+    // now burn through two sequences and the return the final bitstream
+    while (strlen($der) > 1) {
+        $class = ord($der[0]);
+        $classHex = dechex($class);
+        switch ($class) {
+            // BITSTREAM
+            case 0x03:
+                $len = ord($der[1]);
+                $bytes = 0;
+                if ($len & 0x80) {
+                    $bytes = $len & 0x0f;
+                    $len = 0;
+                    for ($i = 0; $i < $bytes; $i++) {
+                        $len = ($len << 8) | ord($der[$i + 2]);
+                    }
+                }
+                return substr($der, 3 + $bytes, $len);
+                break;
+            // SEQUENCE
+            case 0x30:
+                $len = ord($der[1]);
+                $bytes = 0;
+                if ($len & 0x80) {
+                    $bytes = $len & 0x0f;
+                    $len = 0;
+                    for ($i = 0; $i < $bytes; $i++) {
+                        $len = ($len << 8) | ord($der[$i + 2]);
+                    }
+                }
+                $contents = substr($der, 2 + $bytes, $len);
+                $der = substr($der, 2 + $bytes + $len);
+                break;
+            default:
+                return false;
+                break;
+        }
+    }
+    return false;
+}
+
+/**
+ * Get signature algorithm oid from der encoded signature data.
+ * Expects decrypted signature data from a certificate in der format.
+ * This ASN1 data should contain the following structure:
+ * SEQUENCE
+ *    SEQUENCE
+ *       OID    (signature algorithm)
+ *       NULL
+ * OCTET STRING (signature hash)
+ * @return bool false on failures
+ * @return string oid
+ */
+function getSignatureAlgorithmOid($der = null)
+{
+    // Validate this is the der we need...
+    if (!is_string($der) or strlen($der) < 5) {
+        return false;
+    }
+    $bit_seq1 = 0;
+    $bit_seq2 = 2;
+    $bit_oid = 4;
+    if (ord($der[$bit_seq1]) !== 0x30) {
+        die('Invalid DER passed to getSignatureAlgorithmOid()');
+    }
+    if (ord($der[$bit_seq2]) !== 0x30) {
+        die('Invalid DER passed to getSignatureAlgorithmOid()');
+    }
+    if (ord($der[$bit_oid]) !== 0x06) {
+        die('Invalid DER passed to getSignatureAlgorithmOid');
+    }
+    // strip out what we don't need and get the oid
+    $der = substr($der, $bit_oid);
+    // Get the oid
+    $len = ord($der[1]);
+    $bytes = 0;
+    if ($len & 0x80) {
+        $bytes = $len & 0x0f;
+        $len = 0;
+        for ($i = 0; $i < $bytes; $i++) {
+            $len = ($len << 8) | ord($der[$i + 2]);
+        }
+    }
+    $oid_data = substr($der, 2 + $bytes, $len);
+    // Unpack the OID
+    $oid = floor(ord($oid_data[0]) / 40);
+    $oid .= '.' . ord($oid_data[0]) % 40;
+    $value = 0;
+    $i = 1;
+    while ($i < strlen($oid_data)) {
+        $value = $value << 7;
+        $value = $value | (ord($oid_data[$i]) & 0x7f);
+        if (!(ord($oid_data[$i]) & 0x80)) {
+            $oid .= '.' . $value;
+            $value = 0;
+        }
+        $i++;
+    }
+    return $oid;
+}
+
+/**
+ * Get signature hash from der encoded signature data.
+ * Expects decrypted signature data from a certificate in der format.
+ * This ASN1 data should contain the following structure:
+ * SEQUENCE
+ *    SEQUENCE
+ *       OID    (signature algorithm)
+ *       NULL
+ * OCTET STRING (signature hash)
+ * @return bool false on failures
+ * @return string hash
+ */
+function getSignatureHash($der = null)
+{
+    // Validate this is the der we need...
+    if (!is_string($der) or strlen($der) < 5) {
+        return false;
+    }
+    if (ord($der[0]) !== 0x30) {
+        die('Invalid DER passed to getSignatureHash()');
+    }
+    // strip out the container sequence
+    $der = substr($der, 2);
+    if (ord($der[0]) !== 0x30) {
+        die('Invalid DER passed to getSignatureHash()');
+    }
+    // Get the length of the first sequence so we can strip it out.
+    $len = ord($der[1]);
+    $bytes = 0;
+    if ($len & 0x80) {
+        $bytes = $len & 0x0f;
+        $len = 0;
+        for ($i = 0; $i < $bytes; $i++) {
+            $len = ($len << 8) | ord($der[$i + 2]);
+        }
+    }
+    $der = substr($der, 2 + $bytes + $len);
+    // Now we should have an octet string
+    if (ord($der[0]) !== 0x04) {
+        die('Invalid DER passed to getSignatureHash()');
+    }
+    $len = ord($der[1]);
+    $bytes = 0;
+    if ($len & 0x80) {
+        $bytes = $len & 0x0f;
+        $len = 0;
+        for ($i = 0; $i < $bytes; $i++) {
+            $len = ($len << 8) | ord($der[$i + 2]);
+        }
+    }
+    return bin2hex(substr($der, 2 + $bytes, $len));
+}
+
+/**
+ * Determine if one cert was used to sign another
+ * Note that more than one CA cert can give a positive result, some certs
+ * re-issue signing certs after having only changed the expiration dates.
+ * @param string $cert - PEM encoded cert
+ * @param string $caCert - PEM encoded cert that possibly signed $cert
+ * @return bool
+ */
+function isCertSigner($certPem = null, $caCertPem = null)
+{
+    if (!function_exists('openssl_pkey_get_public')) {
+        die('Need the openssl_pkey_get_public() function.');
+    }
+    if (!function_exists('openssl_public_decrypt')) {
+        die('Need the openssl_public_decrypt() function.');
+    }
+    if (!function_exists('hash')) {
+        die('Need the php hash() function.');
+    }
+    if (empty($certPem) or empty($caCertPem)) {
+        return false;
+    }
+    // Convert the cert to der for feeding to extractSignature.
+    $certDer = pemToDer($certPem);
+    if (!is_string($certDer)) {
+        die('invalid certPem');
+    }
+    // Grab the encrypted signature from the der encoded cert.
+    $encryptedSig = extractSignature($certDer);
+    if (!is_string($encryptedSig)) {
+        die('Failed to extract encrypted signature from certPem.');
+    }
+    // Extract the public key from the ca cert, which is what has
+    // been used to encrypt the signature in the cert.
+    $pubKey = openssl_pkey_get_public($caCertPem);
+    if ($pubKey === false) {
+        die('Failed to extract the public key from the ca cert.');
+    }
+    // Attempt to decrypt the encrypted signature using the CA's public
+    // key, returning the decrypted signature in $decryptedSig.  If
+    // it can't be decrypted, this ca was not used to sign it for sure...
+    $rc = openssl_public_decrypt($encryptedSig, $decryptedSig, $pubKey);
+    if ($rc === false) {
+        return false;
+    }
+    // We now have the decrypted signature, which is der encoded
+    // asn1 data containing the signature algorithm and signature hash.
+    // Now we need what was originally hashed by the issuer, which is
+    // the original DER encoded certificate without the issuer and
+    // signature information.
+    $origCert = stripSignerAsn($certDer);
+    if ($origCert === false) {
+        die('Failed to extract unsigned cert.');
+    }
+    // Get the oid of the signature hash algorithm, which is required
+    // to generate our own hash of the original cert.  This hash is
+    // what will be compared to the issuers hash.
+    $oid = getSignatureAlgorithmOid($decryptedSig);
+    if ($oid === false) {
+        die('Failed to determine the signature algorithm.');
+    }
+    switch ($oid) {
+        case '1.2.840.113549.2.2':
+            $algo = 'md2';
+            break;
+        case '1.2.840.113549.2.4':
+            $algo = 'md4';
+            break;
+        case '1.2.840.113549.2.5':
+            $algo = 'md5';
+            break;
+        case '1.3.14.3.2.18':
+            $algo = 'sha';
+            break;
+        case '1.3.14.3.2.26':
+            $algo = 'sha1';
+            break;
+        case '2.16.840.1.101.3.4.2.1':
+            $algo = 'sha256';
+            break;
+        case '2.16.840.1.101.3.4.2.2':
+            $algo = 'sha384';
+            break;
+        case '2.16.840.1.101.3.4.2.3':
+            $algo = 'sha512';
+            break;
+        default:
+            die('Unknown signature hash algorithm oid: ' . $oid);
+            break;
+    }
+    // Get the issuer generated hash from the decrypted signature.
+    $decryptedHash = getSignatureHash($decryptedSig);
+    // Ok, hash the original unsigned cert with the same algorithm
+    // and if it matches $decryptedHash we have a winner.
+    $certHash = hash($algo, $origCert);
+    return ($decryptedHash === $certHash);
+}
+
+/**
+ * Convert pem encoded certificate to DER encoding
+ * @return string $derEncoded on success
+ * @return bool false on failures
+ */
+function pemToDer($pem = null)
+{
+    if (!is_string($pem)) {
+        return false;
+    }
+    $cert_split = preg_split('/(-----((BEGIN)|(END)) CERTIFICATE-----)/', $pem);
+    if (!isset($cert_split[1])) {
+        return false;
+    }
+    return base64_decode($cert_split[1]);
+}
+
+/**
+ * Obtain der cert with issuer and signature sections stripped.
+ * @param string $der - der encoded certificate
+ * @return string $der on success
+ * @return bool false on failures.
+ */
+function stripSignerAsn($der = null)
+{
+    if (!is_string($der) or strlen($der) < 8) {
+        return false;
+    }
+    $bit = 4;
+    $len = ord($der[($bit + 1)]);
+    $bytes = 0;
+    if ($len & 0x80) {
+        $bytes = $len & 0x0f;
+        $len = 0;
+        for ($i = 0; $i < $bytes; $i++) {
+            $len = ($len << 8) | ord($der[$bit + $i + 2]);
+        }
+    }
+    return substr($der, 4, $len + 4);
+}

+ 1299 - 0
app/common/library/alipay/aop/AopClient.php

@@ -0,0 +1,1299 @@
+<?php
+namespace app\common\library\alipay\aop;
+use think\Controller;
+require_once 'AopEncrypt.php';
+require_once 'EncryptParseItem.php';
+require_once 'EncryptResponseData.php';
+require_once 'SignData.php';
+
+class AopClient
+{
+    //应用ID
+    public $appId;
+
+    //私钥文件路径
+    public $rsaPrivateKeyFilePath;
+
+    //私钥值
+    public $rsaPrivateKey;
+
+    //网关
+    public $gatewayUrl = "https://openapi.alipay.com/gateway.do";
+    //返回数据格式
+    public $format = "json";
+    //api版本
+    public $apiVersion = "1.0";
+
+    // 表单提交字符集编码
+    public $postCharset = "UTF-8";
+
+    //使用文件读取文件格式,请只传递该值
+    public $alipayPublicKey = null;
+
+    //使用读取字符串格式,请只传递该值
+    public $alipayrsaPublicKey;
+
+
+    public $debugInfo = false;
+
+    private $fileCharset = "UTF-8";
+
+    private $RESPONSE_SUFFIX = "_response";
+
+    private $ERROR_RESPONSE = "error_response";
+
+    private $SIGN_NODE_NAME = "sign";
+
+
+    //加密XML节点名称
+    private $ENCRYPT_XML_NODE_NAME = "response_encrypted";
+
+    private $needEncrypt = false;
+
+
+    //签名类型
+    public $signType = "RSA";
+
+
+    //加密密钥和类型
+
+    public $encryptKey;
+
+    public $encryptType = "AES";
+
+    private $targetServiceUrl = "";
+
+    protected $alipaySdkVersion = "alipay-sdk-php-20200415";
+
+    public function generateSign($params, $signType = "RSA")
+    {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
+
+    public function rsaSign($params, $signType = "RSA")
+    {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
+
+    public function getSignContent($params)
+    {
+        ksort($params);
+
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
+
+                if ($i == 0) {
+                    $stringToBeSigned .= "$k" . "=" . "$v";
+                } else {
+                    $stringToBeSigned .= "&" . "$k" . "=" . "$v";
+                }
+                $i++;
+            }
+        }
+
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+
+    //此方法对value做urlencode
+    public function getSignContentUrlencode($params)
+    {
+        ksort($params);
+
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
+
+                if ($i == 0) {
+                    $stringToBeSigned .= "$k" . "=" . urlencode($v);
+                } else {
+                    $stringToBeSigned .= "&" . "$k" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+    protected function sign($data, $signType = "RSA")
+    {
+        if ($this->checkEmpty($this->rsaPrivateKeyFilePath)) {
+            $priKey = $this->rsaPrivateKey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        } else {
+            $priKey = file_get_contents($this->rsaPrivateKeyFilePath);
+            $res = openssl_get_privatekey($priKey);
+        }
+
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+
+        if ("RSA2" == $signType) {
+            openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
+        } else {
+            openssl_sign($data, $sign, $res);
+        }
+
+        if (!$this->checkEmpty($this->rsaPrivateKeyFilePath)) {
+            openssl_free_key($res);
+        }
+        $sign = base64_encode($sign);
+        return $sign;
+    }
+
+    /**
+     * RSA单独签名方法,未做字符串处理,字符串处理见getSignContent()
+     * @param $data 待签名字符串
+     * @param $privatekey 商户私钥,根据keyfromfile来判断是读取字符串还是读取文件,false:填写私钥字符串去回车和空格 true:填写私钥文件路径
+     * @param $signType 签名方式,RSA:SHA1     RSA2:SHA256
+     * @param $keyfromfile 私钥获取方式,读取字符串还是读文件
+     * @return string
+     */
+    public function alonersaSign($data, $privatekey, $signType = "RSA", $keyfromfile = false)
+    {
+
+        if (!$keyfromfile) {
+            $priKey = $privatekey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        } else {
+            $priKey = file_get_contents($privatekey);
+            $res = openssl_get_privatekey($priKey);
+        }
+
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+
+        if ("RSA2" == $signType) {
+            openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
+        } else {
+            openssl_sign($data, $sign, $res);
+        }
+
+        if ($keyfromfile) {
+            openssl_free_key($res);
+        }
+        $sign = base64_encode($sign);
+        return $sign;
+    }
+
+
+    protected function curl($url, $postFields = null)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_FAILONERROR, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+
+        $postBodyString = "";
+        $encodeArray = Array();
+        $postMultipart = false;
+
+
+        if (is_array($postFields) && 0 < count($postFields)) {
+
+            foreach ($postFields as $k => $v) {
+                if ("@" != substr($v, 0, 1)) //判断是不是文件上传
+                {
+
+                    $postBodyString .= "$k=" . urlencode($this->characet($v, $this->postCharset)) . "&";
+                    $encodeArray[$k] = $this->characet($v, $this->postCharset);
+                } else //文件上传用multipart/form-data,否则用www-form-urlencoded
+                {
+                    $postMultipart = true;
+                    $encodeArray[$k] = new \CURLFile(substr($v, 1));
+                }
+
+            }
+            unset ($k, $v);
+            curl_setopt($ch, CURLOPT_POST, true);
+            if ($postMultipart) {
+                curl_setopt($ch, CURLOPT_POSTFIELDS, $encodeArray);
+            } else {
+                curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString, 0, -1));
+            }
+        }
+
+        if (!$postMultipart) {
+            $headers = array('content-type: application/x-www-form-urlencoded;charset=' . $this->postCharset);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        }
+
+        $reponse = curl_exec($ch);
+
+        if (curl_errno($ch)) {
+
+            throw new Exception(curl_error($ch), 0);
+        } else {
+            $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            if (200 !== $httpStatusCode) {
+                throw new Exception($reponse, $httpStatusCode);
+            }
+        }
+
+        curl_close($ch);
+        return $reponse;
+    }
+
+    protected function getMillisecond()
+    {
+        list($s1, $s2) = explode(' ', microtime());
+        return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
+    }
+
+
+    protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
+    {
+        $logData = array(
+            date("Y-m-d H:i:s"),
+            $apiName,
+            $this->appId,
+            PHP_OS,
+            $this->alipaySdkVersion,
+            $requestUrl,
+            $errorCode,
+            str_replace("\n", "", $responseTxt)
+        );
+
+        echo json_encode($logData);
+    }
+
+    /**
+     * 生成用于调用收银台SDK的字符串
+     * @param $request SDK接口的请求参数对象
+     * @param $appAuthToken 三方应用授权token
+     * @return string
+     */
+    public function sdkExecute($request, $appAuthToken = null)
+    {
+
+        $this->setupCharsets($request);
+
+        $params['app_id'] = $this->appId;
+        $params['method'] = $request->getApiMethodName();
+        $params['format'] = $this->format;
+        $params['sign_type'] = $this->signType;
+        $params['timestamp'] = date("Y-m-d H:i:s");
+        $params['alipay_sdk'] = $this->alipaySdkVersion;
+        $params['charset'] = $this->postCharset;
+
+        $version = $request->getApiVersion();
+        $params['version'] = $this->checkEmpty($version) ? $this->apiVersion : $version;
+
+        if ($notify_url = $request->getNotifyUrl()) {
+            $params['notify_url'] = $notify_url;
+        }
+
+        $params['app_auth_token'] = $appAuthToken;
+
+        $dict = $request->getApiParas();
+        $params['biz_content'] = $dict['biz_content'];
+
+        ksort($params);
+
+        $params['sign'] = $this->generateSign($params, $this->signType);
+
+        foreach ($params as &$value) {
+            $value = $this->characet($value, $params['charset']);
+        }
+
+        return http_build_query($params);
+    }
+
+    /**
+     * 页面提交执行方法
+     * @param $request 跳转类接口的request
+     * @param string $httpmethod 提交方式,两个值可选:post、get;
+     * @param null $appAuthToken 三方应用授权token
+     * @return 构建好的、签名后的最终跳转URL(GET)或String形式的form(POST)
+     * @throws Exception
+     */
+    public function pageExecute($request, $httpmethod = "POST", $appAuthToken = null)
+    {
+
+        $this->setupCharsets($request);
+
+        if (strcasecmp($this->fileCharset, $this->postCharset)) {
+
+            // writeLog("本地文件字符集编码与表单提交编码不一致,请务必设置成一样,属性名分别为postCharset!");
+            throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
+        }
+
+        $iv = null;
+
+        if (!$this->checkEmpty($request->getApiVersion())) {
+            $iv = $request->getApiVersion();
+        } else {
+            $iv = $this->apiVersion;
+        }
+
+        //组装系统参数
+        $sysParams["app_id"] = $this->appId;
+        $sysParams["version"] = $iv;
+        $sysParams["format"] = $this->format;
+        $sysParams["sign_type"] = $this->signType;
+        $sysParams["method"] = $request->getApiMethodName();
+        $sysParams["timestamp"] = date("Y-m-d H:i:s");
+        $sysParams["alipay_sdk"] = $this->alipaySdkVersion;
+        $sysParams["terminal_type"] = $request->getTerminalType();
+        $sysParams["terminal_info"] = $request->getTerminalInfo();
+        $sysParams["prod_code"] = $request->getProdCode();
+        $sysParams["notify_url"] = $request->getNotifyUrl();
+        $sysParams["return_url"] = $request->getReturnUrl();
+        $sysParams["charset"] = $this->postCharset;
+        $sysParams["app_auth_token"] = $appAuthToken;
+
+        //获取业务参数
+        $apiParams = $request->getApiParas();
+
+        if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
+
+            $sysParams["encrypt_type"] = $this->encryptType;
+
+            if ($this->checkEmpty($apiParams['biz_content'])) {
+
+                throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
+            }
+
+            if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+
+                throw new Exception(" encryptType and encryptKey must not null! ");
+            }
+
+            if ("AES" != $this->encryptType) {
+
+                throw new Exception("加密类型只支持AES");
+            }
+
+            // 执行加密
+            $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
+            $apiParams['biz_content'] = $enCryptContent;
+
+        }
+
+        //print_r($apiParams);
+        $totalParams = array_merge($apiParams, $sysParams);
+
+        //待签名字符串
+        $preSignStr = $this->getSignContent($totalParams);
+
+        //签名
+        $totalParams["sign"] = $this->generateSign($totalParams, $this->signType);
+
+        if ("GET" == strtoupper($httpmethod)) {
+
+            //value做urlencode
+            $preString = $this->getSignContentUrlencode($totalParams);
+            //拼接GET请求串
+            $requestUrl = $this->gatewayUrl . "?" . $preString;
+
+            return $requestUrl;
+        } else {
+            //拼接表单字符串
+            return $this->buildRequestForm($totalParams);
+        }
+
+
+    }
+
+
+    /**
+     * 建立请求,以表单HTML形式构造(默认)
+     * @param $para_temp 请求参数数组
+     * @return 提交表单HTML文本
+     */
+    protected function buildRequestForm($para_temp)
+    {
+
+        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $this->gatewayUrl . "?charset=" . trim($this->postCharset) . "' method='POST'>";
+        while (list ($key, $val) = $this->fun_adm_each($para_temp)) {
+            if (false === $this->checkEmpty($val)) {
+                //$val = $this->characet($val, $this->postCharset);
+                $val = str_replace("'", "&apos;", $val);
+                //$val = str_replace("\"","&quot;",$val);
+                $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
+            }
+        }
+
+        //submit按钮控件请不要含有name属性
+        $sHtml = $sHtml . "<input type='submit' value='ok' style='display:none;''></form>";
+
+        $sHtml = $sHtml . "<script>document.forms['alipaysubmit'].submit();</script>";
+
+        return $sHtml;
+    }
+
+    protected function fun_adm_each(&$array)
+    {
+        $res = array();
+        $key = key($array);
+        if ($key !== null) {
+            next($array);
+            $res[1] = $res['value'] = $array[$key];
+            $res[0] = $res['key'] = $key;
+        } else {
+            $res = false;
+        }
+        return $res;
+    }
+
+
+    public function execute($request, $authToken = null, $appInfoAuthtoken = null, $targetAppId = null)
+    {
+
+        $this->setupCharsets($request);
+
+        //如果两者编码不一致,会出现签名验签或者乱码
+        if (strcasecmp($this->fileCharset, $this->postCharset)) {
+
+            // writeLog("本地文件字符集编码与表单提交编码不一致,请务必设置成一样,属性名分别为postCharset!");
+            throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
+        }
+
+        $iv = null;
+
+        if (!$this->checkEmpty($request->getApiVersion())) {
+            $iv = $request->getApiVersion();
+        } else {
+            $iv = $this->apiVersion;
+        }
+
+
+        //组装系统参数
+        $sysParams["app_id"] = $this->appId;
+        $sysParams["version"] = $iv;
+        $sysParams["format"] = $this->format;
+        $sysParams["sign_type"] = $this->signType;
+        $sysParams["method"] = $request->getApiMethodName();
+        $sysParams["timestamp"] = date("Y-m-d H:i:s");
+        $sysParams["auth_token"] = $authToken;
+        $sysParams["alipay_sdk"] = $this->alipaySdkVersion;
+        $sysParams["terminal_type"] = $request->getTerminalType();
+        $sysParams["terminal_info"] = $request->getTerminalInfo();
+        $sysParams["prod_code"] = $request->getProdCode();
+        $sysParams["notify_url"] = $request->getNotifyUrl();
+        $sysParams["charset"] = $this->postCharset;
+        $sysParams["app_auth_token"] = $appInfoAuthtoken;
+        $sysParams["target_app_id"] = $targetAppId;
+        if (!$this->checkEmpty($this->targetServiceUrl)) {
+            $sysParams["ws_service_url"] = $this->targetServiceUrl;
+        }
+
+
+        //获取业务参数
+        $apiParams = $request->getApiParas();
+
+        if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
+
+            $sysParams["encrypt_type"] = $this->encryptType;
+
+            if ($this->checkEmpty($apiParams['biz_content'])) {
+
+                throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
+            }
+
+            if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+
+                throw new Exception(" encryptType and encryptKey must not null! ");
+            }
+
+            if ("AES" != $this->encryptType) {
+
+                throw new Exception("加密类型只支持AES");
+            }
+
+            // 执行加密
+            $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
+            $apiParams['biz_content'] = $enCryptContent;
+
+        }
+
+
+        //签名
+        $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
+
+
+        //系统参数放入GET请求串
+        $requestUrl = $this->gatewayUrl . "?";
+        foreach ($sysParams as $sysParamKey => $sysParamValue) {
+            $requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
+        }
+        $requestUrl = substr($requestUrl, 0, -1);
+
+
+        //发起HTTP请求
+        try {
+            $resp = $this->curl($requestUrl, $apiParams);
+        } catch (Exception $e) {
+
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
+            return false;
+        }
+
+        //解析AOP返回结果
+        $respWellFormed = false;
+
+
+        // 将返回结果转换本地文件编码
+        $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+
+
+        $signData = null;
+
+        if ("json" == $this->format) {
+
+            $respObject = json_decode($r);
+            if (null !== $respObject) {
+                $respWellFormed = true;
+                $signData = $this->parserJSONSignData($request, $resp, $respObject);
+            }
+        } else if ("xml" == $this->format) {
+            $disableLibxmlEntityLoader = libxml_disable_entity_loader(true);
+            $respObject = @ simplexml_load_string($resp);
+            if (false !== $respObject) {
+                $respWellFormed = true;
+
+                $signData = $this->parserXMLSignData($request, $resp);
+            }
+            libxml_disable_entity_loader($disableLibxmlEntityLoader);
+        }
+
+
+        //返回的HTTP文本不是标准JSON或者XML,记下错误日志
+        if (false === $respWellFormed) {
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
+            return false;
+        }
+
+        // 验签
+        $this->checkResponseSign($request, $signData, $resp, $respObject);
+
+        // 解密
+        if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
+
+            if ("json" == $this->format) {
+
+
+                $resp = $this->encryptJSONSignSource($request, $resp);
+
+                // 将返回结果转换本地文件编码
+                $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+                $respObject = json_decode($r);
+            } else {
+
+                $resp = $this->encryptXMLSignSource($request, $resp);
+
+                $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+                $disableLibxmlEntityLoader = libxml_disable_entity_loader(true);
+                $respObject = @ simplexml_load_string($r);
+                libxml_disable_entity_loader($disableLibxmlEntityLoader);
+
+            }
+        }
+
+        return $respObject;
+    }
+
+    /**
+     * 转换字符集编码
+     * @param $data
+     * @param $targetCharset
+     * @return string
+     */
+    function characet($data, $targetCharset)
+    {
+
+        if (!empty($data)) {
+            $fileType = $this->fileCharset;
+            if (strcasecmp($fileType, $targetCharset) != 0) {
+                $data = mb_convert_encoding($data, $targetCharset, $fileType);
+                //				$data = iconv($fileType, $targetCharset.'//IGNORE', $data);
+            }
+        }
+
+
+        return $data;
+    }
+
+    public function exec($paramsArray)
+    {
+        if (!isset ($paramsArray["method"])) {
+            trigger_error("No api name passed");
+        }
+        $inflector = new LtInflector;
+        $inflector->conf["separator"] = ".";
+        $requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
+        if (!class_exists($requestClassName)) {
+            trigger_error("No such api: " . $paramsArray["method"]);
+        }
+
+        $session = isset ($paramsArray["session"]) ? $paramsArray["session"] : null;
+
+        $req = new $requestClassName;
+        foreach ($paramsArray as $paraKey => $paraValue) {
+            $inflector->conf["separator"] = "_";
+            $setterMethodName = $inflector->camelize($paraKey);
+            $inflector->conf["separator"] = ".";
+            $setterMethodName = "set" . $inflector->camelize($setterMethodName);
+            if (method_exists($req, $setterMethodName)) {
+                $req->$setterMethodName ($paraValue);
+            }
+        }
+        return $this->execute($req, $session);
+    }
+
+    /**
+     * 校验$value是否非空
+     *  if not set ,return true;
+     *    if is null , return true;
+     **/
+    protected function checkEmpty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    /** rsaCheckV1 & rsaCheckV2
+     *  验证签名
+     *  在使用本方法前,必须初始化AopClient且传入公钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function rsaCheckV1($params, $rsaPublicKeyFilePath, $signType = 'RSA')
+    {
+        $sign = $params['sign'];
+
+        unset($params['sign']);
+        unset($params['sign_type']);
+        return $this->verify($this->getCheckSignContent($params), $sign, $rsaPublicKeyFilePath, $signType);
+    }
+
+    public function rsaCheckV2($params, $rsaPublicKeyFilePath, $signType = 'RSA')
+    {
+        $sign = $params['sign'];
+
+        unset($params['sign']);
+        unset($params['sign_type']);
+        return $this->verify($this->getCheckSignContent($params), $sign, $rsaPublicKeyFilePath, $signType);
+    }
+
+    function getCheckSignContent($params)
+    {
+        ksort($params);
+
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            // 转换成目标字符集
+            $v = $this->characet($v, $this->postCharset);
+
+            if ($i == 0) {
+                $stringToBeSigned .= "$k" . "=" . "$v";
+            } else {
+                $stringToBeSigned .= "&" . "$k" . "=" . "$v";
+            }
+            $i++;
+        }
+
+        unset ($k, $v);
+        return $stringToBeSigned;
+    }
+
+    function verify($data, $sign, $rsaPublicKeyFilePath, $signType = 'RSA')
+    {
+
+        if ($this->checkEmpty($this->alipayPublicKey)) {
+
+            $pubKey = $this->alipayrsaPublicKey;
+            $res = "-----BEGIN PUBLIC KEY-----\n" .
+                wordwrap($pubKey, 64, "\n", true) .
+                "\n-----END PUBLIC KEY-----";
+        } else {
+            //读取公钥文件
+            $pubKey = file_get_contents($rsaPublicKeyFilePath);
+            //转换为openssl格式密钥
+            $res = openssl_get_publickey($pubKey);
+        }
+
+        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
+
+        //调用openssl内置方法验签,返回bool值
+
+        $result = FALSE;
+        if ("RSA2" == $signType) {
+            $result = (openssl_verify($data, base64_decode($sign), $res, OPENSSL_ALGO_SHA256) === 1);
+        } else {
+            $result = (openssl_verify($data, base64_decode($sign), $res) === 1);
+        }
+
+        if (!$this->checkEmpty($this->alipayPublicKey)) {
+            //释放资源
+            openssl_free_key($res);
+        }
+
+        return $result;
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function checkSignAndDecrypt($params, $rsaPublicKeyPem, $rsaPrivateKeyPem, $isCheckSign, $isDecrypt, $signType = 'RSA')
+    {
+        $charset = $params['charset'];
+        $bizContent = $params['biz_content'];
+        if ($isCheckSign) {
+            if (!$this->rsaCheckV2($params, $rsaPublicKeyPem, $signType)) {
+                echo "<br/>checkSign failure<br/>";
+                exit;
+            }
+        }
+        if ($isDecrypt) {
+            return $this->rsaDecrypt($bizContent, $rsaPrivateKeyPem, $charset);
+        }
+
+        return $bizContent;
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function encryptAndSign($bizContent, $rsaPublicKeyPem, $rsaPrivateKeyPem, $charset, $isEncrypt, $isSign, $signType = 'RSA')
+    {
+        // 加密,并签名
+        if ($isEncrypt && $isSign) {
+            $encrypted = $this->rsaEncrypt($bizContent, $rsaPublicKeyPem, $charset);
+            $sign = $this->sign($encrypted, $signType);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$encrypted</response><encryption_type>RSA</encryption_type><sign>$sign</sign><sign_type>$signType</sign_type></alipay>";
+            return $response;
+        }
+        // 加密,不签名
+        if ($isEncrypt && (!$isSign)) {
+            $encrypted = $this->rsaEncrypt($bizContent, $rsaPublicKeyPem, $charset);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$encrypted</response><encryption_type>$signType</encryption_type></alipay>";
+            return $response;
+        }
+        // 不加密,但签名
+        if ((!$isEncrypt) && $isSign) {
+            $sign = $this->sign($bizContent, $signType);
+            $response = "<?xml version=\"1.0\" encoding=\"$charset\"?><alipay><response>$bizContent</response><sign>$sign</sign><sign_type>$signType</sign_type></alipay>";
+            return $response;
+        }
+        // 不加密,不签名
+        $response = "<?xml version=\"1.0\" encoding=\"$charset\"?>$bizContent";
+        return $response;
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function rsaEncrypt($data, $rsaPublicKeyFilePath, $charset)
+    {
+        if ($this->checkEmpty($this->alipayPublicKey)) {
+            //读取字符串
+            $pubKey = $this->alipayrsaPublicKey;
+            $res = "-----BEGIN PUBLIC KEY-----\n" .
+                wordwrap($pubKey, 64, "\n", true) .
+                "\n-----END PUBLIC KEY-----";
+        } else {
+            //读取公钥文件
+            $pubKey = file_get_contents($rsaPublicKeyFilePath);
+            //转换为openssl格式密钥
+            $res = openssl_get_publickey($pubKey);
+        }
+
+        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
+        $blocks = $this->splitCN($data, 0, 30, $charset);
+        $chrtext  = null;
+        $encodes  = array();
+        foreach ($blocks as $n => $block) {
+            if (!openssl_public_encrypt($block, $chrtext , $res)) {
+                echo "<br/>" . openssl_error_string() . "<br/>";
+            }
+            $encodes[] = $chrtext ;
+        }
+        $chrtext = implode(",", $encodes);
+
+        return base64_encode($chrtext);
+    }
+
+    /**
+     *  在使用本方法前,必须初始化AopClient且传入公私钥参数。
+     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
+     **/
+    public function rsaDecrypt($data, $rsaPrivateKeyPem, $charset)
+    {
+
+        if ($this->checkEmpty($this->rsaPrivateKeyFilePath)) {
+            //读字符串
+            $priKey = $this->rsaPrivateKey;
+            $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
+                wordwrap($priKey, 64, "\n", true) .
+                "\n-----END RSA PRIVATE KEY-----";
+        } else {
+            $priKey = file_get_contents($this->rsaPrivateKeyFilePath);
+            $res = openssl_get_privatekey($priKey);
+        }
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
+        //转换为openssl格式密钥
+        $decodes = explode(',', $data);
+        $strnull = "";
+        $dcyCont = "";
+        foreach ($decodes as $n => $decode) {
+            if (!openssl_private_decrypt($decode, $dcyCont, $res)) {
+                echo "<br/>" . openssl_error_string() . "<br/>";
+            }
+            $strnull .= $dcyCont;
+        }
+        return $strnull;
+    }
+
+    function splitCN($cont, $n = 0, $subnum, $charset)
+    {
+        //$len = strlen($cont) / 3;
+        $arrr = array();
+        for ($i = $n; $i < strlen($cont); $i += $subnum) {
+            $res = $this->subCNchar($cont, $i, $subnum, $charset);
+            if (!empty ($res)) {
+                $arrr[] = $res;
+            }
+        }
+
+        return $arrr;
+    }
+
+    function subCNchar($str, $start = 0, $length, $charset = "gbk")
+    {
+        if (strlen($str) <= $length) {
+            return $str;
+        }
+        $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
+        $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
+        $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
+        $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
+        preg_match_all($re[$charset], $str, $match);
+        $slice = join("", array_slice($match[0], $start, $length));
+        return $slice;
+    }
+
+    function parserResponseSubCode($request, $responseContent, $respObject, $format)
+    {
+
+        if ("json" == $format) {
+
+            $apiName = $request->getApiMethodName();
+            $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+            $errorNodeName = $this->ERROR_RESPONSE;
+
+            $rootIndex = strpos($responseContent, $rootNodeName);
+            $errorIndex = strpos($responseContent, $errorNodeName);
+
+            if ($rootIndex > 0) {
+                // 内部节点对象
+                $rInnerObject = $respObject->$rootNodeName;
+            } elseif ($errorIndex > 0) {
+
+                $rInnerObject = $respObject->$errorNodeName;
+            } else {
+                return null;
+            }
+
+            // 存在属性则返回对应值
+            if (isset($rInnerObject->sub_code)) {
+
+                return $rInnerObject->sub_code;
+            } else {
+
+                return null;
+            }
+
+
+        } elseif ("xml" == $format) {
+
+            // xml格式sub_code在同一层级
+            return $respObject->sub_code;
+
+        }
+
+
+    }
+
+    function parserJSONSignData($request, $responseContent, $responseJSON)
+    {
+
+        $signData = new \SignData();
+
+        $signData->sign = $this->parserJSONSign($responseJSON);
+        $signData->signSourceData = $this->parserJSONSignSource($request, $responseContent);
+
+
+        return $signData;
+
+    }
+
+    function parserJSONSignSource($request, $responseContent)
+    {
+
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+
+
+        if ($rootIndex > 0) {
+
+            return $this->parserJSONSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+
+            return $this->parserJSONSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+
+            return null;
+        }
+
+
+    }
+
+    function parserJSONSource($responseContent, $nodeName, $nodeIndex)
+    {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
+        $signIndex = strrpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+        $indexLen = $signDataEndIndex - $signDataStartIndex;
+        if ($indexLen < 0) {
+
+            return null;
+        }
+
+        return substr($responseContent, $signDataStartIndex, $indexLen);
+
+    }
+
+    function parserJSONSign($responseJSon)
+    {
+
+        return $responseJSon->sign;
+    }
+
+    function parserXMLSignData($request, $responseContent)
+    {
+
+
+        $signData = new SignData();
+
+        $signData->sign = $this->parserXMLSign($responseContent);
+        $signData->signSourceData = $this->parserXMLSignSource($request, $responseContent);
+
+
+        return $signData;
+
+
+    }
+
+    function parserXMLSignSource($request, $responseContent)
+    {
+
+
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+
+
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        //		$this->echoDebug("<br/>rootNodeName:" . $rootNodeName);
+        //		$this->echoDebug("<br/> responseContent:<xmp>" . $responseContent . "</xmp>");
+
+
+        if ($rootIndex > 0) {
+
+            return $this->parserXMLSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+
+            return $this->parserXMLSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+
+            return null;
+        }
+
+
+    }
+
+    function parserXMLSource($responseContent, $nodeName, $nodeIndex)
+    {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
+        $signIndex = strrpos($responseContent, "<" . $this->SIGN_NODE_NAME . ">");
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+        $indexLen = $signDataEndIndex - $signDataStartIndex + 1;
+
+        if ($indexLen < 0) {
+            return null;
+        }
+
+
+        return substr($responseContent, $signDataStartIndex, $indexLen);
+
+
+    }
+
+    function parserXMLSign($responseContent)
+    {
+        $signNodeName = "<" . $this->SIGN_NODE_NAME . ">";
+        $signEndNodeName = "</" . $this->SIGN_NODE_NAME . ">";
+
+        $indexOfSignNode = strpos($responseContent, $signNodeName);
+        $indexOfSignEndNode = strpos($responseContent, $signEndNodeName);
+
+
+        if ($indexOfSignNode < 0 || $indexOfSignEndNode < 0) {
+            return null;
+        }
+
+        $nodeIndex = ($indexOfSignNode + strlen($signNodeName));
+
+        $indexLen = $indexOfSignEndNode - $nodeIndex;
+
+        if ($indexLen < 0) {
+            return null;
+        }
+
+        // 签名
+        return substr($responseContent, $nodeIndex, $indexLen);
+
+    }
+
+    /**
+     * 验签
+     * @param $request
+     * @param $signData
+     * @param $resp
+     * @param $respObject
+     * @throws Exception
+     */
+    public function checkResponseSign($request, $signData, $resp, $respObject)
+    {
+
+        if (!$this->checkEmpty($this->alipayPublicKey) || !$this->checkEmpty($this->alipayrsaPublicKey)) {
+
+
+            if ($signData == null || $this->checkEmpty($signData->sign) || $this->checkEmpty($signData->signSourceData)) {
+
+                throw new Exception(" check sign Fail! The reason : signData is Empty");
+            }
+
+
+            // 获取结果sub_code
+            $responseSubCode = $this->parserResponseSubCode($request, $resp, $respObject, $this->format);
+
+
+            if (!$this->checkEmpty($responseSubCode) || ($this->checkEmpty($responseSubCode) && !$this->checkEmpty($signData->sign))) {
+
+                $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+
+                if (!$checkResult) {
+
+                    if (strpos($signData->signSourceData, "\\/") > 0) {
+
+                        $signData->signSourceData = str_replace("\\/", "/", $signData->signSourceData);
+
+                        $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+
+                        if (!$checkResult) {
+                            throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                        }
+                    } else {
+                        throw new \Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                    }
+
+                }
+            }
+
+
+        }
+    }
+
+    private function setupCharsets($request)
+    {
+        if ($this->checkEmpty($this->postCharset)) {
+            $this->postCharset = 'UTF-8';
+        }
+        $str = preg_match('/[\x80-\xff]/', $this->appId) ? $this->appId : print_r($request, true);
+        $this->fileCharset = mb_detect_encoding($str, "UTF-8, GBK") == 'UTF-8' ? 'UTF-8' : 'GBK';
+    }
+
+    // 获取加密内容
+
+    private function encryptJSONSignSource($request, $responseContent)
+    {
+
+        $parsetItem = $this->parserEncryptJSONSignSource($request, $responseContent);
+
+        $bodyIndexContent = substr($responseContent, 0, $parsetItem->startIndex);
+        $bodyEndContent = substr($responseContent, $parsetItem->endIndex, strlen($responseContent) + 1 - $parsetItem->endIndex);
+
+        $bizContent = decrypt($parsetItem->encryptContent, $this->encryptKey);
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
+
+    }
+
+
+    private function parserEncryptJSONSignSource($request, $responseContent)
+    {
+
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+
+
+        if ($rootIndex > 0) {
+
+            return $this->parserEncryptJSONItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+
+            return $this->parserEncryptJSONItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+
+            return null;
+        }
+
+
+    }
+
+
+    private function parserEncryptJSONItem($responseContent, $nodeName, $nodeIndex)
+    {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
+        $signIndex = strpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
+
+        if ($signDataEndIndex < 0) {
+
+            $signDataEndIndex = strlen($responseContent) - 1;
+        }
+
+        $indexLen = $signDataEndIndex - $signDataStartIndex;
+
+        $encContent = substr($responseContent, $signDataStartIndex + 1, $indexLen - 2);
+
+
+        $encryptParseItem = new EncryptParseItem();
+
+        $encryptParseItem->encryptContent = $encContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $signDataEndIndex;
+
+        return $encryptParseItem;
+
+    }
+
+    // 获取加密内容
+
+    private function encryptXMLSignSource($request, $responseContent)
+    {
+
+        $parsetItem = $this->parserEncryptXMLSignSource($request, $responseContent);
+
+        $bodyIndexContent = substr($responseContent, 0, $parsetItem->startIndex);
+        $bodyEndContent = substr($responseContent, $parsetItem->endIndex, strlen($responseContent) + 1 - $parsetItem->endIndex);
+        $bizContent = decrypt($parsetItem->encryptContent, $this->encryptKey);
+
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
+
+    }
+
+    private function parserEncryptXMLSignSource($request, $responseContent)
+    {
+
+
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+
+
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        //		$this->echoDebug("<br/>rootNodeName:" . $rootNodeName);
+        //		$this->echoDebug("<br/> responseContent:<xmp>" . $responseContent . "</xmp>");
+
+
+        if ($rootIndex > 0) {
+
+            return $this->parserEncryptXMLItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
+
+            return $this->parserEncryptXMLItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
+
+            return null;
+        }
+
+
+    }
+
+    private function parserEncryptXMLItem($responseContent, $nodeName, $nodeIndex)
+    {
+
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
+
+        $xmlStartNode = "<" . $this->ENCRYPT_XML_NODE_NAME . ">";
+        $xmlEndNode = "</" . $this->ENCRYPT_XML_NODE_NAME . ">";
+
+        $indexOfXmlNode = strpos($responseContent, $xmlEndNode);
+        if ($indexOfXmlNode < 0) {
+
+            $item = new EncryptParseItem();
+            $item->encryptContent = null;
+            $item->startIndex = 0;
+            $item->endIndex = 0;
+            return $item;
+        }
+
+        $startIndex = $signDataStartIndex + strlen($xmlStartNode);
+        $bizContentLen = $indexOfXmlNode - $startIndex;
+        $bizContent = substr($responseContent, $startIndex, $bizContentLen);
+
+        $encryptParseItem = new EncryptParseItem();
+        $encryptParseItem->encryptContent = $bizContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $indexOfXmlNode + strlen($xmlEndNode);
+
+        return $encryptParseItem;
+
+    }
+
+
+    function echoDebug($content)
+    {
+
+        if ($this->debugInfo) {
+            echo "<br/>" . $content;
+        }
+
+    }
+
+
+}

+ 81 - 0
app/common/library/alipay/aop/AopEncrypt.php

@@ -0,0 +1,81 @@
+<?php
+/**
+ *   加密工具类
+ *
+ * User: jiehua
+ * Date: 16/3/30
+ * Time: 下午3:25
+ */
+
+
+/**
+ * 加密方法
+ * @param string $str
+ * @return string
+ */
+function encrypt($str, $screct_key)
+{
+    //AES, 128 模式加密数据 CBC
+    $screct_key = base64_decode($screct_key);
+    $str = trim($str);
+    $str = addPKCS7Padding($str);
+
+    //设置全0的IV
+    $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+    $iv = str_repeat("\0", $iv_size);
+
+    $encrypt_str = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC, $iv);
+    return base64_encode($encrypt_str);
+}
+
+/**
+ * 解密方法
+ * @param string $str
+ * @return string
+ */
+function decrypt($str, $screct_key)
+{
+    //AES, 128 模式加密数据 CBC
+    $str = base64_decode($str);
+    $screct_key = base64_decode($screct_key);
+
+    //设置全0的IV
+    $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+    $iv = str_repeat("\0", $iv_size);
+
+    $decrypt_str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC, $iv);
+    $decrypt_str = stripPKSC7Padding($decrypt_str);
+    return $decrypt_str;
+}
+
+/**
+ * 填充算法
+ * @param string $source
+ * @return string
+ */
+function addPKCS7Padding($source)
+{
+    $source = trim($source);
+    $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+
+    $pad = $block - (strlen($source) % $block);
+    if ($pad <= $block) {
+        $char = chr($pad);
+        $source .= str_repeat($char, $pad);
+    }
+    return $source;
+}
+
+/**
+ * 移去填充算法
+ * @param string $source
+ * @return string
+ */
+function stripPKSC7Padding($source)
+{
+    $char = substr($source, -1);
+    $num = ord($char);
+    if ($num == 62) return $source;
+    $source = substr($source, 0, -$num);
+    return $source;
+}

+ 18 - 0
app/common/library/alipay/aop/EncryptParseItem.php

@@ -0,0 +1,18 @@
+<?php
+/**
+ *  TODO 补充说明
+ *
+ * User: jiehua
+ * Date: 16/3/30
+ * Time: 下午8:55
+ */
+
+class EncryptParseItem
+{
+    public $startIndex;
+
+    public $endIndex;
+
+    public $encryptContent;
+
+} 

+ 16 - 0
app/common/library/alipay/aop/EncryptResponseData.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ *  TODO 补充说明
+ *
+ * User: jiehua
+ * Date: 16/3/30
+ * Time: 下午8:51
+ */
+
+class EncryptResponseData
+{
+    public $realContent;
+
+    public $returnContent;
+
+} 

+ 15 - 0
app/common/library/alipay/aop/SignData.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: jiehua
+ * Date: 15/5/2
+ * Time: 下午6:21
+ */
+
+class SignData
+{
+    public $signSourceData = null;
+
+    public $sign = null;
+
+} 

+ 14 - 0
app/common/library/alipay/aop/readme

@@ -0,0 +1,14 @@
+SDK版本升级说明
+1、去除已经放弃维护的lotusphp框架
+2、公私钥模式开发者请直接初始化AopClient,使用方法详见:aop/test/AopClientTest.php
+3、证书模式开发者请直接初始化AopCertClient,使用方法详见:aop/test/AopCertClientTest.php
+4、兼容PHP7.2以上版本
+
+使用过程中有任何问题,请加入钉钉群咨询:23311489
+
+更新时间:2020-04-15
+
+备注:
+使用证书模式本地必须开始SSL
+如果出现SSL certificate: unable to get local issuer certificate错误信息
+解决办法:到http://curl.haxx.se/ca/cacert.pem下载pem文件,并将文件拷贝到D:\phpStudy\PHPTutorial\cacert.pem 在php.ini 增加curl.cainfo = "D:\phpStudy\PHPTutorial\cacert.pem"

+ 118 - 0
app/common/library/alipay/aop/request/AftAifinFireeyeOcrImageQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: aft.aifin.fireeye.ocr.image.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AftAifinFireeyeOcrImageQueryRequest
+{
+	/** 
+	 * OCR火眼识别
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "aft.aifin.fireeye.ocr.image.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AftFinsecureRiskplusSecurityPolicyQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: aft.finsecure.riskplus.security.policy.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AftFinsecureRiskplusSecurityPolicyQueryRequest
+{
+	/** 
+	 * 策略咨询服务输出
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "aft.finsecure.riskplus.security.policy.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AliosOpenAutoInfoQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alios.open.auto.info.query request
+ *
+ * @author auto create
+ * @since 1.0, 2020-05-06 14:05:09
+ */
+class AliosOpenAutoInfoQueryRequest
+{
+	/** 
+	 * 查询阿里车的车辆信息
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alios.open.auto.info.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAccountExrateAdviceAcceptRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.account.exrate.advice.accept request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAccountExrateAdviceAcceptRequest
+{
+	/** 
+	 * 标准的兑换交易受理接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.account.exrate.advice.accept";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAccountExrateAllclientrateQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.account.exrate.allclientrate.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-09-27 17:03:52
+ */
+class AlipayAccountExrateAllclientrateQueryRequest
+{
+	/** 
+	 * 查询客户的所有币种对最新有效汇率
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.account.exrate.allclientrate.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAccountExrateRatequeryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.account.exrate.ratequery request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAccountExrateRatequeryRequest
+{
+	/** 
+	 * 对于部分签约境内当面付的商家,为了能够在境外进行推广,因此需要汇率进行币种之间的转换,本接口提供此业务场景下的汇率查询服务
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.account.exrate.ratequery";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAccountExrateTraderequestCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.account.exrate.traderequest.create request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAccountExrateTraderequestCreateRequest
+{
+	/** 
+	 * 受理外汇交易请求
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.account.exrate.traderequest.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 171 - 0
app/common/library/alipay/aop/request/AlipayAcquireCancelRequest.php

@@ -0,0 +1,171 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.cancel request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayAcquireCancelRequest
+{
+	/** 
+	 * 操作员ID。
+	 **/
+	private $operatorId;
+	
+	/** 
+	 * 操作员的类型:
+0:支付宝操作员
+1:商户的操作员
+如果传入其它值或者为空,则默认设置为1
+	 **/
+	private $operatorType;
+	
+	/** 
+	 * 支付宝合作商户网站唯一订单号。
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 该交易在支付宝系统中的交易流水号。
+最短16位,最长64位。
+如果同时传了out_trade_no和trade_no,则以trade_no为准。
+	 **/
+	private $tradeNo;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setOperatorId($operatorId)
+	{
+		$this->operatorId = $operatorId;
+		$this->apiParas["operator_id"] = $operatorId;
+	}
+
+	public function getOperatorId()
+	{
+		return $this->operatorId;
+	}
+
+	public function setOperatorType($operatorType)
+	{
+		$this->operatorType = $operatorType;
+		$this->apiParas["operator_type"] = $operatorType;
+	}
+
+	public function getOperatorType()
+	{
+		return $this->operatorType;
+	}
+
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setTradeNo($tradeNo)
+	{
+		$this->tradeNo = $tradeNo;
+		$this->apiParas["trade_no"] = $tradeNo;
+	}
+
+	public function getTradeNo()
+	{
+		return $this->tradeNo;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.cancel";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 152 - 0
app/common/library/alipay/aop/request/AlipayAcquireCloseRequest.php

@@ -0,0 +1,152 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.close request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayAcquireCloseRequest
+{
+	/** 
+	 * 卖家的操作员ID
+	 **/
+	private $operatorId;
+	
+	/** 
+	 * 支付宝合作商户网站唯一订单号
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 该交易在支付宝系统中的交易流水号。
+最短16位,最长64位。
+如果同时传了out_trade_no和trade_no,则以trade_no为准
+	 **/
+	private $tradeNo;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setOperatorId($operatorId)
+	{
+		$this->operatorId = $operatorId;
+		$this->apiParas["operator_id"] = $operatorId;
+	}
+
+	public function getOperatorId()
+	{
+		return $this->operatorId;
+	}
+
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setTradeNo($tradeNo)
+	{
+		$this->tradeNo = $tradeNo;
+		$this->apiParas["trade_no"] = $tradeNo;
+	}
+
+	public function getTradeNo()
+	{
+		return $this->tradeNo;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.close";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 550 - 0
app/common/library/alipay/aop/request/AlipayAcquireCreateandpayRequest.php

@@ -0,0 +1,550 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.createandpay request
+ *
+ * @author auto create
+ * @since 1.0, 2019-07-18 14:08:22
+ */
+class AlipayAcquireCreateandpayRequest
+{
+	/** 
+	 * 证书签名
+	 **/
+	private $alipayCaRequest;
+	
+	/** 
+	 * 对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。
+	 **/
+	private $body;
+	
+	/** 
+	 * 买家支付宝账号,可以为email或者手机号。
+	 **/
+	private $buyerEmail;
+	
+	/** 
+	 * 买家支付宝账号对应的支付宝唯一用户号。
+以2088开头的纯16位数字。
+	 **/
+	private $buyerId;
+	
+	/** 
+	 * 描述多渠道收单的渠道明细信息,json格式,具体请参见“4.5 渠道明细说明”。
+	 **/
+	private $channelParameters;
+	
+	/** 
+	 * 订单金额币种。
+目前只支持传入156(人民币)。
+如果为空,则默认设置为156。
+	 **/
+	private $currency;
+	
+	/** 
+	 * 动态ID。
+	 **/
+	private $dynamicId;
+	
+	/** 
+	 * 动态ID类型:
+&#1048698;
+soundwave:声波
+&#1048698;
+qrcode:二维码
+&#1048698;
+barcode:条码
+&#1048698;
+wave_code:声波,等同soundwave
+&#1048698;
+qr_code:二维码,等同qrcode
+&#1048698;
+bar_code:条码,等同barcode
+建议取值wave_code、qr_code、bar_code。
+	 **/
+	private $dynamicIdType;
+	
+	/** 
+	 * 用于商户的特定业务信息的传递,只有商户与支付宝约定了传递此参数且约定了参数含义,此参数才有效。
+比如可传递声波支付场景下的门店ID等信息,以json格式传输,具体请参见“4.7 业务扩展参数说明”。
+	 **/
+	private $extendParams;
+	
+	/** 
+	 * xml或json
+	 **/
+	private $formatType;
+	
+	/** 
+	 * 描述商品明细信息,json格式,具体请参见“4.3 商品明细说明”。
+	 **/
+	private $goodsDetail;
+	
+	/** 
+	 * 设置未付款交易的超时时间,一旦超时,该笔交易就会自动被关闭。
+取值范围:1m~15d。
+m-分钟,h-小时,d-天,1c-当天(无论交易何时创建,都在0点关闭)。
+该参数数值不接受小数点,如1.5h,可转换为90m。
+该功能需要联系支付宝配置关闭时间。
+	 **/
+	private $itBPay;
+	
+	/** 
+	 * 描述预付卡相关的明细信息,json格式,具体请参见“4.8 预付卡明细参数说明”。
+	 **/
+	private $mcardParameters;
+	
+	/** 
+	 * 卖家的操作员ID。
+	 **/
+	private $operatorId;
+	
+	/** 
+	 * 操作员的类型:
+&#1048698;
+0:支付宝操作员
+&#1048698;
+1:商户的操作员
+如果传入其它值或者为空,则默认设置为1。
+	 **/
+	private $operatorType;
+	
+	/** 
+	 * 支付宝合作商户网站唯一订单号。
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 订单中商品的单价。
+如果请求时传入本参数,则必须满足total_fee=price×quantity的条件。
+	 **/
+	private $price;
+	
+	/** 
+	 * 订单中商品的数量。
+如果请求时传入本参数,则必须满足total_fee=price×quantity的条件。
+	 **/
+	private $quantity;
+	
+	/** 
+	 * 业务关联ID集合,用于放置商户的订单号、支付流水号等信息,json格式,具体请参见“4.6 业务关联ID集合说明”。
+	 **/
+	private $refIds;
+	
+	/** 
+	 * 描述分账明细信息,json格式,具体请参见“4.4 分账明细说明”。
+	 **/
+	private $royaltyParameters;
+	
+	/** 
+	 * 卖家的分账类型,目前只支持传入ROYALTY(普通分账类型)。
+	 **/
+	private $royaltyType;
+	
+	/** 
+	 * 卖家支付宝账号,可以为email或者手机号。
+如果seller_id不为空,则以seller_id的值作为卖家账号,忽略本参数。
+	 **/
+	private $sellerEmail;
+	
+	/** 
+	 * 卖家支付宝账号对应的支付宝唯一用户号。
+以2088开头的纯16位数字。
+如果和seller_email同时为空,则本参数默认填充partner的值。
+	 **/
+	private $sellerId;
+	
+	/** 
+	 * 收银台页面上,商品展示的超链接。
+	 **/
+	private $showUrl;
+	
+	/** 
+	 * 商品的标题/交易标题/订单标题/订单关键字等。
+该参数最长为128个汉字。
+	 **/
+	private $subject;
+	
+	/** 
+	 * 该笔订单的资金总额,取值范围[0.01,100000000],精确到小数点后2位。
+	 **/
+	private $totalFee;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setAlipayCaRequest($alipayCaRequest)
+	{
+		$this->alipayCaRequest = $alipayCaRequest;
+		$this->apiParas["alipay_ca_request"] = $alipayCaRequest;
+	}
+
+	public function getAlipayCaRequest()
+	{
+		return $this->alipayCaRequest;
+	}
+
+	public function setBody($body)
+	{
+		$this->body = $body;
+		$this->apiParas["body"] = $body;
+	}
+
+	public function getBody()
+	{
+		return $this->body;
+	}
+
+	public function setBuyerEmail($buyerEmail)
+	{
+		$this->buyerEmail = $buyerEmail;
+		$this->apiParas["buyer_email"] = $buyerEmail;
+	}
+
+	public function getBuyerEmail()
+	{
+		return $this->buyerEmail;
+	}
+
+	public function setBuyerId($buyerId)
+	{
+		$this->buyerId = $buyerId;
+		$this->apiParas["buyer_id"] = $buyerId;
+	}
+
+	public function getBuyerId()
+	{
+		return $this->buyerId;
+	}
+
+	public function setChannelParameters($channelParameters)
+	{
+		$this->channelParameters = $channelParameters;
+		$this->apiParas["channel_parameters"] = $channelParameters;
+	}
+
+	public function getChannelParameters()
+	{
+		return $this->channelParameters;
+	}
+
+	public function setCurrency($currency)
+	{
+		$this->currency = $currency;
+		$this->apiParas["currency"] = $currency;
+	}
+
+	public function getCurrency()
+	{
+		return $this->currency;
+	}
+
+	public function setDynamicId($dynamicId)
+	{
+		$this->dynamicId = $dynamicId;
+		$this->apiParas["dynamic_id"] = $dynamicId;
+	}
+
+	public function getDynamicId()
+	{
+		return $this->dynamicId;
+	}
+
+	public function setDynamicIdType($dynamicIdType)
+	{
+		$this->dynamicIdType = $dynamicIdType;
+		$this->apiParas["dynamic_id_type"] = $dynamicIdType;
+	}
+
+	public function getDynamicIdType()
+	{
+		return $this->dynamicIdType;
+	}
+
+	public function setExtendParams($extendParams)
+	{
+		$this->extendParams = $extendParams;
+		$this->apiParas["extend_params"] = $extendParams;
+	}
+
+	public function getExtendParams()
+	{
+		return $this->extendParams;
+	}
+
+	public function setFormatType($formatType)
+	{
+		$this->formatType = $formatType;
+		$this->apiParas["format_type"] = $formatType;
+	}
+
+	public function getFormatType()
+	{
+		return $this->formatType;
+	}
+
+	public function setGoodsDetail($goodsDetail)
+	{
+		$this->goodsDetail = $goodsDetail;
+		$this->apiParas["goods_detail"] = $goodsDetail;
+	}
+
+	public function getGoodsDetail()
+	{
+		return $this->goodsDetail;
+	}
+
+	public function setItBPay($itBPay)
+	{
+		$this->itBPay = $itBPay;
+		$this->apiParas["it_b_pay"] = $itBPay;
+	}
+
+	public function getItBPay()
+	{
+		return $this->itBPay;
+	}
+
+	public function setMcardParameters($mcardParameters)
+	{
+		$this->mcardParameters = $mcardParameters;
+		$this->apiParas["mcard_parameters"] = $mcardParameters;
+	}
+
+	public function getMcardParameters()
+	{
+		return $this->mcardParameters;
+	}
+
+	public function setOperatorId($operatorId)
+	{
+		$this->operatorId = $operatorId;
+		$this->apiParas["operator_id"] = $operatorId;
+	}
+
+	public function getOperatorId()
+	{
+		return $this->operatorId;
+	}
+
+	public function setOperatorType($operatorType)
+	{
+		$this->operatorType = $operatorType;
+		$this->apiParas["operator_type"] = $operatorType;
+	}
+
+	public function getOperatorType()
+	{
+		return $this->operatorType;
+	}
+
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setPrice($price)
+	{
+		$this->price = $price;
+		$this->apiParas["price"] = $price;
+	}
+
+	public function getPrice()
+	{
+		return $this->price;
+	}
+
+	public function setQuantity($quantity)
+	{
+		$this->quantity = $quantity;
+		$this->apiParas["quantity"] = $quantity;
+	}
+
+	public function getQuantity()
+	{
+		return $this->quantity;
+	}
+
+	public function setRefIds($refIds)
+	{
+		$this->refIds = $refIds;
+		$this->apiParas["ref_ids"] = $refIds;
+	}
+
+	public function getRefIds()
+	{
+		return $this->refIds;
+	}
+
+	public function setRoyaltyParameters($royaltyParameters)
+	{
+		$this->royaltyParameters = $royaltyParameters;
+		$this->apiParas["royalty_parameters"] = $royaltyParameters;
+	}
+
+	public function getRoyaltyParameters()
+	{
+		return $this->royaltyParameters;
+	}
+
+	public function setRoyaltyType($royaltyType)
+	{
+		$this->royaltyType = $royaltyType;
+		$this->apiParas["royalty_type"] = $royaltyType;
+	}
+
+	public function getRoyaltyType()
+	{
+		return $this->royaltyType;
+	}
+
+	public function setSellerEmail($sellerEmail)
+	{
+		$this->sellerEmail = $sellerEmail;
+		$this->apiParas["seller_email"] = $sellerEmail;
+	}
+
+	public function getSellerEmail()
+	{
+		return $this->sellerEmail;
+	}
+
+	public function setSellerId($sellerId)
+	{
+		$this->sellerId = $sellerId;
+		$this->apiParas["seller_id"] = $sellerId;
+	}
+
+	public function getSellerId()
+	{
+		return $this->sellerId;
+	}
+
+	public function setShowUrl($showUrl)
+	{
+		$this->showUrl = $showUrl;
+		$this->apiParas["show_url"] = $showUrl;
+	}
+
+	public function getShowUrl()
+	{
+		return $this->showUrl;
+	}
+
+	public function setSubject($subject)
+	{
+		$this->subject = $subject;
+		$this->apiParas["subject"] = $subject;
+	}
+
+	public function getSubject()
+	{
+		return $this->subject;
+	}
+
+	public function setTotalFee($totalFee)
+	{
+		$this->totalFee = $totalFee;
+		$this->apiParas["total_fee"] = $totalFee;
+	}
+
+	public function getTotalFee()
+	{
+		return $this->totalFee;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.createandpay";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 402 - 0
app/common/library/alipay/aop/request/AlipayAcquirePrecreateRequest.php

@@ -0,0 +1,402 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.precreate request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayAcquirePrecreateRequest
+{
+	/** 
+	 * 对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body
+	 **/
+	private $body;
+	
+	/** 
+	 * 描述多渠道收单的渠道明细信息,json格式
+	 **/
+	private $channelParameters;
+	
+	/** 
+	 * 订单金额币种。目前只支持传入156(人民币)。
+如果为空,则默认设置为156
+	 **/
+	private $currency;
+	
+	/** 
+	 * 公用业务扩展信息。用于商户的特定业务信息的传递,只有商户与支付宝约定了传递此参数且约定了参数含义,此参数才有效。
+比如可传递二维码支付场景下的门店ID等信息,以json格式传输。
+	 **/
+	private $extendParams;
+	
+	/** 
+	 * 描述商品明细信息,json格式。
+	 **/
+	private $goodsDetail;
+	
+	/** 
+	 * 订单支付超时时间。设置未付款交易的超时时间,一旦超时,该笔交易就会自动被关闭。
+取值范围:1m~15d。
+m-分钟,h-小时,d-天,1c-当天(无论交易何时创建,都在0点关闭)。
+该参数数值不接受小数点,如1.5h,可转换为90m。
+该功能需要联系支付宝配置关闭时间。
+	 **/
+	private $itBPay;
+	
+	/** 
+	 * 操作员的类型:
+0:支付宝操作员
+1:商户的操作员
+如果传入其它值或者为空,则默认设置为1
+	 **/
+	private $operatorCode;
+	
+	/** 
+	 * 卖家的操作员ID
+	 **/
+	private $operatorId;
+	
+	/** 
+	 * 支付宝合作商户网站唯一订单号
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 订单中商品的单价。
+如果请求时传入本参数,则必须满足total_fee=price×quantity的条件
+	 **/
+	private $price;
+	
+	/** 
+	 * 订单中商品的数量。
+如果请求时传入本参数,则必须满足total_fee=price×quantity的条件
+	 **/
+	private $quantity;
+	
+	/** 
+	 * 分账信息。
+描述分账明细信息,json格式
+	 **/
+	private $royaltyParameters;
+	
+	/** 
+	 * 分账类型。卖家的分账类型,目前只支持传入ROYALTY(普通分账类型)
+	 **/
+	private $royaltyType;
+	
+	/** 
+	 * 卖家支付宝账号,可以为email或者手机号。如果seller_id不为空,则以seller_id的值作为卖家账号,忽略本参数
+	 **/
+	private $sellerEmail;
+	
+	/** 
+	 * 卖家支付宝账号对应的支付宝唯一用户号,以2088开头的纯16位数字。如果和seller_email同时为空,则本参数默认填充partner的值
+	 **/
+	private $sellerId;
+	
+	/** 
+	 * 收银台页面上,商品展示的超链接
+	 **/
+	private $showUrl;
+	
+	/** 
+	 * 商品购买
+	 **/
+	private $subject;
+	
+	/** 
+	 * 订单金额。该笔订单的资金总额,取值范围[0.01,100000000],精确到小数点后2位。
+	 **/
+	private $totalFee;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBody($body)
+	{
+		$this->body = $body;
+		$this->apiParas["body"] = $body;
+	}
+
+	public function getBody()
+	{
+		return $this->body;
+	}
+
+	public function setChannelParameters($channelParameters)
+	{
+		$this->channelParameters = $channelParameters;
+		$this->apiParas["channel_parameters"] = $channelParameters;
+	}
+
+	public function getChannelParameters()
+	{
+		return $this->channelParameters;
+	}
+
+	public function setCurrency($currency)
+	{
+		$this->currency = $currency;
+		$this->apiParas["currency"] = $currency;
+	}
+
+	public function getCurrency()
+	{
+		return $this->currency;
+	}
+
+	public function setExtendParams($extendParams)
+	{
+		$this->extendParams = $extendParams;
+		$this->apiParas["extend_params"] = $extendParams;
+	}
+
+	public function getExtendParams()
+	{
+		return $this->extendParams;
+	}
+
+	public function setGoodsDetail($goodsDetail)
+	{
+		$this->goodsDetail = $goodsDetail;
+		$this->apiParas["goods_detail"] = $goodsDetail;
+	}
+
+	public function getGoodsDetail()
+	{
+		return $this->goodsDetail;
+	}
+
+	public function setItBPay($itBPay)
+	{
+		$this->itBPay = $itBPay;
+		$this->apiParas["it_b_pay"] = $itBPay;
+	}
+
+	public function getItBPay()
+	{
+		return $this->itBPay;
+	}
+
+	public function setOperatorCode($operatorCode)
+	{
+		$this->operatorCode = $operatorCode;
+		$this->apiParas["operator_code"] = $operatorCode;
+	}
+
+	public function getOperatorCode()
+	{
+		return $this->operatorCode;
+	}
+
+	public function setOperatorId($operatorId)
+	{
+		$this->operatorId = $operatorId;
+		$this->apiParas["operator_id"] = $operatorId;
+	}
+
+	public function getOperatorId()
+	{
+		return $this->operatorId;
+	}
+
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setPrice($price)
+	{
+		$this->price = $price;
+		$this->apiParas["price"] = $price;
+	}
+
+	public function getPrice()
+	{
+		return $this->price;
+	}
+
+	public function setQuantity($quantity)
+	{
+		$this->quantity = $quantity;
+		$this->apiParas["quantity"] = $quantity;
+	}
+
+	public function getQuantity()
+	{
+		return $this->quantity;
+	}
+
+	public function setRoyaltyParameters($royaltyParameters)
+	{
+		$this->royaltyParameters = $royaltyParameters;
+		$this->apiParas["royalty_parameters"] = $royaltyParameters;
+	}
+
+	public function getRoyaltyParameters()
+	{
+		return $this->royaltyParameters;
+	}
+
+	public function setRoyaltyType($royaltyType)
+	{
+		$this->royaltyType = $royaltyType;
+		$this->apiParas["royalty_type"] = $royaltyType;
+	}
+
+	public function getRoyaltyType()
+	{
+		return $this->royaltyType;
+	}
+
+	public function setSellerEmail($sellerEmail)
+	{
+		$this->sellerEmail = $sellerEmail;
+		$this->apiParas["seller_email"] = $sellerEmail;
+	}
+
+	public function getSellerEmail()
+	{
+		return $this->sellerEmail;
+	}
+
+	public function setSellerId($sellerId)
+	{
+		$this->sellerId = $sellerId;
+		$this->apiParas["seller_id"] = $sellerId;
+	}
+
+	public function getSellerId()
+	{
+		return $this->sellerId;
+	}
+
+	public function setShowUrl($showUrl)
+	{
+		$this->showUrl = $showUrl;
+		$this->apiParas["show_url"] = $showUrl;
+	}
+
+	public function getShowUrl()
+	{
+		return $this->showUrl;
+	}
+
+	public function setSubject($subject)
+	{
+		$this->subject = $subject;
+		$this->apiParas["subject"] = $subject;
+	}
+
+	public function getSubject()
+	{
+		return $this->subject;
+	}
+
+	public function setTotalFee($totalFee)
+	{
+		$this->totalFee = $totalFee;
+		$this->apiParas["total_fee"] = $totalFee;
+	}
+
+	public function getTotalFee()
+	{
+		return $this->totalFee;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.precreate";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 136 - 0
app/common/library/alipay/aop/request/AlipayAcquireQueryRequest.php

@@ -0,0 +1,136 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayAcquireQueryRequest
+{
+	/** 
+	 * 支付宝合作商户网站唯一订单号
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 该交易在支付宝系统中的交易流水号。
+最短16位,最长64位。
+如果同时传了out_trade_no和trade_no,则以trade_no为准。
+	 **/
+	private $tradeNo;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setTradeNo($tradeNo)
+	{
+		$this->tradeNo = $tradeNo;
+		$this->apiParas["trade_no"] = $tradeNo;
+	}
+
+	public function getTradeNo()
+	{
+		return $this->tradeNo;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 236 - 0
app/common/library/alipay/aop/request/AlipayAcquireRefundRequest.php

@@ -0,0 +1,236 @@
+<?php
+/**
+ * ALIPAY API: alipay.acquire.refund request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayAcquireRefundRequest
+{
+	/** 
+	 * 卖家的操作员ID。
+	 **/
+	private $operatorId;
+	
+	/** 
+	 * 操作员的类型:
+0:支付宝操作员
+1:商户的操作员
+如果传入其它值或者为空,则默认设置为1。
+	 **/
+	private $operatorType;
+	
+	/** 
+	 * 商户退款请求单号,用以标识本次交易的退款请求。
+如果不传入本参数,则以out_trade_no填充本参数的值。同时,认为本次请求为全额退款,要求退款金额和交易支付金额一致。
+	 **/
+	private $outRequestNo;
+	
+	/** 
+	 * 商户网站唯一订单号
+	 **/
+	private $outTradeNo;
+	
+	/** 
+	 * 业务关联ID集合,用于放置商户的退款单号、退款流水号等信息,json格式
+	 **/
+	private $refIds;
+	
+	/** 
+	 * 退款金额;退款金额不能大于订单金额,全额退款必须与订单金额一致。
+	 **/
+	private $refundAmount;
+	
+	/** 
+	 * 退款原因说明。
+	 **/
+	private $refundReason;
+	
+	/** 
+	 * 该交易在支付宝系统中的交易流水号。
+最短16位,最长64位。
+如果同时传了out_trade_no和trade_no,则以trade_no为准
+	 **/
+	private $tradeNo;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setOperatorId($operatorId)
+	{
+		$this->operatorId = $operatorId;
+		$this->apiParas["operator_id"] = $operatorId;
+	}
+
+	public function getOperatorId()
+	{
+		return $this->operatorId;
+	}
+
+	public function setOperatorType($operatorType)
+	{
+		$this->operatorType = $operatorType;
+		$this->apiParas["operator_type"] = $operatorType;
+	}
+
+	public function getOperatorType()
+	{
+		return $this->operatorType;
+	}
+
+	public function setOutRequestNo($outRequestNo)
+	{
+		$this->outRequestNo = $outRequestNo;
+		$this->apiParas["out_request_no"] = $outRequestNo;
+	}
+
+	public function getOutRequestNo()
+	{
+		return $this->outRequestNo;
+	}
+
+	public function setOutTradeNo($outTradeNo)
+	{
+		$this->outTradeNo = $outTradeNo;
+		$this->apiParas["out_trade_no"] = $outTradeNo;
+	}
+
+	public function getOutTradeNo()
+	{
+		return $this->outTradeNo;
+	}
+
+	public function setRefIds($refIds)
+	{
+		$this->refIds = $refIds;
+		$this->apiParas["ref_ids"] = $refIds;
+	}
+
+	public function getRefIds()
+	{
+		return $this->refIds;
+	}
+
+	public function setRefundAmount($refundAmount)
+	{
+		$this->refundAmount = $refundAmount;
+		$this->apiParas["refund_amount"] = $refundAmount;
+	}
+
+	public function getRefundAmount()
+	{
+		return $this->refundAmount;
+	}
+
+	public function setRefundReason($refundReason)
+	{
+		$this->refundReason = $refundReason;
+		$this->apiParas["refund_reason"] = $refundReason;
+	}
+
+	public function getRefundReason()
+	{
+		return $this->refundReason;
+	}
+
+	public function setTradeNo($tradeNo)
+	{
+		$this->tradeNo = $tradeNo;
+		$this->apiParas["trade_no"] = $tradeNo;
+	}
+
+	public function getTradeNo()
+	{
+		return $this->tradeNo;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.acquire.refund";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAppTokenGetRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.app.token.get request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-26 17:00:00
+ */
+class AlipayAppTokenGetRequest
+{
+	/** 
+	 * 应用安全码
+	 **/
+	private $secret;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setSecret($secret)
+	{
+		$this->secret = $secret;
+		$this->apiParas["secret"] = $secret;
+	}
+
+	public function getSecret()
+	{
+		return $this->secret;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.app.token.get";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayAssetPointBalanceQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.asset.point.balance.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAssetPointBalanceQueryRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.asset.point.balance.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayAssetPointBudgetQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.asset.point.budget.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAssetPointBudgetQueryRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.asset.point.budget.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAssetPointOrderCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.asset.point.order.create request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAssetPointOrderCreateRequest
+{
+	/** 
+	 * 商户在采购完集分宝后可以通过此接口发放集分宝
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.asset.point.order.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayAssetPointOrderQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.asset.point.order.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayAssetPointOrderQueryRequest
+{
+	/** 
+	 * 商户在调用集分宝发放接口后可以通过此接口查询发放情况
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.asset.point.order.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayBossCsChannelQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.boss.cs.channel.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayBossCsChannelQueryRequest
+{
+	/** 
+	 * 云客服热线数据查询,云客服会有很多外部客服,他们需要查询落地在站内的自己公司的服务数据。
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.boss.cs.channel.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayBossFncXwbtestRetModifyRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.boss.fnc.xwbtest.ret.modify request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayBossFncXwbtestRetModifyRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.boss.fnc.xwbtest.ret.modify";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayBossProdArrangementOfflineQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.boss.prod.arrangement.offline.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-08 15:29:11
+ */
+class AlipayBossProdArrangementOfflineQueryRequest
+{
+	/** 
+	 * 签约销售方案的主站产品码,目前只支持ONLINE_TRADE_PAY(在线购买签约)和FACE_TO_FACE_PAYMENT(当面付)两个常量值,不允许传入其他值,否则报SYSTEM_ERROR异常。不传值时,默认查询FACE_TO_FACE_PAYM(当面付产品)。
+	 **/
+	private $productCode;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setProductCode($productCode)
+	{
+		$this->productCode = $productCode;
+		$this->apiParas["product_code"] = $productCode;
+	}
+
+	public function getProductCode()
+	{
+		return $this->productCode;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.boss.prod.arrangement.offline.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayBossProdMyTestQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.boss.prod.my.test.query request
+ *
+ * @author auto create
+ * @since 1.0, 2020-02-11 17:00:00
+ */
+class AlipayBossProdMyTestQueryRequest
+{
+	/** 
+	 * 明焕open测试
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.boss.prod.my.test.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayCommerceAdContractSignRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.ad.contract.sign request
+ *
+ * @author auto create
+ * @since 1.0, 2019-02-21 15:05:00
+ */
+class AlipayCommerceAdContractSignRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.ad.contract.sign";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceAirCallcenterTradeApplyRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.air.callcenter.trade.apply request
+ *
+ * @author auto create
+ * @since 1.0, 2020-03-03 12:10:07
+ */
+class AlipayCommerceAirCallcenterTradeApplyRequest
+{
+	/** 
+	 * 航司电话订票待申请接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.air.callcenter.trade.apply";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceAirXfgDsgModifyRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.air.xfg.dsg.modify request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceAirXfgDsgModifyRequest
+{
+	/** 
+	 * 吃饭更好
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.air.xfg.dsg.modify";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorCityQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.city.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorCityQueryRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.city.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositCancelRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.deposit.cancel request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorDepositCancelRequest
+{
+	/** 
+	 * 合作渠道可通过该接口补登扣款取消请求,以帮助支付宝将用户的资金退给用户
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.deposit.cancel";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositConfirmRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.deposit.confirm request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorDepositConfirmRequest
+{
+	/** 
+	 * 合作渠道可通过该接口补登单笔圈存确认扣款请求,以帮助支付宝将用户的资金结算给指定的渠道,不支持单笔拆分
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.deposit.confirm";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorDepositQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.deposit.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorDepositQueryRequest
+{
+	/** 
+	 * 商户查询用户的充值转账记录
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.deposit.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorFunctionQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.function.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorFunctionQueryRequest
+{
+	/** 
+	 * 基于设备和城市查询当前支持的功能
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.function.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorScriptQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.script.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorScriptQueryRequest
+{
+	/** 
+	 * 查询城市一卡通的判卡、读卡脚本
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.script.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorStationQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.station.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:31:07
+ */
+class AlipayCommerceCityfacilitatorStationQueryRequest
+{
+	/** 
+	 * 地铁购票站点查询
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.station.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherBatchqueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.batchquery request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:31:37
+ */
+class AlipayCommerceCityfacilitatorVoucherBatchqueryRequest
+{
+	/** 
+	 * 地铁购票订单批量查询
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.batchquery";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherCancelRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.cancel request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:31:52
+ */
+class AlipayCommerceCityfacilitatorVoucherCancelRequest
+{
+	/** 
+	 * 钱包中地铁票购票,获得核销码,线下渠道商凭核销码撤销该笔交易
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.cancel";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherConfirmRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.confirm request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:30:39
+ */
+class AlipayCommerceCityfacilitatorVoucherConfirmRequest
+{
+	/** 
+	 * 钱包中地铁票购票,获得核销码,线下地铁自助购票机上凭核销码取票,购票确认
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.confirm";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherGenerateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.generate request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:30:53
+ */
+class AlipayCommerceCityfacilitatorVoucherGenerateRequest
+{
+	/** 
+	 * 地铁购票核销码发码
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.generate";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceCityfacilitatorVoucherQueryRequest
+{
+	/** 
+	 * 钱包中地铁票购票,获得核销码,线下地铁自助购票机上凭核销码取票,渠道商凭用户输入的核销码调接口查询核销码的有效性。
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherRefundRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.refund request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:32:08
+ */
+class AlipayCommerceCityfacilitatorVoucherRefundRequest
+{
+	/** 
+	 * 地铁购票发码退款
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.refund";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherUploadRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.cityfacilitator.voucher.upload request
+ *
+ * @author auto create
+ * @since 1.0, 2019-10-10 16:30:13
+ */
+class AlipayCommerceCityfacilitatorVoucherUploadRequest
+{
+	/** 
+	 * 钱包中地铁票购票,获得核销码,线下地铁自助购票机上凭核销码取票,票号上传接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.cityfacilitator.voucher.upload";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceDataCampaignCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.data.campaign.create request
+ *
+ * @author auto create
+ * @since 1.0, 2020-04-13 14:06:53
+ */
+class AlipayCommerceDataCampaignCreateRequest
+{
+	/** 
+	 * 集点活动配置接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.data.campaign.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceDataCampaignSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.data.campaign.send request
+ *
+ * @author auto create
+ * @since 1.0, 2020-04-23 13:06:14
+ */
+class AlipayCommerceDataCampaignSendRequest
+{
+	/** 
+	 * 集点数据回流接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.data.campaign.send";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceDataCustommetricSyncRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.data.custommetric.sync request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-22 18:10:00
+ */
+class AlipayCommerceDataCustommetricSyncRequest
+{
+	/** 
+	 * 商户自主监控自定义指标数据上报接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.data.custommetric.sync";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceDataLogdataSyncRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.data.logdata.sync request
+ *
+ * @author auto create
+ * @since 1.0, 2019-03-22 15:25:00
+ */
+class AlipayCommerceDataLogdataSyncRequest
+{
+	/** 
+	 * 商户自主监控日志数据上报接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.data.logdata.sync";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceDataMonitordataSyncRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.data.monitordata.sync request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceDataMonitordataSyncRequest
+{
+	/** 
+	 * 自助监控服务接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.data.monitordata.sync";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceEducateAuthenticateCampuscardCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.authenticate.campuscard.create request
+ *
+ * @author auto create
+ * @since 1.0, 2020-05-09 10:53:07
+ */
+class AlipayCommerceEducateAuthenticateCampuscardCreateRequest
+{
+	/** 
+	 * 高校ISV认证信息同步
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.educate.authenticate.campuscard.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceEducateParttimejobInfoCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.parttimejob.info.create request
+ *
+ * @author auto create
+ * @since 1.0, 2019-11-01 11:09:10
+ */
+class AlipayCommerceEducateParttimejobInfoCreateRequest
+{
+	/** 
+	 * ISV兼职岗位信息同步
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.educate.parttimejob.info.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceEducateSchoolcodeTokenCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.schoolcode.token.create request
+ *
+ * @author auto create
+ * @since 1.0, 2019-12-05 19:04:02
+ */
+class AlipayCommerceEducateSchoolcodeTokenCreateRequest
+{
+	/** 
+	 * 申请校园码根据用户信息生成token
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.educate.schoolcode.token.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayCommerceEducateStudentinfoShareRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.studentinfo.share request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceEducateStudentinfoShareRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.educate.studentinfo.share";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceEducateUserClickCreateRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.user.click.create request
+ *
+ * @author auto create
+ * @since 1.0, 2019-11-01 11:08:57
+ */
+class AlipayCommerceEducateUserClickCreateRequest
+{
+	/** 
+	 * 岗位点击用户信息行为
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.educate.user.click.create";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceIotDeviceserviceCancelRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.iot.deviceservice.cancel request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceIotDeviceserviceCancelRequest
+{
+	/** 
+	 * 撤销指定的设备服务
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.iot.deviceservice.cancel";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceLogisticsWaybillMinimctSyncRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.logistics.waybill.minimct.sync request
+ *
+ * @author auto create
+ * @since 1.0, 2020-03-17 10:50:09
+ */
+class AlipayCommerceLogisticsWaybillMinimctSyncRequest
+{
+	/** 
+	 * 小程序商家物流运单同步接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.logistics.waybill.minimct.sync";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceLotteryPresentSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.lottery.present.send request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceLotteryPresentSendRequest
+{
+	/** 
+	 * 商家给用户赠送彩票,由亚博科技提供服务
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.lottery.present.send";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceLotteryPresentlistQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.lottery.presentlist.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceLotteryPresentlistQueryRequest
+{
+	/** 
+	 * 查询调用者指定时间范围内的彩票赠送列表,由亚博科技提供服务
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.lottery.presentlist.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayCommerceLotteryTypelistQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.lottery.typelist.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceLotteryTypelistQueryRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.lottery.typelist.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportIntelligentizeDataSyncRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.intelligentize.data.sync request
+ *
+ * @author auto create
+ * @since 1.0, 2020-04-09 14:30:36
+ */
+class AlipayCommerceTransportIntelligentizeDataSyncRequest
+{
+	/** 
+	 * 大出行智能平台-出行数据-同步
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.intelligentize.data.sync";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportNfccardSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.nfccard.send request
+ *
+ * @author auto create
+ * @since 1.0, 2019-08-07 18:20:01
+ */
+class AlipayCommerceTransportNfccardSendRequest
+{
+	/** 
+	 * NFC用户卡信息同步
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.nfccard.send";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 103 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayKeyQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.offlinepay.key.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceTransportOfflinepayKeyQueryRequest
+{
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.offlinepay.key.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayRecordVerifyRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.offlinepay.record.verify request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceTransportOfflinepayRecordVerifyRequest
+{
+	/** 
+	 * 支付宝脱机操作信息验证
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.offlinepay.record.verify";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportOfflinepayUserblacklistQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.offlinepay.userblacklist.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayCommerceTransportOfflinepayUserblacklistQueryRequest
+{
+	/** 
+	 * 脱机交易黑名单列表
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.offlinepay.userblacklist.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportParkingReserveConfirmRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.parking.reserve.confirm request
+ *
+ * @author auto create
+ * @since 1.0, 2020-03-23 17:02:23
+ */
+class AlipayCommerceTransportParkingReserveConfirmRequest
+{
+	/** 
+	 * 支付宝车位运营预约单创建确认
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.parking.reserve.confirm";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayCommerceTransportVehicleownerMessageSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.transport.vehicleowner.message.send request
+ *
+ * @author auto create
+ * @since 1.0, 2020-03-19 10:55:10
+ */
+class AlipayCommerceTransportVehicleownerMessageSendRequest
+{
+	/** 
+	 * 车主服务统一消息发送入口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.commerce.transport.vehicleowner.message.send";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderCancelRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.cancel request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderCancelRequest
+{
+	/** 
+	 * 到位订单取消
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.cancel";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderConfirmRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.confirm request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderConfirmRequest
+{
+	/** 
+	 * 订单确认接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.confirm";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderModifyRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.modify request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderModifyRequest
+{
+	/** 
+	 * 服务订单修改接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.modify";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.query request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderQueryRequest
+{
+	/** 
+	 * 到位订单查询接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.query";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderRefundRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.refund request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderRefundRequest
+{
+	/** 
+	 * 订单退款接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.refund";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderRefuseRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.refuse request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderRefuseRequest
+{
+	/** 
+	 * 到位的单笔订单拒绝接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.refuse";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

+ 118 - 0
app/common/library/alipay/aop/request/AlipayDaoweiOrderSpModifyRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.daowei.order.sp.modify request
+ *
+ * @author auto create
+ * @since 1.0, 2019-01-07 20:51:15
+ */
+class AlipayDaoweiOrderSpModifyRequest
+{
+	/** 
+	 * 订单服务者变更接口
+	 **/
+	private $bizContent;
+
+	private $apiParas = array();
+	private $terminalType;
+	private $terminalInfo;
+	private $prodCode;
+	private $apiVersion="1.0";
+	private $notifyUrl;
+	private $returnUrl;
+    private $needEncrypt=false;
+
+	
+	public function setBizContent($bizContent)
+	{
+		$this->bizContent = $bizContent;
+		$this->apiParas["biz_content"] = $bizContent;
+	}
+
+	public function getBizContent()
+	{
+		return $this->bizContent;
+	}
+
+	public function getApiMethodName()
+	{
+		return "alipay.daowei.order.sp.modify";
+	}
+
+	public function setNotifyUrl($notifyUrl)
+	{
+		$this->notifyUrl=$notifyUrl;
+	}
+
+	public function getNotifyUrl()
+	{
+		return $this->notifyUrl;
+	}
+
+	public function setReturnUrl($returnUrl)
+	{
+		$this->returnUrl=$returnUrl;
+	}
+
+	public function getReturnUrl()
+	{
+		return $this->returnUrl;
+	}
+
+	public function getApiParas()
+	{
+		return $this->apiParas;
+	}
+
+	public function getTerminalType()
+	{
+		return $this->terminalType;
+	}
+
+	public function setTerminalType($terminalType)
+	{
+		$this->terminalType = $terminalType;
+	}
+
+	public function getTerminalInfo()
+	{
+		return $this->terminalInfo;
+	}
+
+	public function setTerminalInfo($terminalInfo)
+	{
+		$this->terminalInfo = $terminalInfo;
+	}
+
+	public function getProdCode()
+	{
+		return $this->prodCode;
+	}
+
+	public function setProdCode($prodCode)
+	{
+		$this->prodCode = $prodCode;
+	}
+
+	public function setApiVersion($apiVersion)
+	{
+		$this->apiVersion=$apiVersion;
+	}
+
+	public function getApiVersion()
+	{
+		return $this->apiVersion;
+	}
+
+  public function setNeedEncrypt($needEncrypt)
+  {
+
+     $this->needEncrypt=$needEncrypt;
+
+  }
+
+  public function getNeedEncrypt()
+  {
+    return $this->needEncrypt;
+  }
+
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است