hrjy 2 yıl önce
ebeveyn
işleme
0c6291d5f7
1 değiştirilmiş dosya ile 6 ekleme ve 29 silme
  1. 6 29
      crmeb/services/GmService.php

+ 6 - 29
crmeb/services/GmService.php

@@ -29,12 +29,12 @@ class GmService
     protected static $iv = 'abcdefghABCDEFGH';
     protected static $appID = "3f1a51c1-39d4-48e1-8119-a37b63c0ed8c";
     protected static $appSecretKey = "66a81e7a-dea3-4870-9c63-58712e13aa9b";
-    protected static $tokenUrl = "https://mouldai.com/api/HOGENDY";//回归环境
+    protected static $tokenUrl = "https://tlop.zjtlcb.com/api/HOGENDY";//回归环境
     protected static $token;
     //合作机构自有公钥
-    const PUBLIC_KEY = "";
+    const PUBLIC_KEY = "DE3w4DgjV+np0oHQzSDUgvlxGKPhi/gHBRp8dtjun+z6uqrRJE6B1qswZpaSCs3tp0tm98ZjjL9RTuNh4dyUuA==";
     //合作机构自有私钥
-    const PRIVATE_KEY = "";
+    const PRIVATE_KEY = "778NKKZgdS9IGm/crvajNPoq5CHJNEKXptciF/1SU3I=";
     //泰隆银行公钥
     const CGB_PUBLIC_KEY = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE6mJz31IQpqtv42a67pfUe6q6UKUa/Lxf2rzJC4iAK0p3dOooG/d+N2fs6qmzK+7smovqcP7VhA8D+OIvaVjMsw==";
 
@@ -94,7 +94,7 @@ class GmService
 //        dump($data);
 //        exit;
         //发送post接口请求
-        $res = self::do_request(self::$tokenUrl, $data);
+        $res = self::https_post(self::$tokenUrl, $data);
 
         //解密返回token数据
         $token = self::SM2Decrypt(base64_decode($res['sm2EncryptData']), $k1);
@@ -158,7 +158,7 @@ class GmService
         dump($json);
         dump("请求数据");
         dump($data);
-        $res = self::https_post("https://mouldai.com/api/HOGENDY/scanPaymentCode", $data);
+        $res = self::https_post("https://mouldai.com/apiSIT/tzyj/scanPaymentCode", $data);
 
         //解密sm2密钥
         $sm2Key = self::SM2Decrypt(base64_decode($res['sm2EncryptData']), $k1);
@@ -384,7 +384,7 @@ class GmService
     private static function https_post($url, $data = null)
     {
         $data = json_encode($data, JSON_UNESCAPED_SLASHES);
-        $header[] = 'Content-Type:application/x-www-form-urlencoded';
+        $header [] = 'Content-Type:application/x-www-form-urlencoded';
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
         curl_setopt($ch, CURLOPT_URL, $url);
@@ -401,29 +401,6 @@ class GmService
         return json_decode($tmpInfo, true);
     }
 
-    private static function do_request($url, $data)
-    {
-        $data = json_encode($data, JSON_UNESCAPED_SLASHES);
-        $header[] = 'Content-Type:application/x-www-form-urlencoded';
-        $curl = curl_init();
-        curl_setopt($curl, CURLOPT_URL, $url);
-        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
-        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($curl, CURLOPT_POST, 1);
-        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
-        if ($header) {
-            curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
-            curl_setopt($curl, CURLOPT_HEADER, 0);
-        }
-        $result = curl_exec($curl);
-        if (curl_errno($curl)) {
-            return json_encode(['status' => curl_errno($curl), 'msg' => '请求失败']);
-        }
-        curl_close($curl);
-        return $result;
-    }
-
     /**
      * 获得随机字符串
      **/