Browse Source

Merge pull request #199 from binsee/patch

修复bug: Prpcrypt类 兼容构造函数 位置顺序问题导致报错
dodge 10 years ago
parent
commit
c61d30e177
2 changed files with 13 additions and 13 deletions
  1. 6 6
      qywechat.class.php
  2. 7 7
      wechat.class.php

+ 6 - 6
qywechat.class.php

@@ -937,7 +937,7 @@ class Wechat
 		if (!$appid) $appid = $this->appid;
 		if ($jsapi_ticket) { //手动指定token,优先使用
 		    $this->jsapi_ticket = $jsapi_ticket;
-		    return $this->access_token;
+		    return $this->jsapi_ticket;
 		}
 		$authname = 'qywechat_jsapi_ticket'.$appid;
 		if ($rs = $this->getCache($authname))  {
@@ -2087,18 +2087,18 @@ class Prpcrypt
 {
     public $key;
 
+    function __construct($k) {
+        $this->key = base64_decode($k . "=");
+    }
+
     /**
-     * 兼容老版本php构造函数
+     * 兼容老版本php构造函数,不能在 __construct() 方法前边,否则报错
      */
     function Prpcrypt($k)
     {
         $this->key = base64_decode($k . "=");
     }
 
-    function __construct($k) {
-        $this->key = base64_decode($k . "=");
-    }
-
     /**
      * 对明文进行加密
      * @param string $text 需要加密的明文

+ 7 - 7
wechat.class.php

@@ -501,7 +501,7 @@ class Wechat
 	 */
 	public function getRevScanInfo(){
 		if (isset($this->_receive['ScanCodeInfo'])){
-		    if (!is_array($this->_receive['SendPicsInfo'])) {
+		    if (!is_array($this->_receive['ScanCodeInfo'])) {
 		        $array=(array)$this->_receive['ScanCodeInfo'];
 		        $this->_receive['ScanCodeInfo']=$array;
 		    }else {
@@ -1208,7 +1208,7 @@ class Wechat
 		if (!$appid) $appid = $this->appid;
 		if ($jsapi_ticket) { //手动指定token,优先使用
 		    $this->jsapi_ticket = $jsapi_ticket;
-		    return $this->access_token;
+		    return $this->jsapi_ticket;
 		}
 		$authname = 'wechat_jsapi_ticket'.$appid;
 		if ($rs = $this->getCache($authname))  {
@@ -3210,18 +3210,18 @@ class Prpcrypt
 {
     public $key;
 
+    function __construct($k) {
+        $this->key = base64_decode($k . "=");
+    }
+
     /**
-     * 兼容老版本php构造函数
+     * 兼容老版本php构造函数,不能在 __construct() 方法前边,否则报错
      */
     function Prpcrypt($k)
     {
         $this->key = base64_decode($k . "=");
     }
 
-    function __construct($k) {
-        $this->key = base64_decode($k . "=");
-    }
-
     /**
      * 对明文进行加密
      * @param string $text 需要加密的明文