| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Services\BaseService;
- use Illuminate\Support\Facades\File;
- /**
- * 会员管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * Class MemberService
- * @package App\Services\Common
- */
- class UploadService extends BaseService
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * MemberService constructor.
- */
- public function __construct()
- {
- // $this->model = new UploadModel();
- }
- public function save($file_path, $ext, $channel)
- {
- $data = [
- 'group_id' => 0,
- 'channel' => $channel,
- 'storage' => 0,
- 'domain' => 0,
- 'file_type' => 0,
- 'file_name' => 0,
- 'file_path' => $file_path,
- 'file_size' => File::size(public_path() . "/uploads/" . $file_path),
- 'file_ext' => $ext,
- 'cover' => $file_path,
- 'uploader_id' => session('userId') ?? 0,
- 'is_recycle' => 0,
- 'status' => 1,
- ];
- // 如果 model 存在才保存到数据库
- // if ($this->model) {
- // $error = '';
- // $rowId = $this->model->edit($data, $error, false);
- // return $rowId;
- // }
- // 如果没有 model,直接返回 true(文件已经保存到磁盘)
- return true;
- }
- }
|