💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
完整代码 ~~~ <?php namespace plugins\d_comment; use cmf\lib\Plugin; class DCommentPlugin extends Plugin { public $info=[ 'name'=>'DComment', 'title'=>'D之食卓评论插件', 'description'=>'基于官网评论插件', 'status'=>1, 'version'=>'1.0.0', ]; public $hasAdmin = 1; public function install() { // TODO: Implement install() method. return true; } public function uninstall() { // TODO: Implement uninstall() method. return false; } public function dcomment($param) { $commentModel = new CommentModel(); $comments = $commentModel ->where([ "table_name" => $param['table_name'], "object_id" => $param['object_id'], "status" => 1, ]) ->order('create_time DESC') ->paginate(10, false, ['var_page' => 'comment_page']); $config = $this->getConfig(); $this->assign($config); $this->assign('param', $param); $this->assign('user', cmf_get_current_user()); $this->assign('comments', $comments); $this->assign('page', $comments->render()); return $this->fetch('widget'); } } ~~~