Log.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 海豚PHP框架 [ DolphinPHP ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2016~2019 广东卓锐软件有限公司 [ http://www.zrthink.com ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://dolphinphp.com
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\model;
  10. use think\Model;
  11. /**
  12. * 日志记录模型
  13. * @package app\admin\model
  14. */
  15. class Log extends Model
  16. {
  17. // 设置当前模型对应的完整数据表名称
  18. protected $name = 'admin_log';
  19. // 自动写入时间戳
  20. protected $autoWriteTimestamp = true;
  21. /**
  22. * 获取所有日志
  23. * @param array $map 条件
  24. * @param string $order 排序
  25. * @author 蔡伟明 <314013107@qq.com>
  26. * @return \think\Paginator
  27. * @throws \think\exception\DbException
  28. */
  29. public static function getAll($map = [], $order = '')
  30. {
  31. $data_list = self::view('admin_log', true)
  32. ->view('admin_action', 'title,module', 'admin_action.id=admin_log.action_id', 'left')
  33. ->view('admin_user', 'username', 'admin_user.id=admin_log.user_id', 'left')
  34. ->view('admin_module', ['title' => 'module_title'], 'admin_module.name=admin_action.module')
  35. ->where($map)
  36. ->order($order)
  37. ->paginate();
  38. return $data_list;
  39. }
  40. }