cmd剔除 初始数据结构转移 修复初始携带apibug

This commit is contained in:
pixel
2021-03-04 16:02:09 +08:00
parent e3057c4bd9
commit e6768d5e17
18 changed files with 117 additions and 21 deletions

View File

@@ -16,7 +16,7 @@ import (
// @Produce application/json
// @Param data body request.InitDB true "初始化数据库参数"
// @Success 200 {string} string "{"code":0,"data":{},"msg":"自动创建数据库成功"}"
// @Router /initdb [post]
// @Router /init/initdb [post]
func InitDB(c *gin.Context) {
if global.GVA_DB != nil {
global.GVA_LOG.Error("非法访问")
@@ -36,3 +36,24 @@ func InitDB(c *gin.Context) {
}
response.OkWithData("自动创建数据库成功", c)
}
// @Tags CheckDB
// @Summary 初始化用户数据库
// @Produce application/json
// @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}"
// @Router /init/checkdb [post]
func CheckDB(c *gin.Context) {
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
}
}