Skip to content

Commit

Permalink
[3.1] Custom PreAuthCode Support (#918)
Browse files Browse the repository at this point in the history
Add `$preAuthCode` parameter to function `redirect`
  • Loading branch information
freyo authored and overtrue committed Sep 9, 2017
1 parent b3d26c6 commit 8b9b358
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/OpenPlatform/Api/PreAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ public function getCode()
* Redirect to WeChat PreAuthorization page.
*
* @param string $url
* @param string $preAuthCode
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function redirect($url)
public function redirect($url, $preAuthCode = null)
{
return new RedirectResponse(
sprintf(self::PRE_AUTH_LINK, $this->getAppId(), $this->getCode(), urlencode($url))
sprintf(self::PRE_AUTH_LINK, $this->getAppId(), $preAuthCode ?: $this->getCode(), urlencode($url))
);
}
}

0 comments on commit 8b9b358

Please sign in to comment.