<?php namespace admin; class WorkSpacesController extends BaseController { function indexAction() { $operator_id = $this->session->get('operator_id'); $operator = \Operators::findById($operator_id); $params = []; if ($operator->isAdmin()) { $params['article'] = [ 'article[operator_id_eq]' => $operator->id ]; } debug($params); $this->view->article_link = '<a href="/admin/workspaces/articlelist?' . http_build_query($params['article']) . '">我的文章</a>'; $this->view->comment_link = '<a href="/admin/workspaces/? ">我的评论</a>'; } function articlelistAction() { $page = $this->params('page'); $cond = $this->getConditions('article'); $cond['order'] = 'id desc'; $articles = \Articles::findPagination($cond, $page); $this->view->articles = $articles; foreach($articles as $article){ debug($article); } $this->pick('admin/articles/list'); } function commentAction() { $page = $this->params('page'); $cond = $this->getConditions('comment'); $cond['order'] = 'id desc'; $comments = \Comments::findPagination($cond, $page); $this->view->comments = $comments; $this->pick('/admin/comments/list'); } }
Phalcon 框架随笔
最新推荐文章于 2021-09-12 17:08:00 发布