model = new ArticleCategory(); } /** * 获取文章分类列表 * @param array $where * @return array */ public function getPage(array $where = []) { $field = 'category_id, site_id, name, sort, is_show, create_time, update_time'; $order = 'create_time desc'; $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['name'], $where)->field($field)->order($order); return $this->pageQuery($search_model); } /** * 获取文章分类信息 * @param int $id * @return array */ public function getInfo(int $id) { $field = 'category_id, site_id, name, sort, is_show, create_time, update_time'; return $this->model->field($field)->where([['category_id', '=', $id], ['site_id', '=', $this->site_id]])->findOrEmpty()->toArray(); } }