yingzi 2 anni fa
parent
commit
e4b6122f6f
3 ha cambiato i file con 30 aggiunte e 3 eliminazioni
  1. 9 2
      app/api/controller/Pay.php
  2. 2 1
      app/api/controller/Pub.php
  3. 19 0
      library/utils/WxpayV2.php

+ 9 - 2
app/api/controller/Pay.php

@@ -6,7 +6,7 @@ use app\Request;
 use app\BaseController;
 use app\model\api\PayTrade;
 use library\services\UtilService;
-use library\utils\weixinPay as wxpayApi;
+use library\utils\WxpayV2 as wxpayApi;
 use WeChatPay\Transformer;
 use app\lib\OrderLib;
 use think\Exception;
@@ -25,7 +25,14 @@ class Pay extends BaseController{
             return false;
         }
         file_put_contents($logfile, $xmlData.PHP_EOL,FILE_APPEND | LOCK_EX);
-        
+        $wxpay = new wxpayApi();
+        $res = $wxpay->notifyCheckSign($xmlData);
+        if(!$res){
+            return false;
+        }
+//        if($res["return_code"] && $res["return_code"]=""){
+//            return false;
+//        }
         
         
         

+ 2 - 1
app/api/controller/Pub.php

@@ -289,7 +289,8 @@ class Pub extends BaseController
 </xml>";
         
         $wxpay = new wxpayApi();
-        $r = $wxpay->notifyCheckSign($xml);
+//        $r = $wxpay->notifyCheckSign($xml);
+        $r = $wxpay->searchOrderQuery("A202304201681959554328879382");
         var_dump($r);
         
         

+ 19 - 0
library/utils/WxpayV2.php

@@ -117,6 +117,25 @@ class WxpayV2{
         return $buff;
     }
     
+    /**
+     * 订单查询
+     * @param type $out_trade_no
+     */
+    public function searchOrderQuery($out_trade_no){
+        $apiUrl = "v2/pay/orderquery";
+        $result = $this->clientHttp("POST", $apiUrl, [
+            'appid'            => $this->config["APPID"], // 小程序ID/微信开放平台审核通过的应用APPID
+            'mch_id'           => $this->config["MCHID"], // 商户号
+            "out_trade_no"     =>$out_trade_no,
+            'nonce_str'        => Formatter::nonce(), // 32位随机字符串
+        ]);
+        return $result;
+//        var_dump($result);
+        
+    }
+    
+    
+    
     
     /**
      * 查询订单