AdminLog.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------------------------------
  4. * GouGuOPEN [ 左手研发,右手开源,未来可期!]
  5. +-----------------------------------------------------------------------------------------------
  6. * @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
  7. +-----------------------------------------------------------------------------------------------
  8. * @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
  9. +-----------------------------------------------------------------------------------------------
  10. * @Author 勾股工作室 <hdm58@qq.com>
  11. +-----------------------------------------------------------------------------------------------
  12. */
  13. declare (strict_types = 1);
  14. namespace app\home\model;
  15. use think\Model;
  16. use think\facade\Db;
  17. use dateset\Dateset;
  18. class AdminLog extends Model
  19. {
  20. public function get_log_list($param = [])
  21. {
  22. $rows = empty($param['limit']) ? get_config('app.pages') : $param['limit'];
  23. $list = Db::name('AdminLog')
  24. ->field("a.id,a.uid,a.type,a.subject,a.action,a.create_time,u.name")
  25. ->alias('a')
  26. ->join('Admin u', 'a.uid = u.id')
  27. ->order('a.create_time desc')
  28. ->paginate(['list_rows'=> $rows])
  29. ->each(function($item, $key){
  30. $item['content'] = $item['name']. $item['action'] . '了' . $item['subject'];
  31. $item['times'] = (new Dateset())->time_trans($item['create_time']);
  32. return $item;
  33. });
  34. return $list;
  35. }
  36. }