diff --git a/app/admin/controller/Wxserve.php b/app/admin/controller/Wxserve.php index efd28a03..54f708e1 100644 --- a/app/admin/controller/Wxserve.php +++ b/app/admin/controller/Wxserve.php @@ -81,11 +81,13 @@ class Wxserve extends Controller */ public function templatedraftlist(): Json { + $type = intval($this->request->get('type', 0)); $obj = new Server(); - $list = $obj->getTemplateDraftList(); + $list = $obj->getTemplateDraftList($type); return $this->renderSuccess($list); } + /** * @notes:添加草稿到模板中 * @return Json @@ -111,8 +113,9 @@ class Wxserve extends Controller */ public function templatelist(): Json { + $type = intval($this->request->get('type', 0)); $obj = new Server(); - $list = $obj->getTemplatelist(); + $list = $obj->getTemplatelist($type); return $this->renderSuccess($list); } diff --git a/app/common/library/wxserver/Server.php b/app/common/library/wxserver/Server.php index cf497b26..9b935486 100644 --- a/app/common/library/wxserver/Server.php +++ b/app/common/library/wxserver/Server.php @@ -237,9 +237,9 @@ class Server * @return array|mixed * @author: wanghousheng */ - public function getTemplatedraftlist() + public function getTemplatedraftlist($type) { - if (Cache::has('wx_server_drafttemplatelist')) { + if (!$type && Cache::has('wx_server_drafttemplatelist')) { return Cache::get('wx_server_drafttemplatelist'); } $token = $this->getComponentAccessToken(); @@ -318,12 +318,13 @@ class Server /** * @notes:代码模板列表 + * @param $type * @return array * @author: wanghousheng */ - public function getTemplatelist(): array + public function getTemplatelist($type): array { - if (Cache::has('wx_server_templatelist')) { + if (!$type && Cache::has('wx_server_templatelist')) { return Cache::get('wx_server_templatelist'); } $token = $this->getComponentAccessToken();