diff --git a/server/api/v1/system/sys_initdb.go b/server/api/v1/system/sys_initdb.go index 70645aa12..d3d66a530 100644 --- a/server/api/v1/system/sys_initdb.go +++ b/server/api/v1/system/sys_initdb.go @@ -45,13 +45,16 @@ func (i *DBApi) InitDB(c *gin.Context) { // @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}" // @Router /init/checkdb [post] func (i *DBApi) CheckDB(c *gin.Context) { + var ( + message = "前往初始化数据库" + needInit = true + ) + if global.GVA_DB != nil { - global.GVA_LOG.Info("数据库无需初始化") - response.OkWithDetailed(gin.H{"needInit": false}, "数据库无需初始化", c) - return - } else { - global.GVA_LOG.Info("前往初始化数据库") - response.OkWithDetailed(gin.H{"needInit": true}, "前往初始化数据库", c) - return + message = "数据库无需初始化" + needInit = false } + global.GVA_LOG.Info(message) + response.OkWithDetailed(gin.H{"needInit": needInit}, message, c) + return }