Explorar el Código

fix error at no "EventKey" field in the post xml message which received from wechat;

kmfish hace 10 años
padre
commit
1ffd8a2a55
Se han modificado 1 ficheros con 10 adiciones y 5 borrados
  1. 10 5
      Thinkphp/Wechat.class.php

+ 10 - 5
Thinkphp/Wechat.class.php

@@ -352,12 +352,17 @@ class Wechat
 	 */
 	public function getRevEvent(){
 		if (isset($this->_receive['Event'])){
-			return array(
-				'event'=>$this->_receive['Event'],
-				'key'=>$this->_receive['EventKey'],
-			);
-		} else 
+			$array['event'] = $this->_receive['Event'];
+		}
+		if (isset($this->_receive['EventKey'])){
+			$array['key'] = $this->_receive['EventKey'];
+		}
+		
+		if (isset($array) && count($array) > 0) {
+			return $array;
+		} else {
 			return false;
+		} 
 	}
 	
 	/**