自动初始化整体调试完成
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/model/response"
|
||||
"gin-vue-admin/service"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -31,7 +30,7 @@ func InitDB(c *gin.Context) {
|
||||
}
|
||||
if err := service.InitDB(dbInfo); err != nil {
|
||||
global.GVA_LOG.Error("自动创建数据库失败", zap.Any("err", err))
|
||||
response.FailWithMessage("自动创建数据库失败", c)
|
||||
response.FailWithMessage("自动创建数据库失败,请查看后台日志", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData("自动创建数据库成功", c)
|
||||
@@ -43,17 +42,17 @@ func InitDB(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}"
|
||||
// @Router /init/checkdb [post]
|
||||
func CheckDB(c *gin.Context) {
|
||||
if global.GVA_DB == nil {
|
||||
if global.GVA_DB != nil {
|
||||
global.GVA_LOG.Info("数据库无需初始化")
|
||||
response.OkWithDetailed(gin.H{
|
||||
"needInit":false,
|
||||
},"数据库无需初始化", c)
|
||||
"needInit": false,
|
||||
}, "数据库无需初始化", c)
|
||||
return
|
||||
}else{
|
||||
} else {
|
||||
global.GVA_LOG.Info("前往初始化数据库")
|
||||
response.OkWithDetailed(gin.H{
|
||||
"needInit":true,
|
||||
},"前往初始化数据库", c)
|
||||
"needInit": true,
|
||||
}, "前往初始化数据库", c)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user