fix: 优化安装代码

This commit is contained in:
tangtanglove
2023-02-17 13:27:05 +08:00
parent a10cbd57f5
commit 68f217fb05
7 changed files with 8 additions and 11 deletions

View File

@@ -46,7 +46,7 @@ func main() {
b.Static("/", "./website")
// 自动构建数据库、拉取静态文件
b.Use(install.Handle)
install.Handle()
// 后台中间件
b.Use(middleware.Handle)

View File

@@ -55,7 +55,7 @@ func main() {
b := builder.New(config)
// 初始化安装
b.Use(install.Handle)
install.Handle()
// 中间件
b.Use(middleware.Handle)

View File

@@ -35,7 +35,7 @@ func main() {
b := builder.New(config)
// 初始化安装
b.Use(install.Handle)
install.Handle()
// 中间件
b.Use(middleware.Handle)

View File

@@ -44,7 +44,7 @@ func main() {
b := builder.New(config)
// 初始化安装
b.Use(install.Handle)
install.Handle()
// 中间件
b.Use(middleware.Handle)

View File

@@ -30,7 +30,7 @@ func main() {
b.Static("/", "./website")
// 自动构建数据库、拉取静态文件
b.Use(install.Handle)
install.Handle()
// 后台中间件
b.Use(middleware.Handle)

View File

@@ -4,7 +4,6 @@ import (
"os"
"github.com/quarkcms/quark-go/pkg/app/model"
"github.com/quarkcms/quark-go/pkg/builder"
"github.com/quarkcms/quark-go/pkg/dal/db"
"gorm.io/gorm"
)
@@ -23,11 +22,11 @@ func PathExist(path string) bool {
}
// 执行安装操作
func Handle(ctx *builder.Context) error {
func Handle() {
// 如果锁定文件存在则不执行安装步骤
if PathExist("install.lock") {
return ctx.Next()
return
}
// 迁移数据
@@ -62,6 +61,4 @@ func Handle(ctx *builder.Context) error {
// 创建锁定文件
file, _ := os.Create("install.lock")
file.Close()
return ctx.Next()
}

View File

@@ -19,7 +19,7 @@ const (
AppName = "QuarkGo"
// Version of current package
Version = "1.1.11"
Version = "1.1.12"
// 静态文件URL
RespositoryURL = "https://github.com/quarkcms/quark-go/tree/main/website/"