Skip to content

Commit de57c9e

Browse files
author
EZ
committed
Merge branch 'master' of https://github.com/easy-swoole/wechat
2 parents cc892dd + ce0745d commit de57c9e

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/MiniProgram/MiniProgram.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class MiniProgram
1717
private $accessToken;
1818
private $qrCode;
1919
private $templateMsg;
20+
private $subscribeMsg;
2021

2122
public function __construct(MiniProgramConfig $config = null)
2223
{
@@ -105,4 +106,16 @@ public function templateMsg(): TemplateMsg
105106

106107
return $this->templateMsg;
107108
}
109+
110+
/**
111+
* @return SubscribeMsg
112+
*/
113+
public function subscribeMsg():SubscribeMsg
114+
{
115+
if (!isset($this->subscribeMsg)) {
116+
$this->subscribeMsg = new SubscribeMsg($this);
117+
}
118+
119+
return $this->subscribeMsg;
120+
}
108121
}

src/MiniProgram/SubscribeMsg.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SubscribeMsg extends MinProgramBase
2323
*/
2424
public function getCategory()
2525
{
26-
$token = $this->miniProgram()->accessToken()->getToken();
26+
$token = $this->getMiniProgram()->accessToken()->getToken();
2727
$url = ApiUrl::generateURL(ApiUrl::GET_CATEGORY, [
2828
'ACCESS_TOKEN' => $token
2929
]);
@@ -45,7 +45,7 @@ public function getCategory()
4545
*/
4646
public function getPubTemplateTitleList(array $data)
4747
{
48-
$token = $this->miniProgram()->accessToken()->getToken();
48+
$token = $this->getMiniProgram()->accessToken()->getToken();
4949
$url = ApiUrl::generateURL(ApiUrl::GET_PUB_TEMPLATE_TITLES, [
5050
'ACCESS_TOKEN' => $token
5151
]);
@@ -67,7 +67,7 @@ public function getPubTemplateTitleList(array $data)
6767
*/
6868
public function getPubTemplateKeyWordsById(array $data)
6969
{
70-
$token = $this->miniProgram()->accessToken()->getToken();
70+
$token = $this->getMiniProgram()->accessToken()->getToken();
7171
$url = ApiUrl::generateURL(ApiUrl::GET_PUB_TEMPLATE_KEYWORDS, [
7272
'ACCESS_TOKEN' => $token
7373
]);
@@ -88,7 +88,7 @@ public function getPubTemplateKeyWordsById(array $data)
8888
*/
8989
public function deleteTemplate(string $priTmplId)
9090
{
91-
$token = $this->miniProgram()->accessToken()->getToken();
91+
$token = $this->getMiniProgram()->accessToken()->getToken();
9292
$url = ApiUrl::generateURL(ApiUrl::DEL_TEMPLATE, [
9393
'ACCESS_TOKEN' => $token
9494
]);
@@ -109,7 +109,7 @@ public function deleteTemplate(string $priTmplId)
109109
*/
110110
public function addTemplate(array $data)
111111
{
112-
$token = $this->miniProgram()->accessToken()->getToken();
112+
$token = $this->getMiniProgram()->accessToken()->getToken();
113113
$url = ApiUrl::generateURL(ApiUrl::ADD_TEMPLATE, [
114114
'ACCESS_TOKEN' => $token
115115
]);
@@ -130,7 +130,7 @@ public function addTemplate(array $data)
130130
*/
131131
public function getTemplateList()
132132
{
133-
$token = $this->miniProgram()->accessToken()->getToken();
133+
$token = $this->getMiniProgram()->accessToken()->getToken();
134134
$url = ApiUrl::generateURL(ApiUrl::GET_TEMPLATE, [
135135
'ACCESS_TOKEN' => $token
136136
]);
@@ -152,7 +152,7 @@ public function getTemplateList()
152152
*/
153153
public function sendMsg(array $data)
154154
{
155-
$token = $this->miniProgram()->accessToken()->getToken();
155+
$token = $this->getMiniProgram()->accessToken()->getToken();
156156
$url = ApiUrl::generateURL(ApiUrl::SUBSCRIBE_SEND, [
157157
'ACCESS_TOKEN' => $token
158158
]);

0 commit comments

Comments
 (0)