No Description
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.

Adminlog.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 日志首页
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\controller\auth;
  15. use app\admin\model\Adminlog as AdminlogModel;
  16. use app\common\controller\Adminbase;
  17. class Adminlog extends Adminbase
  18. {
  19. protected $modelClass = null;
  20. protected $childrenAdminIds = [];
  21. protected function initialize()
  22. {
  23. parent::initialize();
  24. $this->modelClass = new AdminlogModel;
  25. $this->childrenAdminIds = $this->auth->getChildrenAdminIds(true);
  26. }
  27. //删除一个月前的操作日志
  28. public function deletelog()
  29. {
  30. AdminlogModel::where('create_time', '<= time', time() - (86400 * 30))->delete();
  31. $this->success("删除日志成功!");
  32. }
  33. /**
  34. * 详情
  35. */
  36. public function detail($id)
  37. {
  38. $row = $this->modelClass->get($id);
  39. if (!$row) {
  40. $this->error('记录未找到');
  41. }
  42. if (!$this->auth->isAdministrator()) {
  43. if (!$row['admin_id'] || !in_array($row['admin_id'], $this->childrenAdminIds)) {
  44. $this->error('你没有权限访问');
  45. }
  46. }
  47. $this->assign("row", $row->toArray());
  48. return $this->fetch();
  49. }
  50. //添加
  51. public function add()
  52. {
  53. $this->error();
  54. }
  55. //编辑
  56. public function edit()
  57. {
  58. $this->error();
  59. }
  60. //批量更新
  61. public function multi()
  62. {
  63. // 管理员禁止批量操作
  64. $this->error();
  65. }
  66. }