From 331dcaa3256fd1c6d03fe7ec25c8488a0c829ceb Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 16 Mar 2020 19:16:32 +0800 Subject: [PATCH] add clear --- wchat/officialaccount/Tag.php | 56 ++++++++--------------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/wchat/officialaccount/Tag.php b/wchat/officialaccount/Tag.php index fa88db7..4175fa5 100644 --- a/wchat/officialaccount/Tag.php +++ b/wchat/officialaccount/Tag.php @@ -27,13 +27,10 @@ class Tag extends AfficialAccount $config = $this->config->getAccessToken(); - $result = $this->request->post($this->generate_url . $config, $params); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + + return $this->request->post($this->generate_url . $config, $params); } /** @@ -49,13 +46,11 @@ class Tag extends AfficialAccount $config = $this->config->getAccessToken(); - $result = $this->request->post($this->tag_edit . $config, $url); + $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + + return $this->request->post($this->tag_edit . $config, $url); } @@ -70,14 +65,9 @@ class Tag extends AfficialAccount $url['tag[id]'] = $id; $config = $this->config->getAccessToken(); - - $result = $this->request->post($this->tag_delete . $config, $url); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->post($this->tag_delete . $config, $url); } @@ -94,13 +84,9 @@ class Tag extends AfficialAccount $config = $this->config->getAccessToken(); - $result = $this->request->post($this->user_batch_add_tag . $config, $url); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->post($this->user_batch_add_tag . $config, $url); } @@ -117,13 +103,9 @@ class Tag extends AfficialAccount $config = $this->config->getAccessToken(); - $result = $this->request->post($this->user_batch_remove_tag . $config, $url); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->post($this->user_batch_remove_tag . $config, $url); } @@ -135,13 +117,9 @@ class Tag extends AfficialAccount { $config = $this->config->getAccessToken(); - $result = $this->request->get($this->tag_lists . $config); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->get($this->tag_lists . $config); } @@ -152,13 +130,9 @@ class Tag extends AfficialAccount public function tag_fans_list() { $config = $this->config->getAccessToken(); - $result = $this->request->get($this->tag_fans_list . $config); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->get($this->tag_fans_list . $config); } @@ -170,15 +144,11 @@ class Tag extends AfficialAccount public function user_tag($openid) { $config = $this->config->getAccessToken(); - $result = $this->request->post($this->user_tag . $config, [ - 'openid' => $openid - ]); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); - if (!$result->isResultsOK()) { - throw new \Exception($result->getMessage()); - } - return $result->getData(); + return $this->request->post($this->user_tag . $config, [ + 'openid' => $openid + ]); } }