UploadService.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Services\Common;
  12. use App\Services\BaseService;
  13. use Illuminate\Support\Facades\File;
  14. /**
  15. * 会员管理-服务类
  16. * @author laravel开发员
  17. * @since 2020/11/11
  18. * Class MemberService
  19. * @package App\Services\Common
  20. */
  21. class UploadService extends BaseService
  22. {
  23. /**
  24. * 构造函数
  25. * @author laravel开发员
  26. * @since 2020/11/11
  27. * MemberService constructor.
  28. */
  29. public function __construct()
  30. {
  31. // $this->model = new UploadModel();
  32. }
  33. public function save($file_path, $ext, $channel)
  34. {
  35. $data = [
  36. 'group_id' => 0,
  37. 'channel' => $channel,
  38. 'storage' => 0,
  39. 'domain' => 0,
  40. 'file_type' => 0,
  41. 'file_name' => 0,
  42. 'file_path' => $file_path,
  43. 'file_size' => File::size(public_path() . "/uploads/" . $file_path),
  44. 'file_ext' => $ext,
  45. 'cover' => $file_path,
  46. 'uploader_id' => session('userId') ?? 0,
  47. 'is_recycle' => 0,
  48. 'status' => 1,
  49. ];
  50. $error = '';
  51. $rowId = $this->model->edit($data, $error, false);
  52. }
  53. }