UploadController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\admin\controller\sys_manage;
  3. use app\admin\service\sys_manage\UploadService;
  4. use support\Request;
  5. class UploadController
  6. {
  7. /**
  8. * @Desc 上传图片
  9. * @Author Gorden
  10. * @Date 2024/2/26 17:16
  11. *
  12. * @return \support\Response
  13. */
  14. public function image()
  15. {
  16. $config = [
  17. 'single_limit' => 1024 * 1024 * 5,
  18. 'nums' => 1,
  19. 'include' => ['jpg', 'jpeg', 'png'],
  20. 'uri' => '/storage/new/images/',
  21. 'root' => public_path() . '/storage/new/images/',
  22. ];
  23. return UploadService::upload($config);
  24. }
  25. /**
  26. * @Desc 上传视频
  27. * @Author Gorden
  28. * @Date 2024/2/26 17:16
  29. *
  30. * @return \support\Response
  31. */
  32. public function video()
  33. {
  34. $config = [
  35. 'single_limit' => 1024 * 1024 * 50,
  36. 'nums' => 1,
  37. 'include' => ['mp4'],
  38. 'uri' => '/storage/new/videos/',
  39. 'root' => public_path() . '/storage/new/videos/',
  40. ];
  41. return UploadService::upload($config);
  42. }
  43. public function file()
  44. {
  45. $config = [
  46. 'single_limit' => 1024 * 1024 * 50,
  47. 'nums' => 1,
  48. 'include' => ['jpg', 'jpeg', 'png','pdf','doc','docx','xls','xlsx'],
  49. 'uri' => '/storage/new/files/',
  50. 'root' => public_path() . '/storage/new/files/',
  51. ];
  52. return UploadService::upload($config);
  53. }
  54. /**
  55. * @Desc 修改文件状态
  56. * @Author Gorden
  57. * @Date 2024/3/7 9:32
  58. *
  59. * @param $id
  60. * @param Request $request
  61. * @return \support\Response
  62. */
  63. public function updateStatus($id, Request $request)
  64. {
  65. return UploadService::updateStatus($id, $request->post());
  66. }
  67. }