| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\ActionLogModel;
- 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,
- ];
- $error = '';
- $rowId = $this->model->edit($data, $error, false);
- }
- /**
- * 删除七天之前标记软删除的数据
- */
- public function delete()
- {
- // 设置日志标题
- ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除上传文件信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
- ActionLogModel::record();
- $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
- return parent::delete();
- }
- }
|