浏览代码

debug ali fee

stanley-king 9 年之前
父节点
当前提交
595686f7ae
共有 1 个文件被更改,包括 5 次插入9 次删除
  1. 5 9
      mobile/api/payment/alipay/lib/alipay_rsa.function.php

+ 5 - 9
mobile/api/payment/alipay/lib/alipay_rsa.function.php

@@ -37,18 +37,14 @@ function rsaVerify($data, $ali_public_key_path, $sign)
     Log::record("pub key path={$ali_public_key_path}",Log::DEBUG);
 
 	$pubKey = file_get_contents($ali_public_key_path);
-    try{
-        $res = openssl_get_publickey($pubKey);
-    } catch(Exception $e){
-        $msg = $e->getMessage();
-    }
-    Log::record("sign={$sign}",Log::DEBUG);
-
+    $res = openssl_get_publickey($pubKey);
     $sign = urldecode($sign);
     $sign = base64_decode($sign);
     $result = (bool)openssl_verify($data, $sign, $res);
-    $err = openssl_error_string();
-    Log::record("openssl last error={$err}",Log::DEBUG);
+    if($result == false) {
+        $err = openssl_error_string();
+        Log::record("openssl last error={$err}",Log::DEBUG);
+    }
     openssl_free_key($res);
     return $result;
 }