dever 4 years ago
parent
commit
b9911ae475
3 changed files with 11 additions and 6 deletions
  1. 2 2
      lib/View/Oss.php
  2. 1 1
      lib/View/Qiniu.php
  3. 8 3
      src/Yun.php

+ 2 - 2
lib/View/Oss.php

@@ -15,7 +15,7 @@ class Oss
     {
         $region = 'cn-' . $config['region_id'];
         if (!$config['role_arn']) {
-            return array('oss', '||' . $config['appkey'] . '||' . $config['appsecret'], $region);
+            return array('oss', '||' . $config['appkey'] . '||' . $config['appsecret'], $region, $upload['bucket']);
         }
         $cur = time();
         
@@ -63,7 +63,7 @@ class Oss
             $token = $config['token'];
         }
         
-        return array('oss', $token, $region);
+        return array('oss', $token, $region, $upload['bucket']);
     }
 
     public function callback()

+ 1 - 1
lib/View/Qiniu.php

@@ -29,7 +29,7 @@ class Qiniu
         
         $domain = 'http://up-z1.qiniup.com/';
 
-        return array('qiniu', $token, $domain);
+        return array('qiniu', $token, $domain, $upload['bucket']);
     }
 
     public function callback()

+ 8 - 3
src/Yun.php

@@ -36,10 +36,15 @@ class Yun
         if (!$config) {
             return;
         }
+
+        # 是否覆盖原文件,1是覆盖,2是不覆盖生成新文件
+        $cover = 1;
+        if ($upload['cover'] > 1) {
+            $cover = 2;
+        }
         
-        list($type, $token, $domain) = $this->getMethod($config['type'])->token($config, $upload);
-        $result = array('type' => $type, 'uptoken' => $token, 'domain' => $domain, 'host' => $config['host']);
-        print_r($result);die;
+        list($type, $token, $domain, $bucket) = $this->getMethod($config['type'])->token($config, $upload);
+        $result = array('type' => $type, 'uptoken' => $token, 'domain' => $domain, 'host' => $config['host'], 'bucket' => $bucket, 'cover' => $cover);
         if ($return == 1) {
             return $result;
         }