mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 01:57:19 +08:00
feat: 初始化网站类型
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
type Website struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"not null;default:'';unique" json:"name"`
|
||||
Type string `gorm:"not null;default:'php'" json:"type"`
|
||||
Status bool `gorm:"not null;default:true" json:"status"`
|
||||
Path string `gorm:"not null;default:''" json:"path"`
|
||||
Https bool `gorm:"not null;default:false" json:"https"`
|
||||
|
||||
@@ -112,6 +112,7 @@ func (r *websiteRepo) Get(id uint) (*types.WebsiteSetting, error) {
|
||||
setting := new(types.WebsiteSetting)
|
||||
setting.ID = website.ID
|
||||
setting.Name = website.Name
|
||||
setting.Type = website.Type
|
||||
setting.Path = website.Path
|
||||
setting.HTTPS = website.Https
|
||||
setting.PHP = p.GetPHP()
|
||||
@@ -347,6 +348,7 @@ func (r *websiteRepo) Create(req *request.WebsiteCreate) (*biz.Website, error) {
|
||||
// 创建面板网站
|
||||
w := &biz.Website{
|
||||
Name: req.Name,
|
||||
Type: "php", // TODO 支持网站类型
|
||||
Status: true,
|
||||
Path: req.Path,
|
||||
Https: false,
|
||||
|
||||
@@ -94,24 +94,21 @@ func init() {
|
||||
},
|
||||
})
|
||||
Migrations = append(Migrations, &gormigrate.Migration{
|
||||
ID: "20250514-user-two-fa",
|
||||
ID: "20250514-user-website",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&biz.User{},
|
||||
)
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
return tx.Migrator().DropColumn(&biz.User{}, "two_fa")
|
||||
},
|
||||
})
|
||||
Migrations = append(Migrations, &gormigrate.Migration{
|
||||
ID: "20250514-user-token",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&biz.Website{},
|
||||
&biz.UserToken{},
|
||||
)
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
if err := tx.Migrator().DropColumn(&biz.User{}, "two_fa"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Migrator().DropColumn(&biz.Website{}, "type"); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Migrator().DropTable(&biz.UserToken{})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -11,6 +11,7 @@ type WebsiteListen struct {
|
||||
type WebsiteSetting struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Listens []WebsiteListen `form:"listens" json:"listens" validate:"required"`
|
||||
Domains []string `json:"domains"`
|
||||
Path string `json:"path"` // 网站目录
|
||||
|
||||
Reference in New Issue
Block a user