Anyon преди 5 години
родител
ревизия
73a0a88f30

+ 7 - 12
app/admin/controller/api/Update.php

@@ -25,31 +25,26 @@ use think\admin\Controller;
 class Update extends Controller
 {
     /**
-     * 基础URL地址
-     * @var string
-     */
-    protected $baseUri = 'https://demo.thinkadmin.top';
-
-    /**
      * 获取文件列表
      */
     public function tree()
     {
-        $sync = new Sync('Update');
-        $this->success('获取当前文件列表成功!', $sync->build());
+        $plugs = new \think\admin\plugs\Plugs();
+        $this->success('获取当前文件列表成功!', $plugs->buildFileList([
+            'think', 'app/admin', 'public/static',
+        ], ['public/static/self']));
     }
 
     /**
      * 读取线上文件数据
      * @param string $encode
      */
-    public function read($encode)
+    public function get($encode)
     {
-        $this->file = env('root_path') . decode($encode);
+        $this->file = dirname($this->app->getAppPath()) . '/' . decode($encode);
         if (file_exists($this->file)) {
             $this->success('读取文件成功!', [
-                'format'  => 'base64',
-                'content' => base64_encode(file_get_contents($this->file)),
+                'format' => 'base64', 'content' => base64_encode(file_get_contents($this->file)),
             ]);
         } else {
             $this->error('获取文件内容失败!');

+ 0 - 0
public/static/myself/my_plugs_files → public/static/self/my_plugs_files


+ 1 - 0
vendor/zoujingli/think-library/src/ThinkLibrary.php

@@ -66,6 +66,7 @@ class ThinkLibrary extends Service
             'think\admin\queue\StartQueue',
             'think\admin\queue\QueryQueue',
             'think\admin\queue\ListenQueue',
+            'think\admin\plugs\AdminPlugs'
         ]);
     }
 

+ 14 - 0
vendor/zoujingli/think-library/src/plugs/AdminPlugs.php

@@ -2,7 +2,21 @@
 
 namespace think\admin\plugs;
 
+use think\console\Input;
+use think\console\Output;
+
 class AdminPlugs extends Plugs
 {
+    protected function configure()
+    {
+        $this->modules = ['application/admin/', 'think'];
+        $this->setName('xplugs:admin')->setDescription('[同步]覆盖本地Admin模块代码');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        $this->modules['admin'];
+        dump($this->uri);
+    }
 
 }

+ 8 - 4
vendor/zoujingli/think-library/src/plugs/Plugs.php

@@ -22,7 +22,7 @@ class Plugs extends Command
      * 项目根目录
      * @var string
      */
-    protected $root;
+    protected $path;
 
     /**
      * 当前版本号
@@ -36,13 +36,17 @@ class Plugs extends Command
      */
     protected $modules = [];
 
-    public function __construct()
+    /**
+     * 插件指令初始化
+     * @param Input $input
+     * @param Output $output
+     */
+    protected function initialize(Input $input, Output $output)
     {
-        parent::__construct();
         $this->version = $this->app->config->get('app.thinkadmin_ver');
         if (empty($this->version)) $this->version = 'v4';
         $this->uri = "https://{$this->version}.thinkadmin.top";
-        $this->root = strtr(dirname($this->app->getAppPath()) . '/', '\\', '/');
+        $this->path = strtr($this->app->getAppPath(), '\\', '/');
     }
 
     protected function execute(Input $input, Output $output)