SystemLog.php 1.1 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\user\controller;
  3. use think\App;
  4. class SystemLog extends Base{
  5. public function __construct(App $app) {
  6. $this->noLogin=["*"];
  7. parent::__construct($app);
  8. $this->model = new \app\user\model\SystemLog();
  9. }
  10. public function list(){
  11. $params = $this->request->param(["system"=>"","controller"=>"","action"=>"","uid"=>'',"page"=>1,"size"=>10,
  12. "start"=>"","end"=>""],"post","trim");
  13. $where=[];
  14. if($params['system']!='') $where[]=['system','=',$params['system']];
  15. if($params['controller']!='') $where[]=['controller','=',$params['controller']];
  16. if($params['action']!='') $where[]=['action','=',$params['action']];
  17. if($params['uid']!='') $where[]=['action_id','=',$params['uid']];
  18. if($params['start']!='' && $params['end']!=''){
  19. $where[]=['createTime','between',[$params['start'],$params['end']]];
  20. }
  21. $list = $this->model->where($where)->order('id desc')
  22. ->paginate(["page"=>$params['page'],"list_rows"=>$params['size']]);
  23. return success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
  24. }
  25. }