Browse Source

ComposerUpdate

Anyon 5 years ago
parent
commit
ab445878f0

+ 1 - 1
app/admin/controller/Queue.php

@@ -51,7 +51,7 @@ class Queue extends Controller
             }
         }
         $this->title = '系统任务管理';
-        $this->iswin = PATH_SEPARATOR === ';';
+        $this->iswin = ProcessService::instance()->iswin();
         $query = $this->_query($this->table)->dateBetween('create_at');
         $query->timeBetween('enter_time,outer_time')->like('title,command');
         $query->equal('status')->order('id desc')->page();

+ 4 - 4
composer.lock

@@ -783,12 +783,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zoujingli/ThinkLibrary.git",
-                "reference": "f4227bd9d2d2d1634bd749cf47642f61a43c507e"
+                "reference": "7a0ad7fe8fdd6079d8cc856405ac127505ed840b"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f4227bd9d2d2d1634bd749cf47642f61a43c507e",
-                "reference": "f4227bd9d2d2d1634bd749cf47642f61a43c507e",
+                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/7a0ad7fe8fdd6079d8cc856405ac127505ed840b",
+                "reference": "7a0ad7fe8fdd6079d8cc856405ac127505ed840b",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -832,7 +832,7 @@
             ],
             "description": "ThinkPHP v6.0 Development Library",
             "homepage": "http://framework.thinkadmin.top",
-            "time": "2019-11-23T08:36:34+00:00"
+            "time": "2019-11-23T09:23:18+00:00"
         }
     ],
     "packages-dev": [],

+ 1 - 1
vendor/composer/autoload_classmap.php

@@ -141,7 +141,6 @@ return array(
     'think\\admin\\Controller' => $vendorDir . '/zoujingli/think-library/src/Controller.php',
     'think\\admin\\Helper' => $vendorDir . '/zoujingli/think-library/src/Helper.php',
     'think\\admin\\Library' => $vendorDir . '/zoujingli/think-library/src/Library.php',
-    'think\\admin\\Queue' => $vendorDir . '/zoujingli/think-library/src/Queue.php',
     'think\\admin\\Service' => $vendorDir . '/zoujingli/think-library/src/Service.php',
     'think\\admin\\Storage' => $vendorDir . '/zoujingli/think-library/src/Storage.php',
     'think\\admin\\command\\Install' => $vendorDir . '/zoujingli/think-library/src/command/Install.php',
@@ -168,6 +167,7 @@ return array(
     'think\\admin\\service\\MenuService' => $vendorDir . '/zoujingli/think-library/src/service/MenuService.php',
     'think\\admin\\service\\NodeService' => $vendorDir . '/zoujingli/think-library/src/service/NodeService.php',
     'think\\admin\\service\\ProcessService' => $vendorDir . '/zoujingli/think-library/src/service/ProcessService.php',
+    'think\\admin\\service\\QueueService' => $vendorDir . '/zoujingli/think-library/src/service/QueueService.php',
     'think\\admin\\service\\SystemService' => $vendorDir . '/zoujingli/think-library/src/service/SystemService.php',
     'think\\admin\\service\\TokenService' => $vendorDir . '/zoujingli/think-library/src/service/TokenService.php',
     'think\\admin\\storage\\LocalStorage' => $vendorDir . '/zoujingli/think-library/src/storage/LocalStorage.php',

+ 1 - 1
vendor/composer/autoload_static.php

@@ -232,7 +232,6 @@ class ComposerStaticInit41e48da7c236026fbb8265abc69af9d9
         'think\\admin\\Controller' => __DIR__ . '/..' . '/zoujingli/think-library/src/Controller.php',
         'think\\admin\\Helper' => __DIR__ . '/..' . '/zoujingli/think-library/src/Helper.php',
         'think\\admin\\Library' => __DIR__ . '/..' . '/zoujingli/think-library/src/Library.php',
-        'think\\admin\\Queue' => __DIR__ . '/..' . '/zoujingli/think-library/src/Queue.php',
         'think\\admin\\Service' => __DIR__ . '/..' . '/zoujingli/think-library/src/Service.php',
         'think\\admin\\Storage' => __DIR__ . '/..' . '/zoujingli/think-library/src/Storage.php',
         'think\\admin\\command\\Install' => __DIR__ . '/..' . '/zoujingli/think-library/src/command/Install.php',
@@ -259,6 +258,7 @@ class ComposerStaticInit41e48da7c236026fbb8265abc69af9d9
         'think\\admin\\service\\MenuService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MenuService.php',
         'think\\admin\\service\\NodeService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/NodeService.php',
         'think\\admin\\service\\ProcessService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ProcessService.php',
+        'think\\admin\\service\\QueueService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/QueueService.php',
         'think\\admin\\service\\SystemService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/SystemService.php',
         'think\\admin\\service\\TokenService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/TokenService.php',
         'think\\admin\\storage\\LocalStorage' => __DIR__ . '/..' . '/zoujingli/think-library/src/storage/LocalStorage.php',

+ 4 - 4
vendor/composer/installed.json

@@ -805,12 +805,12 @@
         "source": {
             "type": "git",
             "url": "https://github.com/zoujingli/ThinkLibrary.git",
-            "reference": "f4227bd9d2d2d1634bd749cf47642f61a43c507e"
+            "reference": "7a0ad7fe8fdd6079d8cc856405ac127505ed840b"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f4227bd9d2d2d1634bd749cf47642f61a43c507e",
-            "reference": "f4227bd9d2d2d1634bd749cf47642f61a43c507e",
+            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/7a0ad7fe8fdd6079d8cc856405ac127505ed840b",
+            "reference": "7a0ad7fe8fdd6079d8cc856405ac127505ed840b",
             "shasum": "",
             "mirrors": [
                 {
@@ -826,7 +826,7 @@
             "ext-json": "*",
             "topthink/framework": "^6.0"
         },
-        "time": "2019-11-23T08:36:34+00:00",
+        "time": "2019-11-23T09:23:18+00:00",
         "type": "library",
         "extra": {
             "think": {

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2019-11-23 16:43:02
+// This file is automatically generated at:2019-11-23 17:26:05
 declare (strict_types = 1);
 return array (
   0 => 'think\\app\\Service',

+ 28 - 3
vendor/zoujingli/think-library/readme.md

@@ -59,22 +59,46 @@ class MyController extend \think\admin\Controller {
     
 }
 ```
+
+* 必要数据库表SQL(sysdata 函数需要用这个表)
+```sql
+CREATE TABLE `system_data` (
+  `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL COMMENT '配置名',
+  `value` longtext COMMENT '配置值',
+  PRIMARY KEY (`id`) USING BTREE,
+  KEY `idx_system_data_name` (`name`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统-数据';
+```
+
+* 必要数据库表SQl(sysoplog 函数需要用的这个表)
+```sql
+CREATE TABLE `system_oplog` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `node` varchar(200) NOT NULL DEFAULT '' COMMENT '当前操作节点',
+  `geoip` varchar(15) NOT NULL DEFAULT '' COMMENT '操作者IP地址',
+  `action` varchar(200) NOT NULL DEFAULT '' COMMENT '操作行为名称',
+  `content` varchar(1024) NOT NULL DEFAULT '' COMMENT '操作内容描述',
+  `username` varchar(50) NOT NULL DEFAULT '' COMMENT '操作人用户名',
+  `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统-日志';
+```
 * 必要数据库表SQL(sysconf 函数需要用到这个表)
 ```sql
 CREATE TABLE `system_config` (
-  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `type` varchar(20) DEFAULT '' COMMENT '分类',
   `name` varchar(100) DEFAULT '' COMMENT '配置名',
   `value` varchar(500) DEFAULT '' COMMENT '配置值',
-  PRIMARY KEY (`id`) USING BTREE,
   KEY `idx_system_config_type` (`type`),
   KEY `idx_system_config_name` (`name`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8mb4 COMMENT='系统-配置';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统-配置';
 ```
 * 系统任务列队支持需要的数据表
 ```sql
 CREATE TABLE `system_queue` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT '' COMMENT '任务编号',
   `title` varchar(50) NOT NULL DEFAULT '' COMMENT '任务名称',
   `command` varchar(500) DEFAULT '' COMMENT '执行指令',
   `exec_data` longtext COMMENT '执行参数',
@@ -87,6 +111,7 @@ CREATE TABLE `system_queue` (
   `status` tinyint(1) DEFAULT '1' COMMENT '任务状态(1新任务,2处理中,3成功,4失败)',
   `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   PRIMARY KEY (`id`) USING BTREE,
+  KEY `idx_system_queue_code` (`code`),
   KEY `idx_system_queue_title` (`title`) USING BTREE,
   KEY `idx_system_queue_status` (`status`) USING BTREE,
   KEY `idx_system_queue_rscript` (`rscript`) USING BTREE,

+ 1 - 1
vendor/zoujingli/think-library/src/Helper.php

@@ -70,7 +70,7 @@ abstract class Helper
      * @param array $args 额外参数
      * @return static
      */
-    public static function instance(array $args = [])
+    public static function instance(array $args = []): Helper
     {
         return Container::getInstance()->invokeClass(static::class, $args);
     }

+ 5 - 5
vendor/zoujingli/think-library/src/Service.php

@@ -42,19 +42,19 @@ abstract class Service
 
     /**
      * 服务初始化
+     * @return static
      */
-    protected function initialize()
+    public function initialize(): Service
     {
+        return $this;
     }
 
     /**
      * 静态实例对象
      * @return static
      */
-    public static function instance()
+    public static function instance(): Service
     {
-        $service = Container::getInstance()->make(static::class);
-        $service->initialize();
-        return $service;
+        return Container::getInstance()->make(static::class)->initialize();
     }
 }

+ 7 - 6
vendor/zoujingli/think-library/src/Storage.php

@@ -31,7 +31,7 @@ use think\Exception;
  * @method string path($name, $safe = false) static 文件存储路径
  * @method boolean del($name, $safe = false) static 删除存储文件
  * @method boolean has($name, $safe = false) static 检查文件是否存在
- * @method string set($name, $content, $safe = false) static 文件储存
+ * @method string set($name, $file, $safe = false) static 文件储存
  * @method string upload() static 上传目录地址
  */
 abstract class Storage
@@ -55,14 +55,15 @@ abstract class Storage
     public function __construct(App $app)
     {
         $this->app = $app;
-        $this->initialize();
     }
 
     /**
      * 存储初始化
+     * @return Storage
      */
-    protected function initialize()
+    protected function initialize(): Storage
     {
+        return $this;
     }
 
     /**
@@ -87,17 +88,17 @@ abstract class Storage
     /**
      * 设置文件驱动名称
      * @param string $name 驱动名称
-     * @return LocalStorage|QiniuStorage|static
+     * @return static
      * @throws Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public static function instance($name = null)
+    public static function instance($name = null): Storage
     {
         $class = ucfirst(strtolower(is_null($name) ? sysconf('storage.type') : $name));
         if (class_exists($object = "think\\admin\\storage\\{$class}Storage")) {
-            return Container::getInstance()->make($object);
+            return Container::getInstance()->make($object)->initialize();
         } else {
             throw new Exception("File driver [{$class}] does not exist.");
         }

+ 20 - 0
vendor/zoujingli/think-library/src/common.php

@@ -15,6 +15,7 @@
 
 use think\admin\extend\HttpExtend;
 use think\admin\service\AuthService;
+use think\admin\service\QueueService;
 use think\admin\service\SystemService;
 use think\admin\service\TokenService;
 use think\db\Query;
@@ -65,6 +66,25 @@ if (!function_exists('sysconf')) {
     }
 }
 
+if (!function_exists('sysqueue')) {
+    /**
+     * 注册异步处理任务
+     * @param string $title 任务名称
+     * @param string $command 执行内容
+     * @param integer $later 延时执行时间
+     * @param array $data 任务附加数据
+     * @param integer $rscript 任务多开
+     * @return QueueService
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    function sysqueue($title, $command, $later = 0, $data = [], $rscript = 1)
+    {
+        return QueueService::instance()->register($title, $command, $later, $data, $rscript);
+    }
+}
 
 if (!function_exists('sysdata')) {
     /**

+ 7 - 6
vendor/zoujingli/think-library/src/queue/WorkQueue.php

@@ -15,12 +15,13 @@
 
 namespace think\admin\queue;
 
-use think\admin\Queue;
 use think\admin\service\ProcessService;
+use think\admin\service\QueueService;
 use think\console\Command;
 use think\console\Input;
 use think\console\input\Argument;
 use think\console\Output;
+use think\Exception;
 
 /**
  * 启动独立执行进程
@@ -62,20 +63,20 @@ class WorkQueue extends Command
     {
         try {
             $this->code = trim($input->getArgument('code'));
-            if (empty($this->code)) throw new \think\Exception("执行任务需要指定任务编号!");
+            if (empty($this->code)) throw new Exception("执行任务需要指定任务编号!");
             $queue = $this->app->db->name('SystemQueue')->where(['code' => $this->code, 'status' => '2'])->find();
-            if (empty($queue)) throw new \think\Exception("执行任务{$this->code}的信息或状态异常!");;
+            if (empty($queue)) throw new Exception("执行任务{$this->code}的信息或状态异常!");;
             // 设置进程标题
             if (($process = ProcessService::instance())->iswin()) {
                 $this->setProcessTitle("ThinkAdmin {$process->version()} 执行任务 - {$queue['title']}");
             }
             // 执行任务内容
             if (class_exists($command = $queue['command'])) {
-                if ($command instanceof Queue) {
+                if ($command instanceof QueueService) {
                     $data = json_decode($queue['data'], true) ?: [];
-                    $this->update('3', $command::instance($this->app, $this->code)->execute($data));
+                    $this->update('3', $command::instance()->initialize($this->code)->execute($data));
                 } else {
-                    throw new \think\Exception("任务处理类 {$command} 未继承 think\\admin\\Queue");
+                    throw new Exception("任务处理类 {$command} 未继承 think\\admin\\service\\QueueService");
                 }
             } else {
                 $attr = explode(' ', trim(preg_replace('|\s+|', ' ', $queue['command'])));

+ 4 - 1
vendor/zoujingli/think-library/src/service/CaptchaService.php

@@ -38,8 +38,9 @@ class CaptchaService extends Service
     /**
      * 服务初始化
      * @param array $config
+     * @return static
      */
-    protected function initialize($config = [])
+    public function initialize($config = []): Service
     {
         // 动态配置属性
         foreach ($config as $k => $v) if (isset($this->$k)) $this->$k = $v;
@@ -54,6 +55,8 @@ class CaptchaService extends Service
         $this->font = __DIR__ . '/bin/font.ttf';
         // 缓存验证码字符串
         $this->app->cache->set($this->uniqid, $this->code, 360);
+        // 返回当前对象
+        return $this;
     }
 
     /**

+ 3 - 1
vendor/zoujingli/think-library/src/service/InstallService.php

@@ -57,8 +57,9 @@ class InstallService extends Service
 
     /**
      * 服务初始化
+     * @return static
      */
-    protected function initialize()
+    public function initialize(): Service
     {
         // 应用框架版本
         $this->version = $this->app->config->get('app.thinkadmin_ver');
@@ -67,6 +68,7 @@ class InstallService extends Service
         $this->uri = "https://{$this->version}.thinkadmin.top";
         // 当前应用根目录
         $this->path = strtr($this->app->getRootPath(), '\\', '/');
+        return $this;
     }
 
     /**

+ 3 - 19
vendor/zoujingli/think-library/src/service/MenuService.php

@@ -27,22 +27,6 @@ class MenuService extends Service
 {
 
     /**
-     * 应用节点服务
-     * @var NodeService
-     */
-    protected $nodeService;
-
-    /**
-     * 服务初始化
-     * @return $this
-     */
-    protected function initialize()
-    {
-        $this->nodeService = NodeService::instance();
-        return $this;
-    }
-
-    /**
      * 获取可选菜单节点
      * @return array
      * @throws \ReflectionException
@@ -51,8 +35,8 @@ class MenuService extends Service
     {
         static $nodes = [];
         if (count($nodes) > 0) return $nodes;
-        foreach ($this->nodeService->getMethods() as $node => $method) if ($method['ismenu']) {
-            $nodes[] = ['node' => $node, 'title' => $method['title']];
+        foreach (NodeService::instance()->getMethods() as $node => $method) {
+            if ($method['ismenu']) $nodes[] = ['node' => $node, 'title' => $method['title']];
         }
         return $nodes;
     }
@@ -68,7 +52,7 @@ class MenuService extends Service
     public function getTree()
     {
         $result = $this->app->db->name('SystemMenu')->where(['status' => '1'])->order('sort desc,id asc')->select();
-        return $this->buildData(DataExtend::arr2tree($result->toArray()), $this->nodeService->getMethods());
+        return $this->buildData(DataExtend::arr2tree($result->toArray()), NodeService::instance()->getMethods());
     }
 
     /**

+ 12 - 48
vendor/zoujingli/think-library/src/Queue.php → vendor/zoujingli/think-library/src/service/QueueService.php

@@ -13,24 +13,18 @@
 // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
-namespace think\admin;
+namespace think\admin\service;
 
 use think\admin\extend\CodeExtend;
-use think\admin\service\ProcessService;
-use think\App;
+use think\admin\Service;
 
 /**
- * 基础任务基类
- * Class Queue
- * @package think\admin
+ * 任务基础服务
+ * Class QueueService
+ * @package think\admin\service
  */
-class Queue
+class QueueService extends Service
 {
-    /**
-     * 应用实例
-     * @var App
-     */
-    protected $app;
 
     /**
      * 当前任务编号
@@ -57,45 +51,15 @@ class Queue
     protected $queue = [];
 
     /**
-     * Queue constructor.
-     * @param App $app
-     * @param int $code
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     */
-    public function __construct(App $app, $code = 0)
-    {
-        $this->app = $app;
-        if ($code > 0) $this->init($code);
-    }
-
-    /**
-     * 静态获取实例
-     * @param App $app
-     * @param int $code
-     * @return static
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     */
-    public static function instance(App $app, $code = 0)
-    {
-        return new static($app, $code);
-    }
-
-    /**
      * 数据初始化
      * @param integer $code
-     * @return Queue
+     * @return static
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function init($code = 0)
+    public function initialize($code = 0): Service
     {
         if ($code > 0) {
             $this->queue = $this->app->db->name('SystemQueue')->where(['code' => $this->code])->find();
@@ -119,7 +83,7 @@ class Queue
     /**
      * 重发异步任务
      * @param integer $wait 等待时间
-     * @return Queue
+     * @return $this
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
@@ -131,7 +95,7 @@ class Queue
         $this->app->db->name('SystemQueue')->where(['code' => $this->code])->failException(true)->update([
             'exec_time' => time() + $wait, 'attempts' => $this->queue['attempts'] + 1, 'status' => '1',
         ]);
-        return $this->init($this->code);
+        return $this->initialize($this->code);
     }
 
     /**
@@ -141,7 +105,7 @@ class Queue
      * @param integer $later 延时执行时间
      * @param array $data 任务附加数据
      * @param integer $rscript 任务多开
-     * @return Queue
+     * @return $this
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
@@ -164,7 +128,7 @@ class Queue
             'enter_time' => '0',
             'outer_time' => '0',
         ]);
-        return $this->init($this->code);
+        return $this->initialize($this->code);
     }
 
     /**

+ 1 - 1
vendor/zoujingli/think-library/src/service/SystemService.php

@@ -36,7 +36,7 @@ class SystemService extends Service
      * 设置配置数据
      * @param string $name 配置名称
      * @param string $value 配置内容
-     * @return SystemService
+     * @return static
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 6 - 4
vendor/zoujingli/think-library/src/storage/LocalStorage.php

@@ -26,26 +26,28 @@ class LocalStorage extends Storage
 {
     /**
      * 存储引擎初始化
+     * @return LocalStorage
      */
-    protected function initialize()
+    protected function initialize(): Storage
     {
         $this->prefix = rtrim($this->app->getRootPath(), '\\/');
+        return $this;
     }
 
     /**
      * 文件储存在本地
      * @param string $name 文件名称
-     * @param string $content 文件内容
+     * @param string $file 文件内容
      * @param boolean $safe 安全模式
      * @return array|null
      * @throws \think\Exception
      */
-    public function set($name, $content, $safe = false)
+    public function set($name, $file, $safe = false)
     {
         try {
             $file = $this->path($name, $safe);
             file_exists(dirname($file)) || mkdir(dirname($file), 0755, true);
-            if (file_put_contents($file, $content)) return $this->info($name, $safe);
+            if (file_put_contents($file, $file)) return $this->info($name, $safe);
         } catch (\Exception $e) {
             throw new \think\Exception("本地文件存储失败,{$e->getMessage()}");
         }

+ 6 - 4
vendor/zoujingli/think-library/src/storage/QiniuStorage.php

@@ -32,12 +32,13 @@ class QiniuStorage extends Storage
 
     /**
      * 存储引擎初始化
+     * @return QiniuStorage
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    protected function initialize()
+    protected function initialize(): Storage
     {
         // 读取配置文件
         $this->bucket = sysconf('storage.qiniu_bucket');
@@ -50,12 +51,13 @@ class QiniuStorage extends Storage
         elseif ($type === 'http') $this->prefix = "http://{$this->domain}/";
         elseif ($type === 'https') $this->prefix = "https://{$this->domain}/";
         else throw new \think\Exception('未配置七牛云URL域名哦');
+        return $this;
     }
 
     /**
      * 上传文件内容
      * @param string $name 文件名称
-     * @param string $content 文件内容
+     * @param string $file 文件内容
      * @param boolean $safe 安全模式
      * @return array
      * @throws \think\Exception
@@ -63,7 +65,7 @@ class QiniuStorage extends Storage
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function set($name, $content, $safe = false)
+    public function set($name, $file, $safe = false)
     {
         $token = $this->buildUploadToken($name);
         list($attrs, $frontier) = [[], uniqid()];
@@ -76,7 +78,7 @@ class QiniuStorage extends Storage
         $attrs[] = "--{$frontier}";
         $attrs[] = "Content-Disposition:form-data; name=\"file\"; filename=\"{$name}\"";
         $attrs[] = "";
-        $attrs[] = $content;
+        $attrs[] = $file;
         $attrs[] = "--{$frontier}--";
         return json_decode(HttpExtend::post($this->upload(), join("\r\n", $attrs), [
             'headers' => ["Content-type:multipart/form-data;boundary={$frontier}"],