| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 | 
							- <?php
 
- /*
 
-  * This file is part of the overtrue/wechat.
 
-  *
 
-  * (c) overtrue <i@overtrue.me>
 
-  *
 
-  * This source file is subject to the MIT license that is bundled
 
-  * with this source code in the file LICENSE.
 
-  */
 
- namespace EasyWeChat\OfficialAccount\Comment;
 
- use EasyWeChat\Kernel\BaseClient;
 
- /**
 
-  * Class Client.
 
-  *
 
-  * @author overtrue <i@overtrue.me>
 
-  */
 
- class Client extends BaseClient
 
- {
 
-     /**
 
-      * Open article comment.
 
-      *
 
-      * @param string   $msgId
 
-      * @param int|null $index
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function open(string $msgId, int $index = null)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/open', $params);
 
-     }
 
-     /**
 
-      * Close comment.
 
-      *
 
-      * @param string   $msgId
 
-      * @param int|null $index
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function close(string $msgId, int $index = null)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/close', $params);
 
-     }
 
-     /**
 
-      * Get article comments.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $begin
 
-      * @param int    $count
 
-      * @param int    $type
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function list(string $msgId, int $index, int $begin, int $count, int $type = 0)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'begin' => $begin,
 
-             'count' => $count,
 
-             'type' => $type,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/list', $params);
 
-     }
 
-     /**
 
-      * Mark elect comment.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $commentId
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function markElect(string $msgId, int $index, int $commentId)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'user_comment_id' => $commentId,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/markelect', $params);
 
-     }
 
-     /**
 
-      * Unmark elect comment.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $commentId
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function unmarkElect(string $msgId, int $index, int $commentId)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'user_comment_id' => $commentId,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/unmarkelect', $params);
 
-     }
 
-     /**
 
-      * Delete comment.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $commentId
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function delete(string $msgId, int $index, int $commentId)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'user_comment_id' => $commentId,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/delete', $params);
 
-     }
 
-     /**
 
-      * Reply to a comment.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $commentId
 
-      * @param string $content
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function reply(string $msgId, int $index, int $commentId, string $content)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'user_comment_id' => $commentId,
 
-             'content' => $content,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/reply/add', $params);
 
-     }
 
-     /**
 
-      * Delete a reply.
 
-      *
 
-      * @param string $msgId
 
-      * @param int    $index
 
-      * @param int    $commentId
 
-      *
 
-      * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
 
-      */
 
-     public function deleteReply(string $msgId, int $index, int $commentId)
 
-     {
 
-         $params = [
 
-             'msg_data_id' => $msgId,
 
-             'index' => $index,
 
-             'user_comment_id' => $commentId,
 
-         ];
 
-         return $this->httpPostJson('cgi-bin/comment/reply/delete', $params);
 
-     }
 
- }
 
 
  |