| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
							- <?php
 
- namespace Upload\Lib;
 
- use Dever;
 
- class Yun
 
- {
 
-     public function get($id)
 
-     {
 
-         $upload = Dever::db('upload/upload')->one($id);
 
-         if (!$upload) {
 
-             return false;
 
-         }
 
-         if ($upload['save_type'] == 1) {
 
-             return false;
 
-         }
 
-         if (!$upload['yun']) {
 
-             return false;
 
-         }
 
-         $config = Dever::db('upload/yun')->one($upload['yun']);
 
-         if (!$config) {
 
-             return false;
 
-         }
 
-         return $config;
 
-     }
 
-     public function view($file)
 
-     {
 
-     	$data = parse_url($file);
 
-     	$path = ltrim($data['path'], '/');
 
-     	$temp = explode('/', $path);
 
-     	$config = $this->get($temp[0]);
 
-     	if (!$config) {
 
-     		return $file;
 
-     	}
 
-     	return Dever::load('upload/lib/yun')->getMethod($config['type'])->view($config, $file);
 
-     }
 
-     public function getMethod($type)
 
- 	{
 
- 		if ($type == 1) {
 
-         	$method = 'oss';
 
-         } else {
 
-         	$method = 'qiniu';
 
-         }
 
- 		return Dever::load('upload/lib/view/' . $method);
 
- 	}
 
- }
 
 
  |