浏览代码

修改系统模块管理

Anyon 4 年之前
父节点
当前提交
ef63ee2eed

+ 5 - 5
app/admin/controller/Module.php

@@ -56,13 +56,13 @@ class Module extends Controller
     {
         $data = $this->_vali(['name.require' => '模块名称不能为空!']);
         $modules = ModuleService::instance()->online();
+        $locals = ModuleService::instance()->getModules();
         if (isset($modules[$data['name']])) {
             $this->module = $modules[$data['name']];
-            foreach ($this->module['change'] as $key => &$change) {
-                $change = [
-                    'version' => preg_replace("|^(\d{4})\.(\d{2})\.(\d{2})\.(\d+)$|", '$1年$2月$3日 第$4次更新', $key),
-                    'content' => $change,
-                ];
+            $this->current = $locals[$data['name']] ?? [];
+            $pattern = "|^(\d{4})\.(\d{2})\.(\d{2})\.(\d+)$|";
+            foreach ($this->module['change'] as $version => &$change) {
+                $change = ['content' => $change, 'version' => preg_replace($pattern, '于 $1年$2月$3日 第$4次更新', $version)];
             }
             $this->fetch();
         } else {

+ 1 - 1
app/admin/module/change/2020.08.03.01.md

@@ -1 +1 @@
-* 少更新,修复部分BUG
+* 少更新,修复部分BUG

+ 18 - 16
app/admin/view/module/change.html

@@ -1,29 +1,31 @@
 <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
     <div class="layui-card-body padding-left-40">
-        <table class="layui-table">
-            <tr>
-                <td class="font-w7">模块名称</td>
-                <td class="color-blue">{$module.name}</td>
-            </tr>
-            <tr>
-                <td class="font-w7">最新版本</td>
-                <td class="color-blue">{$module.version}</td>
-            </tr>
-            <tr>
-                <td class="font-w7">模块描述</td>
-                <td class="color-blue">{$module.content}</td>
-            </tr>
-        </table>
+        <div class="layui-textarea font-s14 layui-bg-gray padding-top-20 padding-left-20">
+            <div class="layui-row margin-bottom-15">
+                <div class="layui-col-xs6">模块名称:<b class="color-green">{$module.name}</b></div>
+                <div class="layui-col-xs6">开发作者:<b class="color-green">{$module.author}</b></div>
+            </div>
+            <div class="layui-row margin-bottom-15">
+                <div class="layui-col-xs6">最新版本:<b class="color-green">{$module.version}</b></div>
+                <div class="layui-col-xs6">{if isset($current.version)}已安装版本:<b class="color-green">{$current.version}</b>{/if}</div>
+            </div>
+            <div class="layui-form-item">模块描述:{$module.content}</div>
+        </div>
         <ul class="layui-timeline margin-top-30 margin-bottom-30" style="max-height:400px;overflow:auto">
-            {foreach $module.change as $change}
+            {foreach $module.change as $version=>$change}
             <li class="layui-timeline-item">
+                {if isset($current.version) and $current.version eq $version}
                 <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
+                {else}
+                <i class="layui-icon layui-timeline-axis">&#xe756;</i>
+                {/if}
                 <div class="layui-timeline-content layui-text">
-                    <h3 class="layui-timeline-title">{$change.version|default=''}</h3>
+                    <h3 class="layui-timeline-title">版本号 {$version},{$change.version|default=''}</h3>
                     {$change.content|default=''|raw}
                 </div>
             </li>
             {/foreach}
+            <li class="layui-timeline-item"></li>
         </ul>
     </div>
 </form>

+ 4 - 4
composer.lock

@@ -937,12 +937,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zoujingli/ThinkLibrary.git",
-                "reference": "822d461c4f23e5ab3cd3489cd740a7171706e367"
+                "reference": "747278ffb2b1a450bc8e6724ffbff105bb9f5f47"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/822d461c4f23e5ab3cd3489cd740a7171706e367",
-                "reference": "822d461c4f23e5ab3cd3489cd740a7171706e367",
+                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/747278ffb2b1a450bc8e6724ffbff105bb9f5f47",
+                "reference": "747278ffb2b1a450bc8e6724ffbff105bb9f5f47",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -987,7 +987,7 @@
             ],
             "description": "ThinkPHP v6.0 Development Library",
             "homepage": "http://thinkadmin.top",
-            "time": "2020-08-17T07:02:36+00:00"
+            "time": "2020-08-17T07:32:11+00:00"
         },
         {
             "name": "zoujingli/wechat-developer",

+ 1 - 1
vendor/composer/autoload_classmap.php

@@ -283,6 +283,7 @@ return array(
     'think\\admin\\extend\\HttpExtend' => $vendorDir . '/zoujingli/think-library/src/extend/HttpExtend.php',
     'think\\admin\\extend\\JsonRpcClient' => $vendorDir . '/zoujingli/think-library/src/extend/JsonRpcClient.php',
     'think\\admin\\extend\\JsonRpcServer' => $vendorDir . '/zoujingli/think-library/src/extend/JsonRpcServer.php',
+    'think\\admin\\extend\\Parsedown' => $vendorDir . '/zoujingli/think-library/src/extend/Parsedown.php',
     'think\\admin\\helper\\DeleteHelper' => $vendorDir . '/zoujingli/think-library/src/helper/DeleteHelper.php',
     'think\\admin\\helper\\FormHelper' => $vendorDir . '/zoujingli/think-library/src/helper/FormHelper.php',
     'think\\admin\\helper\\PageHelper' => $vendorDir . '/zoujingli/think-library/src/helper/PageHelper.php',
@@ -298,7 +299,6 @@ return array(
     'think\\admin\\service\\CaptchaService' => $vendorDir . '/zoujingli/think-library/src/service/CaptchaService.php',
     'think\\admin\\service\\ExpressService' => $vendorDir . '/zoujingli/think-library/src/service/ExpressService.php',
     'think\\admin\\service\\InstallService' => $vendorDir . '/zoujingli/think-library/src/service/InstallService.php',
-    'think\\admin\\service\\MarkdownService' => $vendorDir . '/zoujingli/think-library/src/service/MarkdownService.php',
     'think\\admin\\service\\MenuService' => $vendorDir . '/zoujingli/think-library/src/service/MenuService.php',
     'think\\admin\\service\\MessageService' => $vendorDir . '/zoujingli/think-library/src/service/MessageService.php',
     'think\\admin\\service\\ModuleService' => $vendorDir . '/zoujingli/think-library/src/service/ModuleService.php',

+ 1 - 1
vendor/composer/autoload_static.php

@@ -416,6 +416,7 @@ class ComposerStaticInitb911c14a0826c73d9f097343fd33a252
         'think\\admin\\extend\\HttpExtend' => __DIR__ . '/..' . '/zoujingli/think-library/src/extend/HttpExtend.php',
         'think\\admin\\extend\\JsonRpcClient' => __DIR__ . '/..' . '/zoujingli/think-library/src/extend/JsonRpcClient.php',
         'think\\admin\\extend\\JsonRpcServer' => __DIR__ . '/..' . '/zoujingli/think-library/src/extend/JsonRpcServer.php',
+        'think\\admin\\extend\\Parsedown' => __DIR__ . '/..' . '/zoujingli/think-library/src/extend/Parsedown.php',
         'think\\admin\\helper\\DeleteHelper' => __DIR__ . '/..' . '/zoujingli/think-library/src/helper/DeleteHelper.php',
         'think\\admin\\helper\\FormHelper' => __DIR__ . '/..' . '/zoujingli/think-library/src/helper/FormHelper.php',
         'think\\admin\\helper\\PageHelper' => __DIR__ . '/..' . '/zoujingli/think-library/src/helper/PageHelper.php',
@@ -431,7 +432,6 @@ class ComposerStaticInitb911c14a0826c73d9f097343fd33a252
         'think\\admin\\service\\CaptchaService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/CaptchaService.php',
         'think\\admin\\service\\ExpressService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ExpressService.php',
         'think\\admin\\service\\InstallService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/InstallService.php',
-        'think\\admin\\service\\MarkdownService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MarkdownService.php',
         'think\\admin\\service\\MenuService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MenuService.php',
         'think\\admin\\service\\MessageService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MessageService.php',
         'think\\admin\\service\\ModuleService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ModuleService.php',

+ 4 - 4
vendor/composer/installed.json

@@ -963,12 +963,12 @@
         "source": {
             "type": "git",
             "url": "https://github.com/zoujingli/ThinkLibrary.git",
-            "reference": "822d461c4f23e5ab3cd3489cd740a7171706e367"
+            "reference": "747278ffb2b1a450bc8e6724ffbff105bb9f5f47"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/822d461c4f23e5ab3cd3489cd740a7171706e367",
-            "reference": "822d461c4f23e5ab3cd3489cd740a7171706e367",
+            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/747278ffb2b1a450bc8e6724ffbff105bb9f5f47",
+            "reference": "747278ffb2b1a450bc8e6724ffbff105bb9f5f47",
             "shasum": "",
             "mirrors": [
                 {
@@ -985,7 +985,7 @@
             "ext-mbstring": "*",
             "topthink/framework": "^6.0"
         },
-        "time": "2020-08-17T07:02:36+00:00",
+        "time": "2020-08-17T07:32:11+00:00",
         "type": "library",
         "extra": {
             "think": {

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2020-08-17 15:04:49
+// This file is automatically generated at:2020-08-17 16:07:46
 declare (strict_types = 1);
 return array (
   0 => 'think\\admin\\Library',