dever 2 years ago
parent
commit
77c8538a73
1 changed files with 19 additions and 12 deletions
  1. 19 12
      lib/Client.php

+ 19 - 12
lib/Client.php

@@ -12,7 +12,7 @@ class Client extends Base
 	 * @desc prefix
 	 * @var string
 	 */
-	private $prefix = 'v3_';
+	private $prefix = 'v5_';
 
 	/**
 	 * @desc account
@@ -44,12 +44,6 @@ class Client extends Base
 	 */
 	private $config = null;
 
-	/**
-	 * @desc refer_param
-	 * @var array
-	 */
-	private $refer_param = array();
-
 	public function __construct()
 	{
 		parent::__construct();
@@ -146,8 +140,22 @@ class Client extends Base
 			if (!strstr($refer, 'http')) {
 				return $result;
 			}
-			if ($this->refer_param) {
-				$param = http_build_query($this->refer_param);
+
+			$param = array();
+
+			if ($this->get) {
+				$key = $this->get;
+				if ($key == 'all') {
+					$param = $result;
+				} elseif (isset($result['oauth'][$key])) {
+					$param[$key] = $result['oauth'][$key];
+				} elseif (isset($result[$key])) {
+					$param[$key] = $result[$key];
+				}
+			}
+
+			if ($param) {
+				$param = http_build_query($param);
 				if (strstr($refer, '?')) {
 					$refer .= '&' . $param;
 				} else {
@@ -299,9 +307,6 @@ class Client extends Base
 	 */
 	private function update($data, $id)
 	{
-		if ($this->get && isset($data[$this->get])) {
-			$this->refer_param[$this->get] = $data[$this->get];
-		}
         $this->param('user', 'access_token', $data['access_token']);
 		$this->param('user', 'openid', $data['openid']);
 
@@ -335,6 +340,8 @@ class Client extends Base
 
     	$user = $this->passport->wechat($data, $user, $this->account, $this->system, $this->source_type, $this->system_source, $this->source, $this->invite, $uid);
 
+    	$user['oauth'] = $data;
+
         return $user;
 	}