SystemFile.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\v1\system\log;
  12. use app\controller\admin\AuthController;
  13. use app\services\system\log\SystemFileServices;
  14. use think\exception\ValidateException;
  15. use think\facade\App;
  16. use function env;
  17. /**
  18. * 文件校验控制器
  19. * Class SystemFile
  20. * @package app\controller\admin\v1\system
  21. *
  22. */
  23. class SystemFile extends AuthController
  24. {
  25. /**
  26. * 构造方法
  27. * SystemFile constructor.
  28. * @param App $app
  29. * @param SystemFileServices $services
  30. */
  31. public function __construct(App $app, SystemFileServices $services)
  32. {
  33. parent::__construct($app);
  34. $this->services = $services;
  35. //生产模式下不允许清除数据
  36. if (!env('APP_DEBUG', false)) {
  37. throw new ValidateException('生产模式下,禁止操作');
  38. }
  39. }
  40. /**
  41. * 文件校验记录
  42. * @return mixed
  43. */
  44. public function index()
  45. {
  46. return $this->success(['list' => $this->services->getFileList()]);
  47. }
  48. //打开目录
  49. public function opendir()
  50. {
  51. // return $this->success($this->services->opendir());
  52. }
  53. //读取文件
  54. public function openfile()
  55. {
  56. // $file = $this->request->param('filepath');
  57. // if (empty($file)) return $this->fail('出现错误');
  58. // return $this->success($this->services->openfile($file));
  59. }
  60. //保存文件
  61. public function savefile()
  62. {
  63. // $comment = $this->request->param('comment');
  64. // $filepath = $this->request->param('filepath');
  65. // if(empty($comment) || empty($filepath)){
  66. // return $this->fail('出现错误');
  67. // }
  68. // $res = $this->services->savefile($filepath,$comment);
  69. // if ($res) {
  70. return $this->success('保存成功!');
  71. // } else {
  72. // return $this->fail('保存失败');
  73. // }
  74. }
  75. }