OperationLog.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\admin\controller\system;
  3. use app\common\controller\AdminController;
  4. use app\http\IResponse;
  5. class OperationLog extends AdminController
  6. {
  7. /**
  8. * 操作记录
  9. *
  10. * @author 许祖兴 < zuxing.xu@lettered.cn>
  11. * @date 2020/3/18 10:41
  12. *
  13. * @return \think\response\Json
  14. * @throws \think\exception\DbException
  15. */
  16. public function index()
  17. {
  18. return IResponse::paginate(model('OperationLog')->with(['user'])
  19. ->paginate(input('limit'),false));
  20. }
  21. /**
  22. * 清空日志
  23. *
  24. * @author 许祖兴 < zuxing.xu@lettered.cn>
  25. * @date 2020/3/20 15:50
  26. *
  27. * @return \think\response\Json
  28. * @throws \think\db\exception\BindParamException
  29. * @throws \think\exception\PDOException
  30. */
  31. public function clear()
  32. {
  33. model('OperationLog')->execute("truncate TABLE " . config('database.prefix') . "system_operate_log");
  34. return IResponse::success('清空成功');
  35. }
  36. }