zhangguidong 2 years ago
parent
commit
c15d0f0929
2 changed files with 45 additions and 0 deletions
  1. 44 0
      application/api/controller/Pay.php
  2. 1 0
      application/common/library/Changlian.php

+ 44 - 0
application/api/controller/Pay.php

@@ -568,6 +568,50 @@ class Pay extends Controller
         $this->dealRechargeData($result,'');
     }
     /**
+     * 畅联支付
+     */
+    public function changlianRechargeOrderNotify(){
+        file_put_contents("./callback_log.txt", json_encode($_POST));
+//商户名称
+        $appid  = $_POST['appid'];
+//支付时间戳
+        $callbacks  = $_POST['callbacks'];
+//支付状态
+        $pay_type  = $_POST['pay_type'];
+//支付金额
+        $amount  = $_POST['amount'];
+//支付时提交的订单信息
+        $success_url  = $_POST['success_url'];
+//平台订单交易流水号
+        $error_url  = $_POST['error_url'];
+//该笔交易手续费用
+        $out_trade_no  = $_POST['out_trade_no'];
+//实付金额
+
+//回调时间戳
+        $sign  = $_POST['sign'];
+
+        $data = [
+            'appid'        => $appid,
+            'callbacks'     => $callbacks,
+            'pay_type' => $pay_type,
+            'amount'       => $amount,
+            'success_url'  => $success_url,
+            'error_url'    => $error_url,
+            'out_trade_no'      => $out_trade_no,
+            'sign'      => $sign,
+        ];
+
+//第一步,检测商户appid否一致
+        if ($appid != '你的商户appid') exit('error:appid');
+//第二步,验证签名是否一致
+        if (verifySign($data,'商户密钥') == $sign){
+            echo 'success';
+        } else{
+            exit('error:sign');
+        }
+    }
+    /**
      * 充值余额处理数据库信息
      * @param $result
      * @return bool

+ 1 - 0
application/common/library/Changlian.php

@@ -47,6 +47,7 @@ class Changlian
         $data['sign']=$sign;
 
         $post_data = json_encode($data,320);
+        print_r($post_data);die;
 // print_r($post_data);die;
         $ch = curl_init ();
         $header = [