Comment.php 796 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\index\controller\cms;
  3. use app\common\controller\Frontend;
  4. /**
  5. * 我发表的评论
  6. */
  7. class Comment extends Frontend
  8. {
  9. protected $layout = 'default';
  10. protected $noNeedLogin = [];
  11. protected $noNeedRight = ['*'];
  12. /**
  13. * 我的评论
  14. */
  15. public function index()
  16. {
  17. $user_id = $this->auth->id;
  18. $commentList = \addons\cms\model\Comment::where('user_id', $user_id)
  19. ->where('status', 'normal')
  20. ->order('id', 'desc')
  21. ->paginate(10, null);
  22. $this->view->assign('config', array_merge($this->view->config, ['jsname' => '']));
  23. $this->view->assign('commentList', $commentList);
  24. $this->view->assign('title', '我发表的评论');
  25. return $this->view->fetch();
  26. }
  27. }