51 行
1.2 KiB
PHP
51 行
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 技能分类管理
|
|
*
|
|
* @icon fa fa-th-large
|
|
*/
|
|
class SkillCategory extends Backend
|
|
{
|
|
/**
|
|
* SkillCategory模型对象
|
|
* @var \app\admin\model\SkillCategory
|
|
*/
|
|
protected $model = null;
|
|
protected $searchFields = 'id,name';
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \app\admin\model\SkillCategory;
|
|
$this->view->assign("statusList", $this->model->getStatusList());
|
|
}
|
|
|
|
/**
|
|
* 查看分类列表
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
if (false === $this->request->isAjax()) {
|
|
return $this->view->fetch();
|
|
}
|
|
if ($this->request->request('keyField')) {
|
|
return $this->selectpage();
|
|
}
|
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
$list = $this->model
|
|
->withCount('skills')
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->paginate($limit);
|
|
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
return json($result);
|
|
}
|
|
}
|