1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\admin\controller\example;
- use app\common\controller\Backend;
- /**
- * 表格完整示例
- *
- * @icon fa fa-table
- * @remark 在使用Bootstrap-table中的常用方式,更多使用方式可查看:http://bootstrap-table.wenzhixin.net.cn/zh-cn/
- */
- class Bootstraptable extends Backend
- {
- protected $model = null;
- protected $noNeedRight = ['change', 'detail'];
- public function _initialize()
- {
- parent::_initialize();
- $this->model = model('AdminLog');
- }
- /**
- * 查看
- */
- public function index()
- {
- if ($this->request->isAjax())
- {
- list($where, $sort, $order, $offset, $limit) = $this->buildparams(NULL);
- $total = $this->model
- ->where($where)
- ->order($sort, $order)
- ->count();
- $list = $this->model
- ->where($where)
- ->order($sort, $order)
- ->limit($offset, $limit)
- ->select();
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
- /**
- * 详情
- */
- public function detail($ids)
- {
- $row = $this->model->get(['id' => $ids]);
- if (!$row)
- $this->error(__('No Results were found'));
- $this->view->assign("row", $row->toArray());
- return $this->view->fetch();
- }
- /**
- * 变更
- * @internal
- */
- public function change()
- {
- $this->code = 1;
- }
- }
|