setDefault( ['pageSize' => $this->options->commentsListSize, 'parentId' => 0, 'ignoreAuthor' => false] ); } /** * 执行函数 * * @throws Exception */ public function execute() { $select = $this->select()->limit($this->parameter->pageSize) ->where('table.comments.status = ?', 'approved') ->order('table.comments.coid', Db::SORT_DESC); if ($this->parameter->parentId) { $select->where('cid = ?', $this->parameter->parentId); } if ($this->options->commentsShowCommentOnly) { $select->where('type = ?', 'comment'); } /** 忽略作者评论 */ if ($this->parameter->ignoreAuthor) { $select->where('ownerId <> authorId'); } $this->db->fetchAll($select, [$this, 'push']); } }