2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 10:17:17 +08:00
Files
panel/internal/biz/website.go
Copilot f2e41a3364 feat: 添加操作日志记录功能和前端日志查看页面 (#1227)
* Initial plan

* feat: 添加操作日志记录功能和前端日志查看页面

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: 修复 HttpLog 中 IP 字符串处理的类型安全问题

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: lint

* feat: 完善面板内日志记录,添加网站/数据库/项目/计划任务/备份CRUD日志

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: 完善更多模块的日志记录(证书/SSH/Webhook/用户/设置/安全)

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: 改进cert_dns删除方法,在删除前获取实体信息用于日志记录

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: lint

* feat: 从session获取操作员ID并在前端显示用户名

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: lint

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
2026-01-12 23:31:22 +08:00

53 lines
1.8 KiB
Go

package biz
import (
"context"
"time"
"github.com/acepanel/panel/internal/http/request"
"github.com/acepanel/panel/pkg/types"
)
type WebsiteType string
const (
WebsiteTypeProxy WebsiteType = "proxy"
WebsiteTypePHP WebsiteType = "php"
WebsiteTypeStatic WebsiteType = "static"
)
type Website struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null;default:'';unique" json:"name"`
Type WebsiteType `gorm:"not null;index;default:'static'" json:"type"`
Status bool `gorm:"not null;default:true" json:"status"`
Path string `gorm:"not null;default:''" json:"path"`
SSL bool `gorm:"not null;default:false" json:"ssl"`
Remark string `gorm:"not null;default:''" json:"remark"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CertExpire string `gorm:"-:all" json:"cert_expire"` // 仅显示
PHP uint `gorm:"-:all" json:"php"` // 仅显示
Cert *Cert `gorm:"foreignKey:WebsiteID" json:"cert"`
}
type WebsiteRepo interface {
GetRewrites() (map[string]string, error)
UpdateDefaultConfig(req *request.WebsiteDefaultConfig) error
Count() (int64, error)
Get(id uint) (*types.WebsiteSetting, error)
GetByName(name string) (*types.WebsiteSetting, error)
List(typ string, page, limit uint) ([]*Website, int64, error)
Create(ctx context.Context, req *request.WebsiteCreate) (*Website, error)
Update(ctx context.Context, req *request.WebsiteUpdate) error
Delete(ctx context.Context, req *request.WebsiteDelete) error
ClearLog(id uint) error
UpdateRemark(id uint, remark string) error
ResetConfig(id uint) error
UpdateStatus(id uint, status bool) error
UpdateCert(req *request.WebsiteUpdateCert) error
ObtainCert(ctx context.Context, id uint) error
}