Syslog.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\manage\controller;
  3. use app\manage\model\ExamClassModel;
  4. use app\manage\model\InstitutionModel;
  5. use app\manage\model\TemplateModel;
  6. use think\Controller;
  7. use think\Db;
  8. use think\Session;
  9. use think\Config;
  10. use think\Cookie;
  11. use think\Request;
  12. use app\common\library\SysLogs;
  13. use app\common\library\UUIDs;
  14. /**
  15. * 模版管理
  16. */
  17. class Syslog extends Base {
  18. public function index() {
  19. return $this->fetch('index');
  20. }
  21. public function datas() {
  22. $request = Request::instance();
  23. $params = $request->param();
  24. $page = empty($params["page"]) ? 1 : $params["page"];
  25. $pagesize = empty($params["rows"]) ? 1 : $params["rows"];
  26. if (empty($page) || $page < 1) {
  27. $page = 1;
  28. }
  29. if (empty($pagesize) || $pagesize < 1) {
  30. $pagesize = 30;
  31. }
  32. $whereArr = array();
  33. if (!empty($params["module"])) {
  34. $whereArr["module"] = $params["module"];
  35. }
  36. if (!empty($params["type"])) {
  37. $whereArr["type"] = $params["type"];
  38. }
  39. if (!empty($params["uid"])) {
  40. $whereArr["uid"] = $params["uid"];
  41. }
  42. $info = DB::table('sys_logs')->where($whereArr)->order( [ "cdate" => "desc" ] )->page($page, $pagesize)->select();
  43. $num = DB::table('sys_logs')->where($whereArr)->count();
  44. $data = array();
  45. $data['total'] = $num;
  46. $data['rows'] = $info;
  47. echo json_encode($data);
  48. }
  49. }