Commit 9446dc52 authored by 王曜嵚 Wang Yaoqin's avatar 王曜嵚 Wang Yaoqin

dev: 状态

parent 289f8281
...@@ -11,10 +11,6 @@ export default defineEventHandler(async (event) => { ...@@ -11,10 +11,6 @@ export default defineEventHandler(async (event) => {
LogUtil.printInfo(username, '程序启动中') LogUtil.printInfo(username, '程序启动中')
await changeProjectStatus( 'v1', username, 'status', 'running') await changeProjectStatus( 'v1', username, 'status', 'running')
const rowV2 = await getPgTableData('v2', username)
if (rowV2?.status === 'launched') {
await changeProjectStatus('v2', username, 'status', 'compiled')
}
if (!container) { if (!container) {
throw new Error('没有创建容器,请先初始化容器') throw new Error('没有创建容器,请先初始化容器')
} }
......
...@@ -14,10 +14,6 @@ export default defineEventHandler(async (event) => { ...@@ -14,10 +14,6 @@ export default defineEventHandler(async (event) => {
LogUtil.printInfo(username, `程序初始化中......`) LogUtil.printInfo(username, `程序初始化中......`)
await changeProjectStatus( 'v2', username, 'status', 'running') await changeProjectStatus( 'v2', username, 'status', 'running')
const rowV1 = await getPgTableData('v1', username)
if (rowV1?.status === 'launched') {
await changeProjectStatus('v2', username, 'status', 'compiled')
}
if (!container) { if (!container) {
throw new Error('没有创建容器,请先初始化容器') throw new Error('没有创建容器,请先初始化容器')
} }
......
...@@ -170,11 +170,15 @@ class Docker { ...@@ -170,11 +170,15 @@ class Docker {
if (platform === 'v1') { if (platform === 'v1') {
await this.switchJavaVersion({ container, username, version: 8 }) await this.switchJavaVersion({ container, username, version: 8 })
const statusV2 = (await getPgTableData( 'v2', username))?.status const statusV2 = (await getPgTableData( 'v2', username))?.status
if (statusV2) changeProjectStatus( 'v2', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态 if (statusV2 === 'launched' || statusV2 === 'debug-launched') {
await changeProjectStatus( 'v2', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态
}
} else { } else {
await this.switchJavaVersion({ container, username, version: 17 }) await this.switchJavaVersion({ container, username, version: 17 })
const statusV1 = (await getPgTableData( 'v1', username))?.status const statusV1 = (await getPgTableData( 'v1', username))?.status
if (statusV1) changeProjectStatus( 'v1', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态 if (statusV1 === 'launched') {
await changeProjectStatus( 'v1', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment