浏览代码

充值功能

cyzhao 3 年之前
父节点
当前提交
016e981f73
共有 100 个文件被更改,包括 5819 次插入1411 次删除
  1. 5 0
      Gameserver/Amfphp/base/CmdCode.php
  2. 3 0
      Gameserver/Amfphp/base/ErrCode.php
  3. 17 1
      Gameserver/Amfphp/configs/GameConfig.php
  4. 17 1
      Gameserver/Amfphp/model/Const/GameConfig.php
  5. 1 1
      Gameserver/Amfphp/model/Const/sm_eventAction.php
  6. 1 1
      Gameserver/Amfphp/model/Const/sm_gate.php
  7. 1 1
      Gameserver/Amfphp/model/Const/sm_item_base.php
  8. 1 1
      Gameserver/Amfphp/model/Const/sm_item_taskcard.php
  9. 1 6
      Gameserver/Amfphp/model/Const/sm_item_taskcard_type.php
  10. 1 1
      Gameserver/Amfphp/model/Const/sm_plot.php
  11. 37 0
      Gameserver/Amfphp/model/Const/sm_recharge.php
  12. 1 1
      Gameserver/Amfphp/model/User/Info_UserBase.php
  13. 47 1
      Gameserver/Amfphp/process/PayProc.php
  14. 14 8
      Gameserver/Amfphp/process/StoreProc.php
  15. 17 17
      Gameserver/Amfphp/service_call/pay/Mo/OrderNotice.php
  16. 17 15
      Gameserver/Amfphp/service_call/pay/Mo/payRequest.php
  17. 176 219
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AlipayMobilePublicMultiMediaClient.php
  18. 101 94
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AlipayMobilePublicMultiMediaExecute.php
  19. 1237 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopCertClient.php
  20. 527 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopCertification.php
  21. 1008 922
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopClient.php
  22. 43 33
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopEncrypt.php
  23. 6 7
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/EncryptParseItem.php
  24. 5 7
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/EncryptResponseData.php
  25. 4 5
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/SignData.php
  26. 14 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/readme
  27. 5 5
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AftAifinFireeyeOcrImageQueryRequest.php
  28. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AftFinsecureRiskplusSecurityPolicyQueryRequest.php
  29. 5 5
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AliosOpenAutoInfoQueryRequest.php
  30. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateAdviceAcceptRequest.php
  31. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateAllclientrateQueryRequest.php
  32. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateRatequeryRequest.php
  33. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateTraderequestCreateRequest.php
  34. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCancelRequest.php
  35. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCloseRequest.php
  36. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCreateandpayRequest.php
  37. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquirePrecreateRequest.php
  38. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireQueryRequest.php
  39. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireRefundRequest.php
  40. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAppTokenGetRequest.php
  41. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointBalanceQueryRequest.php
  42. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointBudgetQueryRequest.php
  43. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointOrderCreateRequest.php
  44. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointOrderQueryRequest.php
  45. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossCsChannelQueryRequest.php
  46. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossFncXwbtestRetModifyRequest.php
  47. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossProdArrangementOfflineQueryRequest.php
  48. 5 5
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossProdMyTestQueryRequest.php
  49. 103 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceAdContractSignRequest.php
  50. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceAirCallcenterTradeApplyRequest.php
  51. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceAirXfgDsgModifyRequest.php
  52. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorCityQueryRequest.php
  53. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositCancelRequest.php
  54. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositConfirmRequest.php
  55. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositQueryRequest.php
  56. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorFunctionQueryRequest.php
  57. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorScriptQueryRequest.php
  58. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorStationQueryRequest.php
  59. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherBatchqueryRequest.php
  60. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherCancelRequest.php
  61. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherConfirmRequest.php
  62. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherGenerateRequest.php
  63. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherQueryRequest.php
  64. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherRefundRequest.php
  65. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherUploadRequest.php
  66. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataCampaignCreateRequest.php
  67. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataCampaignSendRequest.php
  68. 5 5
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataCustommetricSyncRequest.php
  69. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataLogdataSyncRequest.php
  70. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataMonitordataSyncRequest.php
  71. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateAuthenticateCampuscardCreateRequest.php
  72. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateAuthenticateCampuscardDeleteRequest.php
  73. 103 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateCampuscardAuthorizedQueryRequest.php
  74. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateParttimejobInfoCreateRequest.php
  75. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateSchoolcodeTokenCreateRequest.php
  76. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateStudentinfoShareRequest.php
  77. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateUserClickCreateRequest.php
  78. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotDeviceserviceCancelRequest.php
  79. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotReceiptDetailQueryRequest.php
  80. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotReceiptSendRequest.php
  81. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotSdarttoolMessageQueryRequest.php
  82. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotSdarttoolMessageSendRequest.php
  83. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLogisticsWaybillMinimctSyncRequest.php
  84. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryPresentSendRequest.php
  85. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryPresentlistQueryRequest.php
  86. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryTypelistQueryRequest.php
  87. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportIntelligentizeDataSyncRequest.php
  88. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportNfccardSendRequest.php
  89. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayKeyQueryRequest.php
  90. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayRecordVerifyRequest.php
  91. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayUserblacklistQueryRequest.php
  92. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportParkingReserveConfirmRequest.php
  93. 118 0
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportVehicleownerMessageSendRequest.php
  94. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderCancelRequest.php
  95. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderConfirmRequest.php
  96. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderModifyRequest.php
  97. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderQueryRequest.php
  98. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderRefundRequest.php
  99. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderRefuseRequest.php
  100. 1 1
      Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderSpModifyRequest.php

+ 5 - 0
Gameserver/Amfphp/base/CmdCode.php

@@ -72,6 +72,11 @@ class CmdCode {
      *  【移动端】查询付费记录
      */
     const cmd_mpay_getPayRecords = 8812;
+    
+    /**
+     * 临时--正式的要根据具体功能实现
+     */
+    const cmd_mpay_PayDeliverGoods = 8813;
 //
 //
 // </editor-fold>

+ 3 - 0
Gameserver/Amfphp/base/ErrCode.php

@@ -213,6 +213,9 @@ class ErrCode {
      * 神秘商城 - 免费刷新时间未到
      */
     const pay_secretshopt_freeRefresh_Time = 8816;
+    
+    const pay_order_product_id = 8817;
+    
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="    not enough 系列    ">

+ 17 - 1
Gameserver/Amfphp/configs/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-11-11 11:11:07
+ // 日期: 2021-11-19 09:45:43
 ////////////////////
 namespace loyalsoft;
 /**
@@ -1576,6 +1576,22 @@ class GameConfig {
         return self::get_hash_item('gemProperty', $itemid);
     }
     /**
+    * 充值
+    * @return \recharge
+    */
+    public static function recharge()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'recharge');
+    }
+    /**
+    * @return \sm_recharge recharge item数据 
+    */
+    public static function recharge_getItem($itemid)
+    { 
+        return self::get_hash_item('recharge', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

+ 17 - 1
Gameserver/Amfphp/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-11-11 15:21:29
+ // 日期: 2021-11-19 09:45:43
 ////////////////////
 
 /**
@@ -1576,6 +1576,22 @@ class GameConfig {
         return self::get_hash_item('gemProperty', $itemid);
     }
     /**
+    * 充值
+    * @return \recharge
+    */
+    public static function recharge()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'recharge');
+    }
+    /**
+    * @return \sm_recharge recharge item数据 
+    */
+    public static function recharge_getItem($itemid)
+    { 
+        return self::get_hash_item('recharge', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_eventAction.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-09-17 16:45:52
+ // 日期: 2021-11-15 16:03:50
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_gate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-11-03 16:17:05
+ // 日期: 2021-11-15 15:58:23
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_base.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-10-26 18:20:02
+ // 日期: 2021-11-11 17:10:18
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_taskcard.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-10-15 15:40:28
+ // 日期: 2021-11-15 16:44:23
 ////////////////////
 
 

+ 1 - 6
Gameserver/Amfphp/model/Const/sm_item_taskcard_type.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-10-15 15:40:28
+ // 日期: 2021-11-15 16:44:23
 ////////////////////
 
 
@@ -94,10 +94,5 @@ class sm_item_taskcard_type
     */
     public $score;
 
-    /**
-    * @var DateTime 上次修改 default(CURRENT_TIMESTAMP) 
-    */
-    public $lastupdate;
-
 }
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_plot.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-10-09 18:23:23
+ // 日期: 2021-11-16 14:49:24
 ////////////////////
 
 

+ 37 - 0
Gameserver/Amfphp/model/Const/sm_recharge.php

@@ -0,0 +1,37 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-11-18 15:42:00
+////////////////////
+
+
+/**
+ * Static Model recharge 充值
+ */
+class sm_recharge
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 人民币 default(0) 
+    */
+    public $rmd;
+
+    /**
+    * @var Int32 首冲翻倍 default(0) 
+    */
+    public $firstDouble;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 1 - 1
Gameserver/Amfphp/model/User/Info_UserBase.php

@@ -105,7 +105,7 @@ class Info_UserBase extends Object_ext {
      * @var type
      */
     public $resPoint = 0;
-
+    
     public function initialize() {
         my_Assert(GameConfig::primordial_data(), "找不到账号初始化数据");         # 防御
         $this->gold = GameConfig::primordial_data()->User_Gold;

+ 47 - 1
Gameserver/Amfphp/process/PayProc.php

@@ -2,6 +2,7 @@
 
 namespace loyalsoft;
 
+require_once __DIR__ . '/../service_call/pay/official/pay_op.php';                                 // 日志类型定义
 require_once __DIR__ . '/PayProc/MLogType.php';                                 // 日志类型定义
 if (PLAT == 'web') {
     include_once __DIR__ . '/PayProc/WebPayProc.php';
@@ -46,11 +47,56 @@ class PayProc {
             case CmdCode::cmd_mpay_getPayRecords:                               # 8812 查询订单记录
                 return self::GetPayRecoreds();
 // </editor-fold>
-
+// <editor-fold defaultstate="collapsed" desc=" 支付新版 2021.11.16  ">
+            case CmdCode::cmd_mpay_PayDeliverGoods:                                        # 8813 
+                return self::PayDeliverGoods();
+                // </editor-fold>
             default:
                 return Resp::err(ErrCode::cmd_err);
         }
     }
+    /**
+     * 
+     */
+    static function PayDeliverGoods() {
+        list($cpOrderId) = req()->paras;
+        $user = req()->userInfo->game;
+                
+        pay_op::CheckAndDrawOrder(req()->uid,$cpOrderId,array(new PayProc,'distributePayGoods'));  
+        //记录充值金额amount
+        $order = daoInst()->select()->from(self::orderTab)                      # 取订单数据
+                        ->where('cpOrderId')->eq($cpOrderId)
+                        ->limit(1)->fetch();
+        my_Assert($order->product_id != null, ErrCode::pay_order_product_id);
+        
+        $mo = GameConfig::recharge_getItem($order->product_id);
+        my_Assert($mo != null, ErrCode::err_const_no);
+        
+        $cash = $mo->rmd *10;       
+        if($user->baseInfo->charge_amt <= 0){
+            $cash = $mo->rmd *10* $mo->firstDouble;
+        }
+        $user->base()->Add_Cash($cash);
+      
+        $user->baseInfo->charge_amt += $order->amount;                     
+        req()->userInfo->game = $user;
+
+        UserProc::updateUserInfo();                                             # 回写玩家数据
+        return Resp::ok(array(
+                    "base" => $user->baseInfo,
+                    "store" => $user->store,     
+        ));
+    }
+    //发货
+    static function distributePayGoods($order = null) {
+        $str = $order->product_id.",".$order->product_count;   
+        //CLog::pay("支付奖励id".$order->product_id);
+        //CLog::pay("支付奖励num".$order->product_count);
+        $ret = StoreProc::AddMultiItemInStore($str);
+        //CLog::pay("支付奖励回存状态".$ret);
+        return $ret == ErrCode::ok? true:false;       
+    }
+
 
     /**
      * 8812 查询充值记录 

+ 14 - 8
Gameserver/Amfphp/process/StoreProc.php

@@ -640,12 +640,12 @@ class StoreProc {
         $user = req()->userInfo->game;    
         $ary = explode(";", $goodsStr);       
         $unlockNum = $user->privateState->expandNum * 5;      
-
+        $n = self::countStoreNum();     
         foreach ($ary as $value) {
             $val = explode(",", $value);
             $cid = "";
             my_Assert(count($val) > 1, "解析奖励字符串出错");
-            my_Assert($user->privateState->currentId< $unlockNum + 50, "背包容量不够请扩容");
+            my_Assert($n < $unlockNum + 50, "背包容量不够请扩容");
             
             list( $itemId, $num) = $val;                                        # ID, 数量
             $smItem = GameConfig::item_base_getItem($itemId);                   # 道具mo
@@ -766,7 +766,17 @@ class StoreProc {
         return ErrCode::ok;                                                     // 返回
     }
 
-    /**
+    public static function countStoreNum() {
+        $user = req()->userInfo->game;
+        $num = 0;
+        $num += count((array)$user->store->items);
+        $num += count((array)$user->store->taskcards);
+        $num += count((array)$user->store->equipment);
+        $num += count((array)$user->store->yanling);       
+        return $num;
+    }
+
+     /**
      * [6401]向包裹中添加物品
      */
     public static function AddItemInStore() {
@@ -888,11 +898,7 @@ class StoreProc {
         } else {                                                                # 如果仓库中没有这种元素,则其数目置为num
             $items->$itemId = $num;
         }
-        
-        if (!CommUtil::isPropertyExists(req()->userInfo->game->privateState, "currentId")) {          
-            req()->userInfo->game->privateState->currentId = 1;
-        }
-        req()->userInfo->game->privateState->currentId++;
+                
     }
 
     /**

+ 17 - 17
Gameserver/Amfphp/service_call/pay/Mo/OrderNotice.php

@@ -76,21 +76,21 @@ class OrderNotice extends \loyalsoft\Object_ext {
             \loyalsoft\CLog::pay('订单已经完成!' . $this);
             return false;
         }
-        // 提取纯UID作比较
-        $pureUID = function($str) {
-//            var_dump($str);
-            if (!strpos($str, "-")) {
-                return $str;
-            }
-            return substr($str, strpos($str, "-") + 1);
-        };
-//        var_dump($this->uid);
-        if ($pureUID($dbOrder->uid) != $pureUID($this->uid)) {
-            \loyalsoft\CLog::pay('UID校验不匹配! ' . $pureUID($this->uid) . " (" . $pureUID($dbOrder->uid) . ")");
-            return false;
-        }
+//        // 提取纯UID作比较
+//        $pureUID = function($str) {
+////            var_dump($str);
+//            if (!strpos($str, "-")) {
+//                return $str;
+//            }
+//            return substr($str, strpos($str, "-") + 1);
+//        };
+////        var_dump($this->uid);
+//        if ($pureUID($dbOrder->uid) != $pureUID($this->uid)) {
+//            \loyalsoft\CLog::pay('UID校验不匹配! ' . $pureUID($this->uid) . " (" . $pureUID($dbOrder->uid) . ")");
+//            return false;
+//        }
         if ($dbOrder->amount != $this->amount) {
-            \loyalsoft\CLog::pay('金额校验不匹配! ' . $this . " (" . $dbOrder->amount . ")");
+            \loyalsoft\CLog::pay('金额校验不匹配! ' . $this->amount . " (" . $dbOrder->amount . ")");
             return false;
         }
         return true;
@@ -191,10 +191,10 @@ class OrderNotice extends \loyalsoft\Object_ext {
         $o->status = ($args["trade_status"] == "TRADE_SUCCESS") ? 1 : 2;        # 订单状态()
         $uid = $exts[0];
         $o->uid = substr($uid, strpos($uid, '-') + 1);                          # 玩家uid
-        $o->amount = $args['total_amount'] * 100;                               # 支付金额, 游戏后台单位是分
+        $o->amount = $args['total_amount'];                               # 支付金额, 游戏后台单位是分
         $o->callbackInfo = $args['passback_params'];                            # 透传参数, uid-uc,zoneid,cpOrderId
         $o->sdk_orderid = $args['trade_no'];                                    # 支付宝订单id
-        $o->otherInfo = $args['buyer_logon_id'];                                # 支付宝登录账户号
+        $o->otherInfo = $args['buyer_logon_id'];                                # 支付宝登录账户号      
         return $o;
     }
 
@@ -212,7 +212,7 @@ class OrderNotice extends \loyalsoft\Object_ext {
         $o->status = ($args["result_code"] == "SUCCESS") ? 1 : 2;               # 订单状态()
         $uid = $exts[0];
         $o->uid = substr($uid, strpos($uid, '-') + 1);                          # 玩家uid
-        $o->amount = $args['total_fee'];                                        # 支付金额, 游戏后台单位是分
+        $o->amount = $args['total_fee']/100;                                    # 支付金额, 游戏后台单位是分
         $o->callbackInfo = $args['attach'];                                     # 透传参数, uid-uc,zoneid,cpOrderId
         $o->sdk_orderid = $args['transaction_id'];                              # 微信订单id
         $o->otherInfo = $args['time_end'];                                      # 结束时间

+ 17 - 15
Gameserver/Amfphp/service_call/pay/Mo/payRequest.php

@@ -73,7 +73,7 @@ class PayRequest extends loyalsoft\Object_ext {
 //        return false;                                                           # 2019.10.9 关闭充值
         $arr = get_object_vars($this);                                          # 转为数组
         $arr["uid"] = $arr["accountId"];                                        # 转换下变量名称
-        $arr["amount"] = $arr["amount"] * 100;                                  # 拉起平台时传的单位是元,比如UC还有易接,而游戏后台存储的是分
+//        $arr["amount"] = $arr["amount"];                                        # 拉起平台时传的单位是元,比如UC还有易接,而游戏后台存储的是分
         unset($arr["signType"]);                                                # 毙掉后台不需要的数据
         unset($arr["sign"]);
         unset($arr["accountId"]);
@@ -148,25 +148,27 @@ class PayRequest extends loyalsoft\Object_ext {
         }
 
         if ($this->amount) {
-            $this->amount = number_format($this->amount, 2, '.', '');
-            if ('soft' == $this->channel) {                                   # 2018年1月15号以前固定为1分钱测试
-                $this->amount = number_format(0.01, 2, '.', '');
-                $this->product_price = 0.01;
-            } else  //
-            if ($this->amount != loyalsoft\GameConfig::shop_getItem($this->product_id)->price) {
-                \loyalsoft\CLog::pay('金额不符' . $this->amount . " ");
-                exit('{"err":1,"msg":"金额不符!"}');
-            }
+//            $this->amount = number_format($this->amount, 2, '.', '');
+//            if ('soft' == $this->channel) {                                     # 2018年1月15号以前固定为1分钱测试
+//                $this->amount = number_format(0.01, 2, '.', '');
+//                $this->product_price = 0.01;
+//            } else  //
+//            if ($this->amount != loyalsoft\GameConfig::shop_getItem($this->product_id)->price) {
+//                var_dump($this->product_id);
+//                var_dump(loyalsoft\GameConfig::shop_getItem($this->product_id)->price);
+//                \loyalsoft\CLog::pay('金额不符' . $this->amount . " ");
+//                exit('{"err":1,"msg":"金额不符!"}');
+//            }
         }
         loyalsoft\daoInst()->insert(self::orderTab)
                 ->data(array('order_ts' => loyalsoft\now()))
                 ->exec();
-        $this->order_id = loyalsoft\daoInst()->select('last_insert_id() as id')->fetch('id');   # 订单自增id
-        $this->cpOrderId = \date('ymdHi') . substr(sprintf("%1$06d", $order_id), -6);           # 商户唯一id(6位数)
-        $this->callbackInfo .= "," . $this->cpOrderId;                                          # 将cpOrderId追加到透传参数中
-        $this->notifyUrl = self::get_notify_url();                                              # 自动提取支付回调地址
+        $this->order_id = loyalsoft\daoInst()->select('last_insert_id() as id')->fetch('id');                # 订单自增id
+        $this->cpOrderId = LoyalsoftAPPID . \date('ymdHi') . substr(sprintf("%1$06d", $this->order_id), -6); # 商户唯一id(尾部附加自增id后6位数)
+        $this->callbackInfo .= "," . $this->cpOrderId;                                                       # 将cpOrderId追加到透传参数中
+        $this->notifyUrl = self::get_notify_url();                                                           # 自动提取支付回调地址
     }
-
+ 
     /**
      * PS. 仅限pay.php作为入口使用才行
      * @return string 获取支付回调地址,

+ 176 - 219
Gameserver/Amfphp/service_call/pay/official/alipay/aop/AlipayMobilePublicMultiMediaClient.php

@@ -6,226 +6,183 @@
  * @version $Id: AlipayMobilePublicMultiMediaClient.php, v 0.1 Aug 15, 2014 10:19:01 AM yikai.hu Exp $
  */
 
-//namespace alipay\api ;
-
 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(){
-		//自己的服务器如果没有 curl,可用:fsockopen() 等
-
-
-		//1:
-		//2: 私钥格式
-		$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;
-
-		//分离头部
-		//list($header, $body) = explode("\r\n\r\n", $output, 2);
-		$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-----";
-
-//		echo "\n\n私钥:\n";
-//		echo( $privateKey );
-//		echo "\n\n\n";
-
-		//私钥
-		$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;
-
-//		echo "\n\n 加密后:\n";
-//		echo( $out );
-//		echo "\n\n\n";
-
-		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;
-
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
+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;
+    }
 
 }

+ 101 - 94
Gameserver/Amfphp/service_call/pay/official/alipay/aop/AlipayMobilePublicMultiMediaExecute.php

@@ -9,100 +9,107 @@
 //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 ;
-	}
+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
Gameserver/Amfphp/service_call/pay/official/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
Gameserver/Amfphp/service_call/pay/official/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);
+}

+ 1008 - 922
Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopClient.php

@@ -1,1215 +1,1301 @@
 <?php
 
 require_once 'AopEncrypt.php';
+require_once 'EncryptParseItem.php';
+require_once 'EncryptResponseData.php';
+require_once 'SignData.php';
 
-class AopClient {
-	//应用ID
-	public $appId;
-	
-	//私钥文件路径
-	public $rsaPrivateKeyFilePath;
+class AopClient
+{
+    //应用ID
+    public $appId;
 
-	//私钥值
-	public $rsaPrivateKey;
+    //私钥文件路径
+    public $rsaPrivateKeyFilePath;
 
-	//网关
-	public $gatewayUrl = "https://openapi.alipay.com/gateway.do";
-	//返回数据格式
-	public $format = "json";
-	//api版本
-	public $apiVersion = "1.0";
+    //私钥值
+    public $rsaPrivateKey;
 
-	// 表单提交字符集编码
-	public $postCharset = "UTF-8";
+    //网关
+    public $gatewayUrl = "https://openapi.alipay.com/gateway.do";
+    //返回数据格式
+    public $format = "json";
+    //api版本
+    public $apiVersion = "1.0";
 
-	//使用文件读取文件格式,请只传递该值
-	public $alipayPublicKey = null;
+    // 表单提交字符集编码
+    public $postCharset = "UTF-8";
 
-	//使用读取字符串格式,请只传递该值
-	public $alipayrsaPublicKey;
+    //使用文件读取文件格式,请只传递该值
+    public $alipayPublicKey = null;
 
+    //使用读取字符串格式,请只传递该值
+    public $alipayrsaPublicKey;
 
-	public $debugInfo = false;
 
-	private $fileCharset = "UTF-8";
+    public $debugInfo = false;
 
-	private $RESPONSE_SUFFIX = "_response";
+    private $fileCharset = "UTF-8";
 
-	private $ERROR_RESPONSE = "error_response";
+    private $RESPONSE_SUFFIX = "_response";
 
-	private $SIGN_NODE_NAME = "sign";
+    private $ERROR_RESPONSE = "error_response";
 
+    private $SIGN_NODE_NAME = "sign";
 
-	//加密XML节点名称
-	private $ENCRYPT_XML_NODE_NAME = "response_encrypted";
 
-	private $needEncrypt = false;
+    //加密XML节点名称
+    private $ENCRYPT_XML_NODE_NAME = "response_encrypted";
 
+    private $needEncrypt = false;
 
-	//签名类型
-	public $signType = "RSA";
 
+    //签名类型
+    public $signType = "RSA";
 
-	//加密密钥和类型
 
-	public $encryptKey;
+    //加密密钥和类型
 
-	public $encryptType = "AES";
+    public $encryptKey;
 
-	protected $alipaySdkVersion = "alipay-sdk-php-20161101";
+    public $encryptType = "AES";
 
-	public function generateSign($params, $signType = "RSA") {
-		return $this->sign($this->getSignContent($params), $signType);
-	}
+    private $targetServiceUrl = "";
 
-	public function rsaSign($params, $signType = "RSA") {
-		return $this->sign($this->getSignContent($params), $signType);
-	}
+    protected $alipaySdkVersion = "alipay-sdk-php-20200415";
 
-	public function getSignContent($params) {
-		ksort($params);
+    public function generateSign($params, $signType = "RSA")
+    {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
 
-		$stringToBeSigned = "";
-		$i = 0;
-		foreach ($params as $k => $v) {
-			if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+    public function rsaSign($params, $signType = "RSA")
+    {
+        return $this->sign($this->getSignContent($params), $signType);
+    }
 
-				// 转换成目标字符集
-				$v = $this->characet($v, $this->postCharset);
+    public function getSignContent($params)
+    {
+        ksort($params);
 
-				if ($i == 0) {
-					$stringToBeSigned .= "$k" . "=" . "$v";
-				} else {
-					$stringToBeSigned .= "&" . "$k" . "=" . "$v";
-				}
-				$i++;
-			}
-		}
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
 
-		unset ($k, $v);
-		return $stringToBeSigned;
-	}
+                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)) {
+    //此方法对value做urlencode
+    public function getSignContentUrlencode($params)
+    {
+        ksort($params);
 
-				// 转换成目标字符集
-				$v = $this->characet($v, $this->postCharset);
+        $stringToBeSigned = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
 
-				if ($i == 0) {
-					$stringToBeSigned .= "$k" . "=" . urlencode($v);
-				} else {
-					$stringToBeSigned .= "&" . "$k" . "=" . urlencode($v);
-				}
-				$i++;
-			}
-		}
+                // 转换成目标字符集
+                $v = $this->characet($v, $this->postCharset);
 
-		unset ($k, $v);
-		return $stringToBeSigned;
-	}
+                if ($i == 0) {
+                    $stringToBeSigned .= "$k" . "=" . urlencode($v);
+                } else {
+                    $stringToBeSigned .= "&" . "$k" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
 
-	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);
-		}
+        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私钥配置'); 
+        ($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
 
-		if ("RSA2" == $signType) {
-			openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
-		} else {
-			openssl_sign($data, $sign, $res);
-		}
+        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;
-	}
+        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 $privatekey 商户私钥,根据keyfromfile来判断是读取字符串还是读取文件,false:填写私钥字符串去回车和空格 true:填写私钥文件路径
+     * @param $signType 签名方式,RSA:SHA1     RSA2:SHA256
      * @param $keyfromfile 私钥获取方式,读取字符串还是读文件
-     * @return string 
-     * @author mengyu.wh
+     * @return string
      */
-	public function alonersaSign($data,$privatekey,$signType = "RSA",$keyfromfile=false) {
+    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(!$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: multipart/form-data;charset=' . $this->postCharset . ';boundary=' . $this->getMillisecond());
-		} else {
-
-			$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) {
-		$localIp = isset ($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
-		$logger = new LtLogger;
-		$logger->conf["log_file"] = rtrim(AOP_SDK_WORK_DIR, '\\/') . '/' . "logs/aop_comm_err_" . $this->appId . "_" . date("Y-m-d") . ".log";
-		$logger->conf["separator"] = "^_^";
-		$logData = array(
-			date("Y-m-d H:i:s"),
-			$apiName,
-			$this->appId,
-			$localIp,
-			PHP_OS,
-			$this->alipaySdkVersion,
-			$requestUrl,
-			$errorCode,
-			str_replace("\n", "", $responseTxt)
-		);
-		$logger->log($logData);
-	}
+        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接口的请求参数对象
-     * @return string 
-     * @author guofa.tgf
+     * @param $appAuthToken 三方应用授权token
+     * @return string
      */
-	public function sdkExecute($request) {
-		
-		$this->setupCharsets($request);
+    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_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;
+        $params['app_auth_token'] = $appAuthToken;
 
-		$version = $request->getApiVersion();
-		$params['version'] = $this->checkEmpty($version) ? $this->apiVersion : $version;
+        $dict = $request->getApiParas();
+        $params['biz_content'] = $dict['biz_content'];
 
-		if ($notify_url = $request->getNotifyUrl()) {
-			$params['notify_url'] = $notify_url;
-		}
-
-		$dict = $request->getApiParas();
-		$params['biz_content'] = $dict['biz_content'];
-
-		ksort($params);
-
-		$params['sign'] = $this->generateSign($params, $this->signType);
+        ksort($params);
 
-		foreach ($params as &$value) {
-			$value = $this->characet($value, $params['charset']);
-		}
-		
-		return http_build_query($params);
-	}
+        $params['sign'] = $this->generateSign($params, $this->signType);
 
-	/*
-		页面提交执行方法
-		@param:跳转类接口的request; $httpmethod 提交方式。两个值可选:post、get
-		@return:构建好的、签名后的最终跳转URL(GET)或String形式的form(POST)
-		auther:笙默
-	*/
-	public function pageExecute($request,$httpmethod = "POST") {
+        foreach ($params as &$value) {
+            $value = $this->characet($value, $params['charset']);
+        }
 
-		$this->setupCharsets($request);
+        return http_build_query($params);
+    }
 
-		if (strcasecmp($this->fileCharset, $this->postCharset)) {
+    /**
+     * 页面提交执行方法
+     * @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)
+    {
 
-			// writeLog("本地文件字符集编码与表单提交编码不一致,请务必设置成一样,属性名分别为postCharset!");
-			throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
-		}
+        $this->setupCharsets($request);
 
-		$iv=null;
+        if (strcasecmp($this->fileCharset, $this->postCharset)) {
 
-		if(!$this->checkEmpty($request->getApiVersion())){
-			$iv=$request->getApiVersion();
-		}else{
-			$iv=$this->apiVersion;
-		}
+            // writeLog("本地文件字符集编码与表单提交编码不一致,请务必设置成一样,属性名分别为postCharset!");
+            throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
+        }
 
-		//组装系统参数
-		$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;
+        $iv = null;
 
-		//获取业务参数
-		$apiParams = $request->getApiParas();
+        if (!$this->checkEmpty($request->getApiVersion())) {
+            $iv = $request->getApiVersion();
+        } else {
+            $iv = $this->apiVersion;
+        }
 
-		if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){
+        //组装系统参数
+        $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["encrypt_type"] = $this->encryptType;
+        //获取业务参数
+        $apiParams = $request->getApiParas();
 
-			if ($this->checkEmpty($apiParams['biz_content'])) {
+        if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
 
-				throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
-			}
+            $sysParams["encrypt_type"] = $this->encryptType;
 
-			if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+            if ($this->checkEmpty($apiParams['biz_content'])) {
 
-				throw new Exception(" encryptType and encryptKey must not null! ");
-			}
+                throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
+            }
 
-			if ("AES" != $this->encryptType) {
+            if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
 
-				throw new Exception("加密类型只支持AES");
-			}
+                throw new Exception(" encryptType and encryptKey must not null! ");
+            }
 
-			// 执行加密
-			$enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
-			$apiParams['biz_content'] = $enCryptContent;
+            if ("AES" != $this->encryptType) {
 
-		}
+                throw new Exception("加密类型只支持AES");
+            }
 
-		//print_r($apiParams);
-		$totalParams = array_merge($apiParams, $sysParams);
-		
-		//待签名字符串
-		$preSignStr = $this->getSignContent($totalParams);
+            // 执行加密
+            $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
+            $apiParams['biz_content'] = $enCryptContent;
 
-		//签名
-		$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);
-		}
+        //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) = 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."'/>";
-			}
+    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;
+
         }
 
-		//submit按钮控件请不要含有name属性
-        $sHtml = $sHtml."<input type='submit' value='ok' style='display:none;''></form>";
-		
-		$sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";
-		
-		return $sHtml;
-	}
 
+        //签名
+        $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
 
-	public function execute($request, $authToken = null, $appInfoAuthtoken = null) {
 
-		$this->setupCharsets($request);
+        //系统参数放入GET请求串
+        $requestUrl = $this->gatewayUrl . "?";
+        foreach ($sysParams as $sysParamKey => $sysParamValue) {
+            $requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
+        }
+        $requestUrl = substr($requestUrl, 0, -1);
 
-		//		//  如果两者编码不一致,会出现签名验签或者乱码
-		if (strcasecmp($this->fileCharset, $this->postCharset)) {
 
-			// writeLog("本地文件字符集编码与表单提交编码不一致,请务必设置成一样,属性名分别为postCharset!");
-			throw new Exception("文件编码:[" . $this->fileCharset . "] 与表单提交编码:[" . $this->postCharset . "]两者不一致!");
-		}
+        //发起HTTP请求
+        try {
+            $resp = $this->curl($requestUrl, $apiParams);
+        } catch (Exception $e) {
 
-		$iv = null;
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
+            return false;
+        }
 
-		if (!$this->checkEmpty($request->getApiVersion())) {
-			$iv = $request->getApiVersion();
-		} else {
-			$iv = $this->apiVersion;
-		}
+        //解析AOP返回结果
+        $respWellFormed = false;
 
 
-		//组装系统参数
-		$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;
+        // 将返回结果转换本地文件编码
+        $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
 
 
-		//获取业务参数
-		$apiParams = $request->getApiParas();
+        $signData = null;
 
-			if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){
+        if ("json" == $this->format) {
 
-			$sysParams["encrypt_type"] = $this->encryptType;
+            $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;
 
-			if ($this->checkEmpty($apiParams['biz_content'])) {
+                $signData = $this->parserXMLSignData($request, $resp);
+            }
+            libxml_disable_entity_loader($disableLibxmlEntityLoader);
+        }
 
-				throw new Exception(" api request Fail! The reason : encrypt request is not supperted!");
-			}
 
-			if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) {
+        //返回的HTTP文本不是标准JSON或者XML,记下错误日志
+        if (false === $respWellFormed) {
+            $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
+            return false;
+        }
 
-				throw new Exception(" encryptType and encryptKey must not null! ");
-			}
+        // 验签
+        $this->checkResponseSign($request, $signData, $resp, $respObject);
 
-			if ("AES" != $this->encryptType) {
+        // 解密
+        if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) {
 
-				throw new Exception("加密类型只支持AES");
-			}
+            if ("json" == $this->format) {
 
-			// 执行加密
-			$enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey);
-			$apiParams['biz_content'] = $enCryptContent;
 
-		}
+                $resp = $this->encryptJSONSignSource($request, $resp);
 
+                // 将返回结果转换本地文件编码
+                $r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+                $respObject = json_decode($r);
+            } else {
 
-		//签名
-		$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType);
+                $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);
 
-		//系统参数放入GET请求串
-		$requestUrl = $this->gatewayUrl . "?";
-		foreach ($sysParams as $sysParamKey => $sysParamValue) {
-			$requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
-		}
-		$requestUrl = substr($requestUrl, 0, -1);
+            }
+        }
 
+        return $respObject;
+    }
 
-		//发起HTTP请求
-		try {
-			$resp = $this->curl($requestUrl, $apiParams);
-		} catch (Exception $e) {
+    /**
+     * 转换字符集编码
+     * @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);
+            }
+        }
 
-			$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
-			return false;
-		}
 
-		//解析AOP返回结果
-		$respWellFormed = false;
+        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"]);
+        }
 
-		// 将返回结果转换本地文件编码
-		$r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
+        $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;
+    }
 
-		$signData = null;
+    function verify($data, $sign, $rsaPublicKeyFilePath, $signType = 'RSA')
+    {
 
-		if ("json" == $this->format) {
+        if ($this->checkEmpty($this->alipayPublicKey)) {
 
-			$respObject = json_decode($r);
-			if (null !== $respObject) {
-				$respWellFormed = true;
-				$signData = $this->parserJSONSignData($request, $resp, $respObject);
-			}
-		} else if ("xml" == $this->format) {
+            $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);
+        }
 
-			$respObject = @ simplexml_load_string($resp);
-			if (false !== $respObject) {
-				$respWellFormed = true;
+        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
 
-				$signData = $this->parserXMLSignData($request, $resp);
-			}
-		}
+        //调用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);
+        }
 
-		//返回的HTTP文本不是标准JSON或者XML,记下错误日志
-		if (false === $respWellFormed) {
-			$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
-			return false;
-		}
+        if (!$this->checkEmpty($this->alipayPublicKey)) {
+            //释放资源
+            openssl_free_key($res);
+        }
 
-		// 验签
-		$this->checkResponseSign($request, $signData, $resp, $respObject);
+        return $result;
+    }
 
-		// 解密
-		if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){
+    /**
+     *  在使用本方法前,必须初始化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);
+        }
 
-			if ("json" == $this->format) {
+        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);
 
-				$resp = $this->encryptJSONSignSource($request, $resp);
+        return base64_encode($chrtext);
+    }
 
-				// 将返回结果转换本地文件编码
-				$r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
-				$respObject = json_decode($r);
-			}else{
+    /**
+     *  在使用本方法前,必须初始化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;
+            }
+        }
 
-				$resp = $this->encryptXMLSignSource($request, $resp);
+        return $arrr;
+    }
 
-				$r = iconv($this->postCharset, $this->fileCharset . "//IGNORE", $resp);
-				$respObject = @ simplexml_load_string($r);
+    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)
+    {
 
-		return $respObject;
-	}
+        if ("json" == $format) {
 
-	/**
-	 * 转换字符集编码
-	 * @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'];
-		$params['sign_type'] = null;
-		$params['sign'] = null;
-		return $this->verify($this->getSignContent($params), $sign, $rsaPublicKeyFilePath,$signType);
-	}
-	public function rsaCheckV2($params, $rsaPublicKeyFilePath, $signType='RSA') {
-		$sign = $params['sign'];
-		$params['sign'] = null;
-		return $this->verify($this->getSignContent($params), $sign, $rsaPublicKeyFilePath, $signType);
-	}
-
-	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值
-
-		if ("RSA2" == $signType) {
-			$result = (bool)openssl_verify($data, base64_decode($sign), $res, OPENSSL_ALGO_SHA256);
-		} else {
-			$result = (bool)openssl_verify($data, base64_decode($sign), $res);
-		}
-
-		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, $rsaPublicKeyPem, $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;
+            $apiName = $request->getApiMethodName();
+            $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+            $errorNodeName = $this->ERROR_RESPONSE;
 
-			$rootIndex = strpos($responseContent, $rootNodeName);
-			$errorIndex = strpos($responseContent, $errorNodeName);
+            $rootIndex = strpos($responseContent, $rootNodeName);
+            $errorIndex = strpos($responseContent, $errorNodeName);
 
-			if ($rootIndex > 0) {
-				// 内部节点对象
-				$rInnerObject = $respObject->$rootNodeName;
-			} elseif ($errorIndex > 0) {
+            if ($rootIndex > 0) {
+                // 内部节点对象
+                $rInnerObject = $respObject->$rootNodeName;
+            } elseif ($errorIndex > 0) {
 
-				$rInnerObject = $respObject->$errorNodeName;
-			} else {
-				return null;
-			}
+                $rInnerObject = $respObject->$errorNodeName;
+            } else {
+                return null;
+            }
 
-			// 存在属性则返回对应值
-			if (isset($rInnerObject->sub_code)) {
+            // 存在属性则返回对应值
+            if (isset($rInnerObject->sub_code)) {
 
-				return $rInnerObject->sub_code;
-			} else {
+                return $rInnerObject->sub_code;
+            } else {
 
-				return null;
-			}
+                return null;
+            }
 
 
-		} elseif ("xml" == $format) {
+        } elseif ("xml" == $format) {
 
-			// xml格式sub_code在同一层级
-			return $respObject->sub_code;
+            // xml格式sub_code在同一层级
+            return $respObject->sub_code;
 
-		}
+        }
 
 
-	}
+    }
 
-	function parserJSONSignData($request, $responseContent, $responseJSON) {
+    function parserJSONSignData($request, $responseContent, $responseJSON)
+    {
 
-		$signData = new SignData();
+        $signData = new SignData();
 
-		$signData->sign = $this->parserJSONSign($responseJSON);
-		$signData->signSourceData = $this->parserJSONSignSource($request, $responseContent);
+        $signData->sign = $this->parserJSONSign($responseJSON);
+        $signData->signSourceData = $this->parserJSONSignSource($request, $responseContent);
 
 
-		return $signData;
+        return $signData;
 
-	}
+    }
 
-	function parserJSONSignSource($request, $responseContent) {
+    function parserJSONSignSource($request, $responseContent)
+    {
 
-		$apiName = $request->getApiMethodName();
-		$rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
 
-		$rootIndex = strpos($responseContent, $rootNodeName);
-		$errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
 
 
-		if ($rootIndex > 0) {
+        if ($rootIndex > 0) {
 
-			return $this->parserJSONSource($responseContent, $rootNodeName, $rootIndex);
-		} else if ($errorIndex > 0) {
+            return $this->parserJSONSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
 
-			return $this->parserJSONSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
-		} else {
+            return $this->parserJSONSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
 
-			return null;
-		}
+            return null;
+        }
 
 
-	}
+    }
 
-	function parserJSONSource($responseContent, $nodeName, $nodeIndex) {
-		$signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
-		$signIndex = strpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
-		// 签名前-逗号
-		$signDataEndIndex = $signIndex - 1;
-		$indexLen = $signDataEndIndex - $signDataStartIndex;
-		if ($indexLen < 0) {
+    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 null;
+        }
 
-		return substr($responseContent, $signDataStartIndex, $indexLen);
+        return substr($responseContent, $signDataStartIndex, $indexLen);
 
-	}
+    }
 
-	function parserJSONSign($responseJSon) {
+    function parserJSONSign($responseJSon)
+    {
 
-		return $responseJSon->sign;
-	}
+        return $responseJSon->sign;
+    }
 
-	function parserXMLSignData($request, $responseContent) {
+    function parserXMLSignData($request, $responseContent)
+    {
 
 
-		$signData = new SignData();
+        $signData = new SignData();
 
-		$signData->sign = $this->parserXMLSign($responseContent);
-		$signData->signSourceData = $this->parserXMLSignSource($request, $responseContent);
+        $signData->sign = $this->parserXMLSign($responseContent);
+        $signData->signSourceData = $this->parserXMLSignSource($request, $responseContent);
 
 
-		return $signData;
+        return $signData;
 
 
-	}
+    }
 
-	function parserXMLSignSource($request, $responseContent) {
+    function parserXMLSignSource($request, $responseContent)
+    {
 
 
-		$apiName = $request->getApiMethodName();
-		$rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $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>");
+        $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) {
+        if ($rootIndex > 0) {
 
-			return $this->parserXMLSource($responseContent, $rootNodeName, $rootIndex);
-		} else if ($errorIndex > 0) {
+            return $this->parserXMLSource($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
 
-			return $this->parserXMLSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
-		} else {
+            return $this->parserXMLSource($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
 
-			return null;
-		}
+            return null;
+        }
 
 
-	}
+    }
 
-	function parserXMLSource($responseContent, $nodeName, $nodeIndex) {
-		$signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
-		$signIndex = strpos($responseContent, "<" . $this->SIGN_NODE_NAME . ">");
-		// 签名前-逗号
-		$signDataEndIndex = $signIndex - 1;
-		$indexLen = $signDataEndIndex - $signDataStartIndex + 1;
+    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;
-		}
+        if ($indexLen < 0) {
+            return null;
+        }
 
 
-		return substr($responseContent, $signDataStartIndex, $indexLen);
+        return substr($responseContent, $signDataStartIndex, $indexLen);
 
 
-	}
+    }
 
-	function parserXMLSign($responseContent) {
-		$signNodeName = "<" . $this->SIGN_NODE_NAME . ">";
-		$signEndNodeName = "</" . $this->SIGN_NODE_NAME . ">";
+    function parserXMLSign($responseContent)
+    {
+        $signNodeName = "<" . $this->SIGN_NODE_NAME . ">";
+        $signEndNodeName = "</" . $this->SIGN_NODE_NAME . ">";
 
-		$indexOfSignNode = strpos($responseContent, $signNodeName);
-		$indexOfSignEndNode = strpos($responseContent, $signEndNodeName);
+        $indexOfSignNode = strpos($responseContent, $signNodeName);
+        $indexOfSignEndNode = strpos($responseContent, $signEndNodeName);
 
 
-		if ($indexOfSignNode < 0 || $indexOfSignEndNode < 0) {
-			return null;
-		}
+        if ($indexOfSignNode < 0 || $indexOfSignEndNode < 0) {
+            return null;
+        }
 
-		$nodeIndex = ($indexOfSignNode + strlen($signNodeName));
+        $nodeIndex = ($indexOfSignNode + strlen($signNodeName));
 
-		$indexLen = $indexOfSignEndNode - $nodeIndex;
+        $indexLen = $indexOfSignEndNode - $nodeIndex;
 
-		if ($indexLen < 0) {
-			return null;
-		}
+        if ($indexLen < 0) {
+            return null;
+        }
 
-		// 签名
-		return substr($responseContent, $nodeIndex, $indexLen);
+        // 签名
+        return substr($responseContent, $nodeIndex, $indexLen);
 
-	}
+    }
 
-	/**
-	 * 验签
-	 * @param $request
-	 * @param $signData
-	 * @param $resp
-	 * @param $respObject
-	 * @throws Exception
-	 */
-	public function checkResponseSign($request, $signData, $resp, $respObject) {
+    /**
+     * 验签
+     * @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 (!$this->checkEmpty($this->alipayPublicKey) || !$this->checkEmpty($this->alipayrsaPublicKey)) {
 
 
-			if ($signData == null || $this->checkEmpty($signData->sign) || $this->checkEmpty($signData->signSourceData)) {
+            if ($signData == null || $this->checkEmpty($signData->sign) || $this->checkEmpty($signData->signSourceData)) {
 
-				throw new Exception(" check sign Fail! The reason : signData is Empty");
-			}
+                throw new Exception(" check sign Fail! The reason : signData is Empty");
+            }
 
 
-			// 获取结果sub_code
-			$responseSubCode = $this->parserResponseSubCode($request, $resp, $respObject, $this->format);
+            // 获取结果sub_code
+            $responseSubCode = $this->parserResponseSubCode($request, $resp, $respObject, $this->format);
 
 
-			if (!$this->checkEmpty($responseSubCode) || ($this->checkEmpty($responseSubCode) && !$this->checkEmpty($signData->sign))) {
+            if (!$this->checkEmpty($responseSubCode) || ($this->checkEmpty($responseSubCode) && !$this->checkEmpty($signData->sign))) {
 
-				$checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+                $checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
 
 
-				if (!$checkResult) {
+                if (!$checkResult) {
 
-					if (strpos($signData->signSourceData, "\\/") > 0) {
+                    if (strpos($signData->signSourceData, "\\/") > 0) {
 
-						$signData->signSourceData = str_replace("\\/", "/", $signData->signSourceData);
+                        $signData->signSourceData = str_replace("\\/", "/", $signData->signSourceData);
 
-						$checkResult = $this->verify($signData->signSourceData, $signData->sign, $this->alipayPublicKey, $this->signType);
+                        $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 . "]");
-						}
+                        if (!$checkResult) {
+                            throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
+                        }
 
-					} else {
+                    } else {
 
-						throw new Exception("check sign Fail! [sign=" . $signData->sign . ", signSourceData=" . $signData->signSourceData . "]");
-					}
+                        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 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) {
+    private function encryptJSONSignSource($request, $responseContent)
+    {
 
-		$parsetItem = $this->parserEncryptJSONSignSource($request, $responseContent);
+        $parsetItem = $this->parserEncryptJSONSignSource($request, $responseContent);
 
-		$bodyIndexContent = substr($responseContent, 0, $parsetItem->startIndex);
-		$bodyEndContent = substr($responseContent, $parsetItem->endIndex, strlen($responseContent) + 1 - $parsetItem->endIndex);
+        $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;
+        $bizContent = decrypt($parsetItem->encryptContent, $this->encryptKey);
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
 
-	}
+    }
 
 
-	private function parserEncryptJSONSignSource($request, $responseContent) {
+    private function parserEncryptJSONSignSource($request, $responseContent)
+    {
 
-		$apiName = $request->getApiMethodName();
-		$rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $apiName = $request->getApiMethodName();
+        $rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
 
-		$rootIndex = strpos($responseContent, $rootNodeName);
-		$errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
+        $rootIndex = strpos($responseContent, $rootNodeName);
+        $errorIndex = strpos($responseContent, $this->ERROR_RESPONSE);
 
 
-		if ($rootIndex > 0) {
+        if ($rootIndex > 0) {
 
-			return $this->parserEncryptJSONItem($responseContent, $rootNodeName, $rootIndex);
-		} else if ($errorIndex > 0) {
+            return $this->parserEncryptJSONItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
 
-			return $this->parserEncryptJSONItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
-		} else {
+            return $this->parserEncryptJSONItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
 
-			return null;
-		}
+            return null;
+        }
 
 
-	}
+    }
 
 
-	private function parserEncryptJSONItem($responseContent, $nodeName, $nodeIndex) {
-		$signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
-		$signIndex = strpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
-		// 签名前-逗号
-		$signDataEndIndex = $signIndex - 1;
+    private function parserEncryptJSONItem($responseContent, $nodeName, $nodeIndex)
+    {
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 2;
+        $signIndex = strpos($responseContent, "\"" . $this->SIGN_NODE_NAME . "\"");
+        // 签名前-逗号
+        $signDataEndIndex = $signIndex - 1;
 
-		if ($signDataEndIndex < 0) {
+        if ($signDataEndIndex < 0) {
 
-			$signDataEndIndex = strlen($responseContent)-1 ;
-		}
+            $signDataEndIndex = strlen($responseContent) - 1;
+        }
 
-		$indexLen = $signDataEndIndex - $signDataStartIndex;
+        $indexLen = $signDataEndIndex - $signDataStartIndex;
 
-		$encContent = substr($responseContent, $signDataStartIndex+1, $indexLen-2);
+        $encContent = substr($responseContent, $signDataStartIndex + 1, $indexLen - 2);
 
 
-		$encryptParseItem = new EncryptParseItem();
+        $encryptParseItem = new EncryptParseItem();
 
-		$encryptParseItem->encryptContent = $encContent;
-		$encryptParseItem->startIndex = $signDataStartIndex;
-		$encryptParseItem->endIndex = $signDataEndIndex;
+        $encryptParseItem->encryptContent = $encContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $signDataEndIndex;
 
-		return $encryptParseItem;
+        return $encryptParseItem;
 
-	}
+    }
 
-	// 获取加密内容
+    // 获取加密内容
 
-	private function encryptXMLSignSource($request, $responseContent) {
+    private function encryptXMLSignSource($request, $responseContent)
+    {
 
-		$parsetItem = $this->parserEncryptXMLSignSource($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);
+        $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;
+        return $bodyIndexContent . $bizContent . $bodyEndContent;
 
-	}
+    }
 
-	private function parserEncryptXMLSignSource($request, $responseContent) {
+    private function parserEncryptXMLSignSource($request, $responseContent)
+    {
 
 
-		$apiName = $request->getApiMethodName();
-		$rootNodeName = str_replace(".", "_", $apiName) . $this->RESPONSE_SUFFIX;
+        $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>");
+        $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) {
+        if ($rootIndex > 0) {
 
-			return $this->parserEncryptXMLItem($responseContent, $rootNodeName, $rootIndex);
-		} else if ($errorIndex > 0) {
+            return $this->parserEncryptXMLItem($responseContent, $rootNodeName, $rootIndex);
+        } else if ($errorIndex > 0) {
 
-			return $this->parserEncryptXMLItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
-		} else {
+            return $this->parserEncryptXMLItem($responseContent, $this->ERROR_RESPONSE, $errorIndex);
+        } else {
 
-			return null;
-		}
+            return null;
+        }
 
 
-	}
+    }
 
-	private function parserEncryptXMLItem($responseContent, $nodeName, $nodeIndex) {
+    private function parserEncryptXMLItem($responseContent, $nodeName, $nodeIndex)
+    {
 
-		$signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
+        $signDataStartIndex = $nodeIndex + strlen($nodeName) + 1;
 
-		$xmlStartNode="<".$this->ENCRYPT_XML_NODE_NAME.">";
-		$xmlEndNode="</".$this->ENCRYPT_XML_NODE_NAME.">";
+        $xmlStartNode = "<" . $this->ENCRYPT_XML_NODE_NAME . ">";
+        $xmlEndNode = "</" . $this->ENCRYPT_XML_NODE_NAME . ">";
 
-		$indexOfXmlNode=strpos($responseContent,$xmlEndNode);
-		if($indexOfXmlNode<0){
+        $indexOfXmlNode = strpos($responseContent, $xmlEndNode);
+        if ($indexOfXmlNode < 0) {
 
-			$item = new EncryptParseItem();
-			$item->encryptContent = null;
-			$item->startIndex = 0;
-			$item->endIndex = 0;
-			return $item;
-		}
+            $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);
+        $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);
+        $encryptParseItem = new EncryptParseItem();
+        $encryptParseItem->encryptContent = $bizContent;
+        $encryptParseItem->startIndex = $signDataStartIndex;
+        $encryptParseItem->endIndex = $indexOfXmlNode + strlen($xmlEndNode);
 
-		return $encryptParseItem;
+        return $encryptParseItem;
 
-	}
+    }
 
 
-	function echoDebug($content) {
+    function echoDebug($content)
+    {
 
-		if ($this->debugInfo) {
-			echo "<br/>" . $content;
-		}
+        if ($this->debugInfo) {
+            echo "<br/>" . $content;
+        }
 
-	}
+    }
 
 
-}
+}

+ 43 - 33
Gameserver/Amfphp/service_call/pay/official/alipay/aop/AopEncrypt.php

@@ -7,19 +7,25 @@
  * 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);
-	$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128,MCRYPT_MODE_CBC),1);
-	$encrypt_str =  mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC);
-	return base64_encode($encrypt_str);
+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);
 }
 
 /**
@@ -27,17 +33,19 @@
  * @param string $str
  * @return string
  */
- function decrypt($str,$screct_key){
-	//AES, 128 模式加密数据 CBC
-	$str = base64_decode($str);
-	$screct_key = base64_decode($screct_key);
-	$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128,MCRYPT_MODE_CBC),1);
-	$encrypt_str =  mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC);
-	$encrypt_str = trim($encrypt_str);
+function decrypt($str, $screct_key)
+{
+    //AES, 128 模式加密数据 CBC
+    $str = base64_decode($str);
+    $screct_key = base64_decode($screct_key);
 
-	$encrypt_str = stripPKSC7Padding($encrypt_str);
-	return $encrypt_str;
+    //设置全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;
 }
 
 /**
@@ -45,27 +53,29 @@
  * @param string $source
  * @return string
  */
-function addPKCS7Padding($source){
-	$source = trim($source);
-	$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+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;
+    $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){
-	$source = trim($source);
-	$char = substr($source, -1);
-	$num = ord($char);
-	if($num==62)return $source;
-	$source = substr($source,0,-$num);
-	return $source;
+function stripPKSC7Padding($source)
+{
+    $char = substr($source, -1);
+    $num = ord($char);
+    if ($num == 62) return $source;
+    $source = substr($source, 0, -$num);
+    return $source;
 }

+ 6 - 7
Gameserver/Amfphp/service_call/pay/official/alipay/aop/EncryptParseItem.php

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

+ 5 - 7
Gameserver/Amfphp/service_call/pay/official/alipay/aop/EncryptResponseData.php

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

+ 4 - 5
Gameserver/Amfphp/service_call/pay/official/alipay/aop/SignData.php

@@ -6,11 +6,10 @@
  * Time: 下午6:21
  */
 
-class SignData {
+class SignData
+{
+    public $signSourceData = null;
 
-    public $signSourceData=null;
-
-
-    public $sign=null;
+    public $sign = null;
 
 } 

+ 14 - 0
Gameserver/Amfphp/service_call/pay/official/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"

+ 5 - 5
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiServicePriceModifyRequest.php → Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AftAifinFireeyeOcrImageQueryRequest.php

@@ -1,14 +1,14 @@
 <?php
 /**
- * ALIPAY API: alipay.daowei.service.price.modify request
+ * ALIPAY API: aft.aifin.fireeye.ocr.image.query request
  *
  * @author auto create
- * @since 1.0, 2017-06-12 10:29:34
+ * @since 1.0, 2019-01-07 20:51:15
  */
-class AlipayDaoweiServicePriceModifyRequest
+class AftAifinFireeyeOcrImageQueryRequest
 {
 	/** 
-	 * 更新服务价格接口
+	 * OCR火眼识别
 	 **/
 	private $bizContent;
 
@@ -35,7 +35,7 @@ class AlipayDaoweiServicePriceModifyRequest
 
 	public function getApiMethodName()
 	{
-		return "alipay.daowei.service.price.modify";
+		return "aft.aifin.fireeye.ocr.image.query";
 	}
 
 	public function setNotifyUrl($notifyUrl)

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 5 - 5
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/SsdataDataserviceRiskAntifraudVerifyRequest.php → Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AliosOpenAutoInfoQueryRequest.php

@@ -1,14 +1,14 @@
 <?php
 /**
- * ALIPAY API: ssdata.dataservice.risk.antifraud.verify request
+ * ALIPAY API: alios.open.auto.info.query request
  *
  * @author auto create
- * @since 1.0, 2017-09-27 11:42:12
+ * @since 1.0, 2020-07-13 11:31:44
  */
-class SsdataDataserviceRiskAntifraudVerifyRequest
+class AliosOpenAutoInfoQueryRequest
 {
 	/** 
-	 * 蚁盾欺诈信息验证
+	 * 查询阿里车的车辆信息
 	 **/
 	private $bizContent;
 
@@ -35,7 +35,7 @@ class SsdataDataserviceRiskAntifraudVerifyRequest
 
 	public function getApiMethodName()
 	{
-		return "ssdata.dataservice.risk.antifraud.verify";
+		return "alios.open.auto.info.query";
 	}
 
 	public function setNotifyUrl($notifyUrl)

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateAdviceAcceptRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.account.exrate.advice.accept request
  *
  * @author auto create
- * @since 1.0, 2016-05-23 14:55:42
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAccountExrateAdviceAcceptRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateAllclientrateQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.account.exrate.allclientrate.query request
  *
  * @author auto create
- * @since 1.0, 2016-05-23 14:55:48
+ * @since 1.0, 2019-09-27 17:03:52
  */
 class AlipayAccountExrateAllclientrateQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateRatequeryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.account.exrate.ratequery request
  *
  * @author auto create
- * @since 1.0, 2017-03-27 18:11:27
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAccountExrateRatequeryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAccountExrateTraderequestCreateRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.account.exrate.traderequest.create request
  *
  * @author auto create
- * @since 1.0, 2017-07-20 10:41:44
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAccountExrateTraderequestCreateRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCancelRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.cancel request
  *
  * @author auto create
- * @since 1.0, 2014-06-12 17:17:06
+ * @since 1.0, 2019-03-08 15:29:11
  */
 class AlipayAcquireCancelRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCloseRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.close request
  *
  * @author auto create
- * @since 1.0, 2014-06-12 17:17:06
+ * @since 1.0, 2019-03-08 15:29:11
  */
 class AlipayAcquireCloseRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireCreateandpayRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.createandpay request
  *
  * @author auto create
- * @since 1.0, 2017-12-01 21:17:42
+ * @since 1.0, 2019-07-18 14:08:22
  */
 class AlipayAcquireCreateandpayRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquirePrecreateRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.precreate request
  *
  * @author auto create
- * @since 1.0, 2014-05-28 11:57:10
+ * @since 1.0, 2019-03-08 15:29:11
  */
 class AlipayAcquirePrecreateRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.query request
  *
  * @author auto create
- * @since 1.0, 2014-05-28 11:58:01
+ * @since 1.0, 2019-03-08 15:29:11
  */
 class AlipayAcquireQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAcquireRefundRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.acquire.refund request
  *
  * @author auto create
- * @since 1.0, 2014-06-12 17:17:03
+ * @since 1.0, 2019-03-08 15:29:11
  */
 class AlipayAcquireRefundRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAppTokenGetRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.app.token.get request
  *
  * @author auto create
- * @since 1.0, 2017-04-13 19:13:06
+ * @since 1.0, 2019-03-26 17:00:00
  */
 class AlipayAppTokenGetRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointBalanceQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.asset.point.balance.query request
  *
  * @author auto create
- * @since 1.0, 2017-04-14 19:00:47
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAssetPointBalanceQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointBudgetQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.asset.point.budget.query request
  *
  * @author auto create
- * @since 1.0, 2017-04-14 18:58:03
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAssetPointBudgetQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointOrderCreateRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.asset.point.order.create request
  *
  * @author auto create
- * @since 1.0, 2017-04-14 18:53:05
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAssetPointOrderCreateRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayAssetPointOrderQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.asset.point.order.query request
  *
  * @author auto create
- * @since 1.0, 2017-04-14 19:02:42
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayAssetPointOrderQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossCsChannelQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.boss.cs.channel.query request
  *
  * @author auto create
- * @since 1.0, 2016-02-23 20:04:44
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayBossCsChannelQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossFncXwbtestRetModifyRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.boss.fnc.xwbtest.ret.modify request
  *
  * @author auto create
- * @since 1.0, 2017-11-17 11:35:26
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayBossFncXwbtestRetModifyRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossProdArrangementOfflineQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.boss.prod.arrangement.offline.query request
  *
  * @author auto create
- * @since 1.0, 2017-04-14 21:06:47
+ * @since 1.0, 2020-06-02 14:17:35
  */
 class AlipayBossProdArrangementOfflineQueryRequest
 {

+ 5 - 5
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/SsdataDataserviceRiskRainscoreQueryRequest.php → Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayBossProdMyTestQueryRequest.php

@@ -1,14 +1,14 @@
 <?php
 /**
- * ALIPAY API: ssdata.dataservice.risk.rainscore.query request
+ * ALIPAY API: alipay.boss.prod.my.test.query request
  *
  * @author auto create
- * @since 1.0, 2017-12-12 09:58:59
+ * @since 1.0, 2020-02-11 17:00:00
  */
-class SsdataDataserviceRiskRainscoreQueryRequest
+class AlipayBossProdMyTestQueryRequest
 {
 	/** 
-	 * 蚁盾风险评分服务新版
+	 * 明焕open测试
 	 **/
 	private $bizContent;
 
@@ -35,7 +35,7 @@ class SsdataDataserviceRiskRainscoreQueryRequest
 
 	public function getApiMethodName()
 	{
-		return "ssdata.dataservice.risk.rainscore.query";
+		return "alipay.boss.prod.my.test.query";
 	}
 
 	public function setNotifyUrl($notifyUrl)

+ 103 - 0
Gameserver/Amfphp/service_call/pay/official/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
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceAirXfgDsgModifyRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.air.xfg.dsg.modify request
  *
  * @author auto create
- * @since 1.0, 2018-01-18 15:28:48
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceAirXfgDsgModifyRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorCityQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.city.query request
  *
  * @author auto create
- * @since 1.0, 2015-12-15 11:19:13
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorCityQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositCancelRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.deposit.cancel request
  *
  * @author auto create
- * @since 1.0, 2015-12-18 21:35:58
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorDepositCancelRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositConfirmRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.deposit.confirm request
  *
  * @author auto create
- * @since 1.0, 2015-12-18 21:36:24
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorDepositConfirmRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorDepositQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.deposit.query request
  *
  * @author auto create
- * @since 1.0, 2015-12-15 11:37:56
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorDepositQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorFunctionQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.function.query request
  *
  * @author auto create
- * @since 1.0, 2015-12-15 11:19:03
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorFunctionQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorScriptQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.script.query request
  *
  * @author auto create
- * @since 1.0, 2015-12-09 16:24:55
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorScriptQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorStationQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.station.query request
  *
  * @author auto create
- * @since 1.0, 2016-08-03 16:10:49
+ * @since 1.0, 2019-10-10 16:31:07
  */
 class AlipayCommerceCityfacilitatorStationQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherBatchqueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.batchquery request
  *
  * @author auto create
- * @since 1.0, 2016-08-03 16:11:01
+ * @since 1.0, 2019-10-10 16:31:37
  */
 class AlipayCommerceCityfacilitatorVoucherBatchqueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherCancelRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.cancel request
  *
  * @author auto create
- * @since 1.0, 2017-06-21 15:07:46
+ * @since 1.0, 2019-10-10 16:31:52
  */
 class AlipayCommerceCityfacilitatorVoucherCancelRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherConfirmRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.confirm request
  *
  * @author auto create
- * @since 1.0, 2017-06-21 15:08:33
+ * @since 1.0, 2019-10-10 16:30:39
  */
 class AlipayCommerceCityfacilitatorVoucherConfirmRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherGenerateRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.generate request
  *
  * @author auto create
- * @since 1.0, 2016-08-03 16:10:34
+ * @since 1.0, 2019-10-10 16:30:53
  */
 class AlipayCommerceCityfacilitatorVoucherGenerateRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.query request
  *
  * @author auto create
- * @since 1.0, 2017-06-21 15:04:33
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceCityfacilitatorVoucherQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherRefundRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.refund request
  *
  * @author auto create
- * @since 1.0, 2016-08-03 16:10:56
+ * @since 1.0, 2019-10-10 16:32:08
  */
 class AlipayCommerceCityfacilitatorVoucherRefundRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceCityfacilitatorVoucherUploadRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.cityfacilitator.voucher.upload request
  *
  * @author auto create
- * @since 1.0, 2017-06-21 15:05:13
+ * @since 1.0, 2019-10-10 16:30:13
  */
 class AlipayCommerceCityfacilitatorVoucherUploadRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 5 - 5
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayMarketingCampaignDiscountOperateRequest.php → Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataCustommetricSyncRequest.php

@@ -1,14 +1,14 @@
 <?php
 /**
- * ALIPAY API: alipay.marketing.campaign.discount.operate request
+ * ALIPAY API: alipay.commerce.data.custommetric.sync request
  *
  * @author auto create
- * @since 1.0, 2017-03-03 16:48:01
+ * @since 1.0, 2019-03-22 18:10:00
  */
-class AlipayMarketingCampaignDiscountOperateRequest
+class AlipayCommerceDataCustommetricSyncRequest
 {
 	/** 
-	 * 支付宝营销优惠立减活动操作
+	 * 商户自主监控自定义指标数据上报接口
 	 **/
 	private $bizContent;
 
@@ -35,7 +35,7 @@ class AlipayMarketingCampaignDiscountOperateRequest
 
 	public function getApiMethodName()
 	{
-		return "alipay.marketing.campaign.discount.operate";
+		return "alipay.commerce.data.custommetric.sync";
 	}
 
 	public function setNotifyUrl($notifyUrl)

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceDataMonitordataSyncRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.data.monitordata.sync request
  *
  * @author auto create
- * @since 1.0, 2018-01-04 10:37:50
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceDataMonitordataSyncRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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-08-10 17:17:02
+ */
+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
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateAuthenticateCampuscardDeleteRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.authenticate.campuscard.delete request
+ *
+ * @author auto create
+ * @since 1.0, 2020-08-13 21:16:16
+ */
+class AlipayCommerceEducateAuthenticateCampuscardDeleteRequest
+{
+	/** 
+	 * 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.delete";
+	}
+
+	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
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateCampuscardAuthorizedQueryRequest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.educate.campuscard.authorized.query request
+ *
+ * @author auto create
+ * @since 1.0, 2020-08-13 21:16:16
+ */
+class AlipayCommerceEducateCampuscardAuthorizedQueryRequest
+{
+
+	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.campuscard.authorized.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
Gameserver/Amfphp/service_call/pay/official/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, 2020-05-26 20:26:54
+ */
+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
Gameserver/Amfphp/service_call/pay/official/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, 2020-06-17 21:25:08
+ */
+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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceEducateStudentinfoShareRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.educate.studentinfo.share request
  *
  * @author auto create
- * @since 1.0, 2016-07-19 14:49:22
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceEducateStudentinfoShareRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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, 2020-05-26 20:27:10
+ */
+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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotDeviceserviceCancelRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.iot.deviceservice.cancel request
  *
  * @author auto create
- * @since 1.0, 2017-11-24 15:20:44
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceIotDeviceserviceCancelRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotReceiptDetailQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.iot.receipt.detail.query request
+ *
+ * @author auto create
+ * @since 1.0, 2020-06-02 16:02:25
+ */
+class AlipayCommerceIotReceiptDetailQueryRequest
+{
+	/** 
+	 * 电子小票详情查询
+	 **/
+	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.receipt.detail.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
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotReceiptSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.iot.receipt.send request
+ *
+ * @author auto create
+ * @since 1.0, 2020-09-02 11:38:00
+ */
+class AlipayCommerceIotReceiptSendRequest
+{
+	/** 
+	 * 电子小票信息发送接口
+	 **/
+	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.receipt.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
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotSdarttoolMessageQueryRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.iot.sdarttool.message.query request
+ *
+ * @author auto create
+ * @since 1.0, 2020-08-04 21:55:11
+ */
+class AlipayCommerceIotSdarttoolMessageQueryRequest
+{
+	/** 
+	 * 消息查询
+	 **/
+	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.sdarttool.message.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
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceIotSdarttoolMessageSendRequest.php

@@ -0,0 +1,118 @@
+<?php
+/**
+ * ALIPAY API: alipay.commerce.iot.sdarttool.message.send request
+ *
+ * @author auto create
+ * @since 1.0, 2020-08-04 21:55:11
+ */
+class AlipayCommerceIotSdarttoolMessageSendRequest
+{
+	/** 
+	 * 打印消息发送
+	 **/
+	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.sdarttool.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
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryPresentSendRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.lottery.present.send request
  *
  * @author auto create
- * @since 1.0, 2017-07-24 14:37:10
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceLotteryPresentSendRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryPresentlistQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.lottery.presentlist.query request
  *
  * @author auto create
- * @since 1.0, 2017-07-24 14:37:51
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceLotteryPresentlistQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceLotteryTypelistQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.lottery.typelist.query request
  *
  * @author auto create
- * @since 1.0, 2017-07-24 14:38:00
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceLotteryTypelistQueryRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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
Gameserver/Amfphp/service_call/pay/official/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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayKeyQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.transport.offlinepay.key.query request
  *
  * @author auto create
- * @since 1.0, 2017-09-04 17:13:35
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceTransportOfflinepayKeyQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayRecordVerifyRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.transport.offlinepay.record.verify request
  *
  * @author auto create
- * @since 1.0, 2017-09-04 17:14:03
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceTransportOfflinepayRecordVerifyRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayCommerceTransportOfflinepayUserblacklistQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.commerce.transport.offlinepay.userblacklist.query request
  *
  * @author auto create
- * @since 1.0, 2017-09-04 17:13:07
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayCommerceTransportOfflinepayUserblacklistQueryRequest
 {

+ 118 - 0
Gameserver/Amfphp/service_call/pay/official/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-06-22 17:13:30
+ */
+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
Gameserver/Amfphp/service_call/pay/official/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-06-22 17:13:16
+ */
+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;
+  }
+
+}

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderCancelRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.cancel request
  *
  * @author auto create
- * @since 1.0, 2017-03-30 11:55:47
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderCancelRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderConfirmRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.confirm request
  *
  * @author auto create
- * @since 1.0, 2017-03-20 14:01:05
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderConfirmRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderModifyRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.modify request
  *
  * @author auto create
- * @since 1.0, 2017-03-20 14:01:59
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderModifyRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderQueryRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.query request
  *
  * @author auto create
- * @since 1.0, 2017-03-20 14:00:38
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderQueryRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderRefundRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.refund request
  *
  * @author auto create
- * @since 1.0, 2017-03-20 14:02:08
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderRefundRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderRefuseRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.refuse request
  *
  * @author auto create
- * @since 1.0, 2017-01-16 11:30:46
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderRefuseRequest
 {

+ 1 - 1
Gameserver/Amfphp/service_call/pay/official/alipay/aop/request/AlipayDaoweiOrderSpModifyRequest.php

@@ -3,7 +3,7 @@
  * ALIPAY API: alipay.daowei.order.sp.modify request
  *
  * @author auto create
- * @since 1.0, 2017-03-20 14:01:51
+ * @since 1.0, 2019-01-07 20:51:15
  */
 class AlipayDaoweiOrderSpModifyRequest
 {

部分文件因为文件数量过多而无法显示