You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1003 B
44 lines
1003 B
<?php
|
|
|
|
namespace app\admin\controller\example;
|
|
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 关联模型
|
|
*
|
|
* @icon fa fa-table
|
|
* @remark 当使用到关联模型时需要重载index方法
|
|
*/
|
|
class Relationmodel extends Backend
|
|
{
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = model('AdminLog');
|
|
}
|
|
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->relationSearch = true;
|
|
$this->searchFields = "admin.username,id";
|
|
if ($this->request->isAjax()) {
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
$list = $this->model
|
|
->with("admin")
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->paginate($limit);
|
|
|
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
return json($result);
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
|