mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复检查更新
This commit is contained in:
parent
2546cebdea
commit
83255280b9
|
@ -414,7 +414,7 @@ export default class UserService {
|
|||
return {
|
||||
code: 200,
|
||||
data: {
|
||||
hasNewVersion: currentVersion !== lastVersion,
|
||||
hasNewVersion: this.checkHasNewVersion(currentVersion, lastVersion),
|
||||
lastVersion,
|
||||
lastLog,
|
||||
},
|
||||
|
@ -427,6 +427,25 @@ export default class UserService {
|
|||
}
|
||||
}
|
||||
|
||||
private checkHasNewVersion(curVersion: string, lastVersion: string) {
|
||||
const curArr = curVersion.split('.').map((x) => parseInt(x, 10));
|
||||
const lastArr = lastVersion.split('.').map((x) => parseInt(x, 10));
|
||||
if (curArr[0] < lastArr[0]) {
|
||||
return true;
|
||||
}
|
||||
if (curArr[0] === lastArr[0] && curArr[1] < lastArr[1]) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
curArr[0] === lastArr[0] &&
|
||||
curArr[1] === lastArr[1] &&
|
||||
curArr[2] < lastArr[2]
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public async updateSystem() {
|
||||
const cp = spawn('ql -l update', { shell: '/bin/bash' });
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
|||
const checkUpgrade = () => {
|
||||
if (updateLoading) return;
|
||||
setUpdateLoading(true);
|
||||
const hide = message.loading('检查更新中...', 0);
|
||||
message.loading('检查更新中...', 0);
|
||||
request
|
||||
.put(`${config.apiPrefix}system/update-check`)
|
||||
.then((_data: any) => {
|
||||
|
@ -107,13 +107,13 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
|||
if (!modalRef.current || !socketMessage) {
|
||||
return;
|
||||
}
|
||||
const { type, message, references } = socketMessage;
|
||||
const { type, message: _message, references } = socketMessage;
|
||||
|
||||
if (type !== 'updateSystemVersion') {
|
||||
return;
|
||||
}
|
||||
|
||||
const newMessage = `${value} \n ${message}`;
|
||||
const newMessage = `${value}\n${_message}`;
|
||||
modalRef.current.update({
|
||||
content: (
|
||||
<div style={{ height: '60vh', overflowY: 'auto' }}>
|
||||
|
@ -138,7 +138,7 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
|||
.getElementById('log-identifier')!
|
||||
.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
|
||||
if (newMessage.includes('重启面板')) {
|
||||
if (_message.includes('重启面板')) {
|
||||
message.warning({
|
||||
content: (
|
||||
<span>
|
||||
|
|
Loading…
Reference in New Issue
Block a user