$_is_file_upload] )); } /** * 默认存储 * @return mixed * @author Tinywan(ShaoBo Wan) */ public static function getDefaultStorage() { return self::getConfig('default'); } /** * 获取存储配置 * @param string|null $name 名称 * @return mixed * @author Tinywan(ShaoBo Wan) */ public static function getConfig(string $name = null) { $config = (new UploadService)->setConfigVal($name); if (!is_null($name)) { return $config['storage'][$name]; // return config('plugin.tinywan.storage.app.storage.' . $name, self::MODE_LOCAL); } return $config['storage']["default"]; // return config('plugin.tinywan.storage.app.storage.default'); } /** * 配置信息 * @param array $config */ public function config(array $config) { $this->$config = $config; return $this; } /** * @param $name * @param $arguments * @return mixed * @author Tinywan(ShaoBo Wan) */ public static function __callStatic($name, $arguments) { return static::disk()->{$name}(...$arguments); } /** * 获取上传信息 * @return array */ public static function getUploadInfo($file) { if ($file) { $config = self::getDefaultStorage(); $info = []; foreach ($file as $k => $v) { $info[] = [ 'name' => $v['save_name'], 'image_type' => $config, 'real_name' => $v['origin_name'] ?? '', 'size' => $v['size'] ?? 0, 'type' => $v['mime_type'] ?? 'image/jpeg', 'dir' => $v['url'], 'time' => time(), ]; } return $info; } else { return []; } } }