AdminLog.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\admin\controller\auth;
  3. use app\common\controller\Backend;
  4. use app\admin\model\AdminLog as AdminLogModel;
  5. class AdminLog extends Backend
  6. {
  7. /**
  8. * @var AdminLogModel
  9. */
  10. protected $model = null;
  11. protected $preExcludeFields = ['createtime', 'admin_id', 'username'];
  12. protected $quickSearchField = ['title'];
  13. public function initialize()
  14. {
  15. parent::initialize();
  16. $this->model = new AdminLogModel();
  17. }
  18. /**
  19. * 查看
  20. */
  21. public function index()
  22. {
  23. $this->request->filter(['strip_tags', 'trim']);
  24. if ($this->request->param('select')) {
  25. $this->select();
  26. }
  27. list($where, $alias, $limit, $order) = $this->queryBuilder();
  28. if (!$this->auth->isSuperAdmin()) {
  29. $where[] = ['admin_id', '=', $this->auth->id];
  30. }
  31. $res = $this->model
  32. ->withJoin($this->withJoinTable, $this->withJoinType)
  33. ->alias($alias)
  34. ->where($where)
  35. ->order($order)
  36. ->paginate($limit);
  37. $this->success('', [
  38. 'list' => $res->items(),
  39. 'total' => $res->total(),
  40. 'remark' => get_route_remark(),
  41. ]);
  42. }
  43. }