Skip to content

Commit 26bf0c1

Browse files
committed
up fix
1 parent cc21b9b commit 26bf0c1

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/OfficialAccount/JsApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class JsApi extends OfficialAccountBase
2020
function auth()
2121
{
2222
if (!isset($this->auth)) {
23-
$this->auth = new Auth($this);
23+
$this->auth = new Auth($this->getOfficialAccount());
2424
}
2525
return $this->auth;
2626
}
2727

2828
function sdk()
2929
{
3030
if (!isset($this->sdk)) {
31-
$this->sdk = new JsSdk($this);
31+
$this->sdk = new JsSdk($this->getOfficialAccount());
3232
}
3333
return $this->sdk;
3434
}

src/OfficialAccount/JsSdk/Auth.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Auth extends JsApiBase
2525
*/
2626
function generateURL(JsAuthRequest $request)
2727
{
28-
$officialAccountConfig = $this->getJsApi()->getOfficialAccount()->getConfig();
28+
$officialAccountConfig = $this->getOfficialAccount()->getConfig();
2929
$appid = $officialAccountConfig->getAppId();
3030
$scope = $request->getType();
3131
$state = $request->getState();
@@ -47,7 +47,7 @@ function generateURL(JsAuthRequest $request)
4747
*/
4848
function codeToToken($authCode): ?SnsAuthBean
4949
{
50-
$officialAccountConfig = $this->getJsApi()->getOfficialAccount()->getConfig();
50+
$officialAccountConfig = $this->getOfficialAccount()->getConfig();
5151
$appid = $officialAccountConfig->getAppId();
5252
$secret = $officialAccountConfig->getAppSecret();
5353
$response = NetWork::getForJson(ApiUrl::generateURL(ApiUrl::JSAPI_CODE_TO_TOKEN, [
@@ -106,7 +106,7 @@ function codeToUser($authCode): ?User
106106
*/
107107
function refreshToken($refreshToken)
108108
{
109-
$officialAccountConfig = $this->getJsApi()->getOfficialAccount()->getConfig();
109+
$officialAccountConfig = $this->getOfficialAccount()->getConfig();
110110
$appid = $officialAccountConfig->getAppId();
111111
$response = NetWork::getForJson(ApiUrl::generateURL(ApiUrl::JSAPI_REFRESH_TOKEN, [
112112
'APPID' => $appid,

src/OfficialAccount/JsSdk/JsApiBase.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
namespace EasySwoole\WeChat\OfficialAccount\JsSdk;
1010

1111

12-
use EasySwoole\WeChat\OfficialAccount\JsApi;
12+
use EasySwoole\WeChat\OfficialAccount\OfficialAccount;
1313

1414
class JsApiBase
1515
{
16-
private $jsApi;
16+
private $officialAccount;
1717

18-
function __construct(JsApi $jsApi)
18+
function __construct(OfficialAccount $account)
1919
{
20-
$this->jsApi = $jsApi;
20+
$this->officialAccount = $account;
2121
}
2222

2323
/**
24-
* @return JsApi
24+
* @return OfficialAccount
2525
*/
26-
protected function getJsApi(): JsApi
26+
protected function getOfficialAccount(): OfficialAccount
2727
{
28-
return $this->jsApi;
28+
return $this->officialAccount;
2929
}
3030
}

src/OfficialAccount/JsSdk/JsSdk.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class JsSdk extends JsApiBase
1919
function jsTicket():JsTicketInterface
2020
{
2121
if(!isset($this->ticket)){
22-
$this->ticket = new JsTicket($this->getJsApi());
22+
$this->ticket = new JsTicket($this->getOfficialAccount());
2323
}
2424
return $this->ticket;
2525
}
@@ -32,7 +32,7 @@ function jsTicket():JsTicketInterface
3232
*/
3333
function signature(string $url)
3434
{
35-
$officialAccountConfig = $this->getJsApi()->getOfficialAccount()->getConfig();
35+
$officialAccountConfig = $this->getOfficialAccount()->getConfig();
3636
// 组装签名参数包
3737
$pack = [
3838
'noncestr' => $this->generateNonce(16),

0 commit comments

Comments
 (0)