yun = $this->local = false; $config = Dever::db('upload/upload')->one($data['key']); $this->save_type = $config['save_type']; $yun = $config['yun']; if ($this->save_type >= 2) { $yun = Dever::db('upload/yun')->one($yun); if ($yun['type'] == 2) { $yun = 'Upload\Lib\Store\Qiniu'; } elseif ($yun['type'] == 1) { $yun = 'Upload\Lib\Store\Oss'; } $this->yun = new $yun($data); } if ($this->save_type <= 3) { $this->local = new Local($data); } } # 复制文件到服务器上 public function copy() { return $this->get(); } # 获取文件名 public function name() { return $this->get('getName'); } # 手动裁图 public function cropper() { if ($this->local) { $this->local->cropper(); } if ($this->yun) { $this->yun->cropper(); } } # 获取文件名 public function get($type = 'copy') { $yun = $local = array(); if ($this->save_type <= 3) { $local = $this->local->$type(); } if ($local && $local['status'] == -1) { return $local; } if ($this->save_type >= 2) { $yun = $this->yun->$type(); } if ($type == 'copy') { if ($this->local) { $this->local->delete(); } elseif ($this->yun) { $this->yun->delete(); } } if ($this->save_type <= 2) { return $local; } elseif ($this->save_type > 2) { return $yun; } } public function handle_t($id, $source, $dest, $path) { $yun = $local = array(); if ($this->save_type <= 3) { $local = $this->local->handle_t($id, $source, $dest); } if ($local) { return $local; } if ($this->save_type >= 2) { $yun = $this->yun->handle_t($id, $source, $dest, $path); } if ($this->save_type <= 2) { return $local; } elseif ($this->save_type > 2) { return $yun; } } }