File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change 99namespace EasySwoole \WeChat \OfficialAccount \JsSdk ;
1010
1111
12- use EasySwoole \WeChat \OfficialAccount \JsApi ;
12+ use EasySwoole \WeChat \OfficialAccount \OfficialAccount ;
1313
1414class 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}
Original file line number Diff line number Diff 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 ),
You can’t perform that action at this time.
0 commit comments