67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\user4s;
|
|
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 用户分组
|
|
*
|
|
* @icon fa fa-circle-o
|
|
*/
|
|
class Category extends Backend
|
|
{
|
|
|
|
/**
|
|
* Category模型对象
|
|
* @var \app\common\model\user4s\Category
|
|
*/
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \app\common\model\user4s\Category;
|
|
$this->view->assign("statusList", $this->model->getStatusList());
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
|
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
|
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
|
*/
|
|
/**
|
|
* Selectpage搜索
|
|
*
|
|
* @internal
|
|
*/
|
|
public function selectpage()
|
|
{
|
|
//$this->request['showField']='name';
|
|
return parent::selectpage();
|
|
}
|
|
/**
|
|
* 搜索下拉列表
|
|
*/
|
|
public function searchlist()
|
|
{
|
|
$result = $this->model->limit(10)->select();
|
|
$searchlist = [];
|
|
foreach ($result as $key => $value) {
|
|
$searchlist[] = ['id' => $value['id'], 'name' => $value['name']];
|
|
}
|
|
$data = ['searchlist' => $searchlist];
|
|
$this->success('', null, $data);
|
|
}
|
|
public function del($ids = null)
|
|
{
|
|
$ids = $ids ? $ids : $this->request->post("ids");
|
|
if ($ids == 1 || in_array(1, $ids)) {
|
|
$this->error('系统默认等级不能删除!');
|
|
}
|
|
return parent::del($ids);
|
|
}
|
|
}
|