pageConfig

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FriendShipLinks = `friendShipLinks`
	WebSettings     = `webSettings`
	FooterLinks     = `footerLinks`
	SponsorsPage    = `sponsors`
	SiteSettings    = `siteSettings`
	EmailSettings   = `emailSetting`
)

Variables

Functions

func CreateOrSave

func CreateOrSave(entity *Entity) int64

func GetConfigByPageType added in v0.0.5

func GetConfigByPageType[T any](pageType string, defaultValue T) T

func GetConfigByPageTypeE added in v0.0.8

func GetConfigByPageTypeE[T any](pageType string, defaultValue T) (T, error)

Types

type Entity

type Entity struct {
	Id        uint64    `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`                              // 主键
	PageType  string    `gorm:"column:page_type;uniqueIndex;type:varchar(128);not null;default:'';" json:"pageType"` // 页面类型
	Config    string    `gorm:"column:config;type:text;" json:"content"`                                             //
	CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"`                  //
	UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}

func Get

func Get(id any) (entity Entity)

func GetByPageType

func GetByPageType(pageType string) (entity Entity)

func (*Entity) TableName

func (itself *Entity) TableName() string

type FooterConfig added in v0.0.8

type FooterConfig struct {
	Primary []PItem       `json:"primary"`
	List    []FooterGroup `json:"list"`
}

type FooterGroup added in v0.0.8

type FooterGroup struct {
	Name     string       `json:"name"`
	Children []FooterItem `json:"children"`
}

type FooterItem added in v0.0.8

type FooterItem struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type FriendLinksGroup added in v0.0.5

type FriendLinksGroup struct {
	Name  string     `json:"name,omitempty"`
	Links []LinkItem `json:"links,omitempty"`
}

type LinkItem added in v0.0.5

type LinkItem struct {
	Name    string `json:"name"`
	Desc    string `json:"desc"`
	Url     string `json:"url"`
	LogoUrl string `json:"logoUrl"`
}

type MailSettingsConfig added in v0.0.8

type MailSettingsConfig struct {
	// SMTP服务器设置
	EnableMail   bool   `json:"enableMail"`
	SmtpHost     string `json:"smtpHost"`
	SmtpPort     int    `json:"smtpPort"`
	UseSSL       bool   `json:"useSSL"`
	SmtpUsername string `json:"smtpUsername"`
	SmtpPassword string `json:"smtpPassword"`
	FromName     string `json:"fromName"`
	FromEmail    string `json:"fromEmail"`
}

邮件设置配置

type PItem added in v0.0.8

type PItem struct {
	Content string `json:"content"`
}

type SiteSettingsConfig added in v0.0.8

type SiteSettingsConfig struct {
	// 站点基本信息
	SiteName        string `json:"siteName"`
	SiteDescription string `json:"siteDescription"`
	SiteKeywords    string `json:"siteKeywords"`
	SiteUrl         string `json:"siteUrl"`

	// 其他设置
	Timezone           string `json:"timezone"`
	DefaultLanguage    string `json:"defaultLanguage"`
	MaintenanceMode    bool   `json:"maintenanceMode"`
	MaintenanceMessage string `json:"maintenanceMessage"`

	// 邮件设置
	MailSettings MailSettingsConfig `json:"mailSettings"`
}

站点设置配置

type SponsorItem added in v0.0.8

type SponsorItem struct {
	Name string   `json:"name"`
	Info string   `json:"info"`
	Url  string   `json:"url"`
	Tag  []string `json:"tag"`
}

赞助商相关数据结构

type Sponsors added in v0.0.8

type Sponsors struct {
	Level0 []SponsorItem `json:"level0"`
	Level1 []SponsorItem `json:"level1"`
	Level2 []SponsorItem `json:"level2"`
	Level3 []SponsorItem `json:"level3"`
}

type SponsorsConfig added in v0.0.8

type SponsorsConfig struct {
	Sponsors Sponsors      `json:"sponsors"`
	Users    []UserSponsor `json:"users"`
}

type UserSponsor added in v0.0.8

type UserSponsor struct {
	Name   string `json:"name"`
	Amount string `json:"amount"`
	Time   string `json:"time"`
}

type WebSettingsConfig added in v0.0.5

type WebSettingsConfig struct {
	ExternalLinks string `json:"externalLinks,omitempty"`
	Favicon       string `json:"favicon,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL