12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\admin\controller;
- /**
- * 日志
- */
- class Log extends Admin{
- protected $Log = null;
- protected function _initialize(){
- parent::_initialize();
- $this->Log = model('Log');
- }
- public function index(){
- $this->assign('meta_title','日志列表');
- return $this->fetch();
- }
- public function load(){
- $where = [];
- $position = input('param.position');
- $where['position'] = $position;
- $page = input('get.page');
- $limit = input('get.limit');
- $list = $this->Log->where($where)->order('create_time desc')->paginate($limit,false,['page'=>$page]);
- $data = [];
- foreach ($list as $key => $value) {
- $data[$key]['id'] = $value['id'];
- $user = $value['user'];
- $data[$key]['user'] = $user['name'].'['.$user['id'].']';
- $data[$key]['action'] = $value['action'];
- $data[$key]['action_text'] = $value['action_text'];
- $data[$key]['create_time'] = $value['create_time'];
- }
- $this->output(0,'加载成功',$data,$list->total());
- }
- //
- public function params(){
- $id = input('get.id');
- $log = $this->Log->where(['id'=>$id])->find();
- if (!$log) {
- $this->error('参数错误');
- }
- $this->assign('log',$log);
- $this->assign('meta_title','查看参数');
- return $this->fetch();
- }
- }
|