Skip to content

Commit b88a05f

Browse files
committed
update
1 parent 40122c3 commit b88a05f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Wechat.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace xutl\wechat;
99

10+
use xutl\wechat\oauth\MiniOAuth;
1011
use Yii;
1112
use yii\di\Instance;
1213
use yii\caching\Cache;
@@ -26,7 +27,7 @@
2627
* Class Wechat
2728
* @property OAuth $oauth 公众平台
2829
* @property OAuth $openOAuth 开放平台
29-
* @property OAuth $miniProgram 小程序平台
30+
* @property MiniOAuth $miniProgram 小程序平台
3031
* @property AccessToken $accessToken
3132
* @property Js $js
3233
* @property Notice $notice

src/oauth/MiniOAuth.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77

88
namespace xutl\wechat\oauth;
99

10-
use Yii;
11-
use yii\authclient\OAuth2;
12-
use yii\web\HttpException;
10+
use xutl\authclient\WeChat;
1311

1412
/**
1513
* 微信小程序定制
1614
* @package xutl\wechat\oauth
1715
*/
18-
class MiniOAuth extends OAuth2
16+
class MiniOAuth extends WeChat
1917
{
2018
/**
2119
* @inheritdoc
@@ -27,6 +25,8 @@ class MiniOAuth extends OAuth2
2725
*/
2826
public $useOpenId = true;
2927

28+
private $userParams = [];
29+
3030
/**
3131
* 获取Token
3232
* @param string $authCode
@@ -51,6 +51,7 @@ public function fetchAccessToken($authCode, array $params = [])
5151
$response = $this->sendRequest($request);
5252

5353
$token = $this->createToken(['params' => $response]);
54+
$this->userParams = $response;
5455
$this->setAccessToken($token);
5556

5657
return $token;
@@ -83,6 +84,6 @@ protected function defaultNormalizeUserAttributeMap()
8384
*/
8485
protected function initUserAttributes()
8586
{
86-
return [];
87+
return $this->userParams;
8788
}
8889
}

0 commit comments

Comments
 (0)