|
@@ -13,25 +13,28 @@ class Handle
|
|
|
public function __construct($data = array())
|
|
|
{
|
|
|
$this->yun = $this->local = false;
|
|
|
- $config = Dever::db('upload/upload')->one($data['key']);
|
|
|
+ $config = Dever::load('upload/lib/config')->get($data['key']);
|
|
|
+ //$config = Dever::db('upload/upload')->one($data['key']);
|
|
|
+ if (!$config) {
|
|
|
+ Dever::alert('错误的上传配置');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
$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) {
|
|
|
+ if ($this->save_type >= 2 && $config['yun']) {
|
|
|
+ if ($config['yun']['type'] == 2) {
|
|
|
$class = 'Upload\Lib\Store\Qiniu';
|
|
|
- } elseif ($yun['type'] == 1) {
|
|
|
+ } elseif ($config['yun']['type'] == 1) {
|
|
|
$class = 'Upload\Lib\Store\Oss';
|
|
|
}
|
|
|
- $data['host'] = $yun['host'];
|
|
|
+ $data['host'] = $config['yun']['host'];
|
|
|
|
|
|
- $this->yun = new $class($data);
|
|
|
+ $this->yun = new $class($config, $data);
|
|
|
}
|
|
|
|
|
|
if ($this->save_type <= 3) {
|
|
|
- $this->local = new Local($data);
|
|
|
+ $this->local = new Local($config, $data);
|
|
|
}
|
|
|
}
|
|
|
|