修复构建报错
This commit is contained in:
+4
-1
@@ -9,9 +9,12 @@ import (
|
||||
"github.com/beego/beego/v2/server/web/context"
|
||||
)
|
||||
|
||||
// 项目版本号
|
||||
const Version = "1.0.0"
|
||||
|
||||
func main() {
|
||||
// 初始化数据库
|
||||
models.Init()
|
||||
models.Init(Version)
|
||||
|
||||
// CORS配置已移至router.go中统一管理
|
||||
// 确保请求体被正确读取(包括 POST、PUT、PATCH)
|
||||
|
||||
@@ -392,7 +392,7 @@ func DeleteUser(id int) error {
|
||||
}
|
||||
|
||||
// Init 初始化数据库
|
||||
func Init() {
|
||||
func Init(version string) {
|
||||
orm.RegisterModel(new(User))
|
||||
orm.RegisterModel(new(Menu))
|
||||
orm.RegisterModel(new(ProgramCategory))
|
||||
@@ -430,5 +430,6 @@ func Init() {
|
||||
// 注意:Beego v2 中不需要显式调用 Using,默认使用 "default"
|
||||
|
||||
fmt.Println("数据库连接成功!")
|
||||
fmt.Printf("当前项目版本: %s\n", version)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user