12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\api\controller;
-
- use app\api\logic\CommunityCommentLogic;
- use app\api\validate\CommunityCommentValidate;
- use app\common\basics\Api;
- use app\common\server\JsonServer;
-
-
-
- class CommunityComment extends Api
- {
-
- public $like_not_need_login = ['lists'];
-
-
-
- public function lists()
- {
- $get = (new CommunityCommentValidate())->goCheck('lists');
- $result = CommunityCommentLogic::getCommentLists($this->user_id, $get, $this->page_no, $this->page_size);
- return JsonServer::success('', $result);
- }
-
-
-
-
-
- public function add()
- {
- $post = $this->request->post();
- (new CommunityCommentValidate())->goCheck('add');
- $result = CommunityCommentLogic::addComment($this->user_id, $post);
- if(false === $result) {
- return JsonServer::error(CommunityCommentLogic::getError() ?: '评论失败');
- }
- return JsonServer::success($result['msg'], $result['data']);
- }
-
-
-
-
- public function commentChild()
- {
- $get = $this->request->get();
- $result = CommunityCommentLogic::getChildComment($this->user_id, $get, $this->page_no, $this->page_size);
- return JsonServer::success('', $result);
- }
-
-
- }
|