Browse Source

更新前端检测升级模块样式

docker-svn
witersen 3 years ago
parent
commit
d115293b3d
  1. 245
      01.web/src/views/advance/index.vue
  2. 43
      02.php/app/service/Update.php
  3. 6
      02.php/server/update.json

245
01.web/src/views/advance/index.vue

@ -386,7 +386,10 @@
placement="top" placement="top"
transfer transfer
> >
<Button type="primary" :loading="loadingCheckUpdate" @click="CheckUpdate()" <Button
type="primary"
:loading="loadingCheckUpdate"
@click="CheckUpdate()"
>检测更新</Button >检测更新</Button
> >
</Tooltip> </Tooltip>
@ -397,32 +400,82 @@
</Tabs> </Tabs>
</Card> </Card>
<Modal v-model="modalSofawareUpdateGet" title="最新版本信息"> <Modal v-model="modalSofawareUpdateGet" title="最新版本信息">
<Form ref="formSoftwareNew" :model="formSoftwareNew" :label-width="90"> <Scroll>
<Form ref="formUpdate" :model="formUpdate" :label-width="90">
<FormItem label="最新版本"> <FormItem label="最新版本">
<Badge dot> <Badge dot>
{{ formSoftwareNew.latestVersion }} {{ formUpdate.version }}
</Badge> </Badge>
</FormItem> </FormItem>
<FormItem label="升级类型"> <FormItem label="修复内容">
<Badge> <ul style="list-style: none">
{{ formSoftwareNew.updateStep }} <li v-for="(item, index) in formUpdate.fixd.con" :key="index">
</Badge> <span> [{{ item.title }}] {{ item.content }} </span>
</li>
</ul>
</FormItem>
<FormItem label="新增内容">
<ul style="list-style: none">
<li v-for="(item, index) in formUpdate.add.con" :key="index">
<span> [{{ item.title }}] {{ item.content }} </span>
</li>
</ul>
</FormItem>
<FormItem label="移除内容">
<ul style="list-style: none">
<li v-for="(item, index) in formUpdate.remove.con" :key="index">
<span> [{{ item.title }}] {{ item.content }} </span>
</li>
</ul>
</FormItem> </FormItem>
<FormItem label="修复bug"> <FormItem label="移除内容">
<i-input <ul style="list-style: none">
v-html="formSoftwareNew.fixedContent" <li v-for="(item, index) in formUpdate.remove.con" :key="index">
type="textarea" <span> [{{ item.title }}] {{ item.content }} </span>
autosize </li>
></i-input> </ul>
</FormItem>
<FormItem label="完整程序包">
<ul style="list-style: none">
<li
v-for="(item, index) in formUpdate.release.download"
:key="index"
>
[{{ index + 1 }}] {{ item.nodeName }}节点
<ul style="list-style: none">
<li>
<a :href="item.url" target="_blank">下载</a>
</li>
</ul>
</li>
</ul>
</FormItem>
<FormItem label="升级程序包">
<ul style="list-style: none">
<li
v-for="(item1, index1) in formUpdate.update.download"
:key="index1"
>
[{{ index1 + 1 }}] {{ item1.nodeName }}节点
<ul style="list-style: none">
<li v-for="(item2, index2) in item1.packages" :key="index2">
<a :href="item2.url" target="_blank"
>{{ item2.for.source }} -> {{ item2.for.dest }}</a
>
</li>
</ul>
</li>
</ul>
</FormItem> </FormItem>
<FormItem label="新增功能"> <FormItem label="升级步骤">
<i-input <ul style="list-style: none">
v-html="formSoftwareNew.newContent" <li v-for="(item, index) in formUpdate.update.step" :key="index">
type="textarea" <span> [{{ item.title }}] {{ item.content }} </span>
autosize </li>
></i-input> </ul>
</FormItem> </FormItem>
</Form> </Form>
</Scroll>
</Modal> </Modal>
</div> </div>
</template> </template>
@ -462,7 +515,7 @@ export default {
current_verson: "2.3", current_verson: "2.3",
php_version: "5.5 <= PHP < 8.0", php_version: "5.5 <= PHP < 8.0",
database: "MYSQL、SQLite", database: "MYSQL、SQLite",
github: "https://github.com/witersen/svnAdminV2.0", github: "https://github.com/witersen/SvnAdminV2.0",
gitee: "https://gitee.com/witersen/SvnAdminV2.0", gitee: "https://gitee.com/witersen/SvnAdminV2.0",
}, },
@ -486,7 +539,7 @@ export default {
// //
loadingEditPush: false, loadingEditPush: false,
// //
loadingCheckUpdate:false, loadingCheckUpdate: false,
/** /**
* subversion信息 * subversion信息
@ -528,24 +581,142 @@ export default {
port: 0, port: 0,
to: "", to: "",
from: "", from: "",
// autotls: true,
// auth: false,
// host: "",
// encryption: "none",
// port: 25,
// user: "",
// pass: "",
// from: "",
status: false, status: false,
}, },
// //
formSoftwareNew: { formUpdate: {
newContent: "", version: "2.4",
latestVersion: "", fixd: {
fixedContent: "", con: [
updateType: "", {
updateStep: "", title: "1",
content: "修复SVN仓库权限配置的bug",
},
{
title: "2",
content: "完善用户权限控制逻辑",
},
],
},
add: {
con: [
{
title: "1",
content: "支持文件级授权",
},
{
title: "2",
content: "支持目录浏览",
},
{
title: "3",
content: "支持仓库备份与恢复",
},
{
title: "4",
content: "支持SVN用户禁用与启动",
},
{
title: "5",
content: "支持用户级日志记录",
},
{
title: "6",
content: "兼容PHP5.5+",
},
],
},
remove: {
con: [
{
title: "1",
content: "暂时移除仓库钩子的配置功能",
},
],
},
release: {
download: [
{
nodeName: "gitee.com",
url: "",
},
{
nodeName: "github.com",
url: "",
},
{
nodeName: "witersen.com",
url: "https://download.witersen.com/SVNAdmin/SVNAdmin-2.3.zip",
},
],
},
update: {
step: [
{
title: "1",
content: "php ${your_path}/server/install.php",
},
],
download: [
{
nodeName: "gitee.com",
packages: [
{
for: {
source: "2.3",
dest: "2.4",
},
url: "xxx",
},
{
for: {
source: "2.3",
dest: "2.5",
},
url: "xxx",
},
],
},
{
nodeName: "github.com",
packages: [
{
for: {
source: "2.3",
dest: "2.4",
},
url: "xxx",
},
{
for: {
source: "2.3",
dest: "2.5",
},
url: "xxx",
},
],
},
{
nodeName: "witersen.com",
packages: [
{
for: {
source: "2.3",
dest: "2.4",
},
url: "xxx",
},
{
for: {
source: "2.3",
dest: "2.5",
},
url: "xxx",
},
],
},
],
},
}, },
}; };
}, },
@ -1013,7 +1184,7 @@ export default {
var result = response.data; var result = response.data;
if (result.status == 1) { if (result.status == 1) {
if (result.data != "") { if (result.data != "") {
that.formSoftwareNew = result.data; that.formUpdate = result.data;
that.modalSofawareUpdateGet = true; that.modalSofawareUpdateGet = true;
} else { } else {
that.$Message.success(result.message); that.$Message.success(result.message);

43
02.php/app/service/Update.php

@ -3,7 +3,7 @@
* @Author: witersen * @Author: witersen
* @Date: 2022-04-24 23:37:05 * @Date: 2022-04-24 23:37:05
* @LastEditors: witersen * @LastEditors: witersen
* @LastEditTime: 2022-05-09 11:41:40 * @LastEditTime: 2022-05-10 00:01:53
* @Description: QQ:1801168257 * @Description: QQ:1801168257
*/ */
@ -21,33 +21,28 @@ class Update extends Base
*/ */
public function CheckUpdate() public function CheckUpdate()
{ {
foreach ($this->config_update['update_server'] as $key => $value) { foreach ($this->config_update['update_server'] as $key1 => $value1) {
$versionInfo = FunCurlRequest($value['url']);
if ($versionInfo != null) { $json = FunCurlRequest($value1['url']);
$versionInfo = json_decode($versionInfo, true);
$latestVersion = $versionInfo['latestVersion']; if ($json == null) {
if ($latestVersion == $this->config_version['version']) { continue;
return message(200, 1, '当前版本为最新版');
} else if ($latestVersion > $this->config_version['version']) {
return message(200, 1, '有更新', [
'latestVersion' => $versionInfo['latestVersion'],
'fixedContent' => implode('<br>', $versionInfo['fixedContent']) == '' ? '暂无内容' : implode('<br>', $versionInfo['fixedContent']),
'newContent' => implode('<br>', $versionInfo['newContent']) == '' ? '暂无内容' : implode('<br>', $versionInfo['newContent']),
'updateType' => $versionInfo['updateType'],
'updateStep' => $versionInfo['updateStep']
]);
} else if ($latestVersion < $this->config_version['version']) {
return message(200, 0, '系统版本错误');
} }
//json => array
$array = json_decode($json, true);
$last = $array['version'];
if ($this->config_version['version'] == $last) {
return message(200, 1, '当前为最新版');
} }
if ($this->config_version['version'] < $last) {
return message(200, 1, '有新版本', $array);
} }
return message(200, 0, '检测更新超时');
} }
/** return message(200, 0, '检测超时');
* 确认更新
*/
public function StartUpdate()
{
} }
} }

6
02.php/server/update.json

@ -68,7 +68,11 @@
"step": [ "step": [
{ {
"title": "1", "title": "1",
"content": "php ${your_path}/server/install.php" "content": "登录服务器控制台"
},
{
"title": "2",
"content": "执行命令 php ${your_path}/server/install.php"
} }
], ],
"download": [ "download": [

Loading…
Cancel
Save