From b0a5221aedb43fe72381d4918456865b3bd3e02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Wed, 6 Mar 2024 03:17:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20PHP=20=E7=89=88=E6=9C=AC=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/requests/website/add.go | 2 +- app/models/website.go | 6 +++--- internal/services/website.go | 6 +++--- internal/website.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/http/requests/website/add.go b/app/http/requests/website/add.go index 81fb95d8..4a9d1a48 100644 --- a/app/http/requests/website/add.go +++ b/app/http/requests/website/add.go @@ -10,7 +10,7 @@ type Add struct { Domains []string `form:"domains" json:"domains"` Ports []uint `form:"ports" json:"ports"` Path string `form:"path" json:"path"` - Php int `form:"php" json:"php"` + Php string `form:"php" json:"php"` Db bool `form:"db" json:"db"` DbType string `form:"db_type" json:"db_type"` DbName string `form:"db_name" json:"db_name"` diff --git a/app/models/website.go b/app/models/website.go index 39aef389..141c3e71 100644 --- a/app/models/website.go +++ b/app/models/website.go @@ -6,9 +6,9 @@ import ( type Website struct { ID uint `gorm:"primaryKey" json:"id"` - Name string `gorm:"unique;not null" json:"name"` - Status bool `gorm:"default:true;not null;index" json:"status"` - Path string `gorm:"not null" json:"path"` + Name string `json:"name"` + Status bool `gorm:"default:true" json:"status"` + Path string `json:"path"` Php int `gorm:"default:0;not null;index" json:"php"` Ssl bool `gorm:"default:false;not null;index" json:"ssl"` Remark string `gorm:"default:''" json:"remark"` diff --git a/internal/services/website.go b/internal/services/website.go index c04798f6..0294cfbd 100644 --- a/internal/services/website.go +++ b/internal/services/website.go @@ -46,7 +46,7 @@ func (r *WebsiteImpl) Add(website internal.PanelWebsite) (models.Website, error) Name: website.Name, Status: website.Status, Path: website.Path, - Php: website.Php, + Php: cast.ToInt(website.Php), Ssl: website.Ssl, Remark: website.Remark, } @@ -161,7 +161,7 @@ server # ssl标记位结束 # php标记位开始 - include enable-php-%d.conf; + include enable-php-%s.conf; # php标记位结束 # waf标记位开始 @@ -514,7 +514,7 @@ func (r *WebsiteImpl) GetConfig(id uint) (internal.WebsiteSetting, error) { setting.Name = website.Name setting.Path = website.Path setting.Ssl = website.Ssl - setting.Php = website.Php + setting.Php = strconv.Itoa(website.Php) setting.Raw = config ports := tools.Cut(config, "# port标记位开始", "# port标记位结束") diff --git a/internal/website.go b/internal/website.go index 544477d2..ef47fb37 100644 --- a/internal/website.go +++ b/internal/website.go @@ -20,7 +20,7 @@ type PanelWebsite struct { Domains []string `json:"domains"` Ports []uint `json:"ports"` Path string `json:"path"` - Php int `json:"php"` + Php string `json:"php"` Ssl bool `json:"ssl"` Remark string `json:"remark"` Db bool `json:"db"` @@ -38,7 +38,7 @@ type WebsiteSetting struct { Root string `json:"root"` Path string `json:"path"` Index string `json:"index"` - Php int `json:"php"` + Php string `json:"php"` OpenBasedir bool `json:"open_basedir"` Ssl bool `json:"ssl"` SslCertificate string `json:"ssl_certificate"`