| | |
| | | protected $name = 'upload_file'; |
| | | protected $updateTime = false; |
| | | protected $deleteTime = false; |
| | | protected $append = ['file_path']; |
| | | protected $append = ['file_path', 'original_path']; |
| | | |
| | | /** |
| | | * 关联文件库分组表 |
| | |
| | | return self::$base_url . 'uploads/' . $data['save_name']; |
| | | } |
| | | return $data['file_url'] . '/' . $data['file_name']; |
| | | } |
| | | |
| | | /** |
| | | * 获取原始图片完整路径 by lyzflash |
| | | * @param $value |
| | | * @param $data |
| | | * @return string |
| | | */ |
| | | public function getOriginalPathAttr($value, $data) |
| | | { |
| | | if ($data['storage'] === 'local') { |
| | | return $data['is_original'] ? self::$base_url . 'uploads/' . $data['original_name'] : ''; |
| | | } |
| | | // 网盘暂不处理 |
| | | return ''; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($groupId = 0, $fileType = '', $pageSize = 30, $isRecycle = -1, $shop_supplier_id = 0) |
| | | public function getList($groupId = 0, $fileType = '', $pageSize = 30, $isRecycle = -1, $shop_supplier_id = 0, $branch_id = 0) |
| | | { |
| | | $model = $this; |
| | | // 文件分组 |
| | |
| | | return $model->with(['upload_group']) |
| | | ->where(['is_user' => 0, 'is_delete' => 0]) |
| | | ->where('shop_supplier_id', '=', $shop_supplier_id) |
| | | ->where('branch_id', '=', $branch_id) |
| | | ->order(['file_id' => 'desc']) |
| | | ->paginate($pageSize); |
| | | } |