cms

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 10 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cms

Documentation

Index

Constants

View Source
const (
	CategoryConfigFile = "config_file"
	CategoryDatabase   = "config_db"
	CategoryRedis      = "config_redis"
)

Variables

This section is empty.

Functions

func ApiGetSpaConfig

func ApiGetSpaConfig(ctx server.Context)

ApiGetSpaConfig 开放接口:获取页面主题配置。

func FormatPageTheme

func FormatPageTheme(configs []SpaConfigInfo) (mapConfigs map[string]interface{})

FormatPageTheme 格式化->map

func Init

func Init(opts ...OptionFunc)

func Router

func Router(p server.Router)

Router Theme提供的默认接口

Types

type ConfigCategory

type ConfigCategory string

ConfigCategory 配置类型: file/db/redis/...

type ConfigContentType

type ConfigContentType string
const (
	BooleanConfigContentType ConfigContentType = "boolean"
	NumberConfigContentType  ConfigContentType = "int"
	StringConfigContentType  ConfigContentType = "string"
)

type OptionFunc

type OptionFunc func()

func WithConfigFile

func WithConfigFile(c WebSiteInfo) OptionFunc

func WithDatabase

func WithDatabase() OptionFunc

func WithName

func WithName(name string) OptionFunc

func WithRedis

func WithRedis() OptionFunc

type SpaConfig

type SpaConfig struct {
	Id                int         `orm:"pk;auto;column(id)"`
	Name              WebSiteName `orm:"column(app_name);"`                           //应用名称
	ConfigName        string      `orm:"column(config_name);"`                        //配置字段名称
	ConfigContent     string      `orm:"column(config_content);default()"`            //配置字段内容
	ConfigContentType string      `orm:"column(config_content_Type);default(string)"` //配置字段内容类型
	CreateTime        time.Time   `orm:"auto_now_add;type(datetime);column(ctime)"`
}

SpaConfig SPA一般由vite控制, 使用localstorage管理数据

func (*SpaConfig) TableUnique

func (atc *SpaConfig) TableUnique() [][]string

TableUnique 联合唯一约束

type SpaConfigInfo

type SpaConfigInfo struct {
	Id                int         `json:"id,omitempty"`
	Name              string      `json:"name,omitempty"`
	ConfigPage        string      `json:"configPage,omitempty"`
	ConfigName        string      `json:"configName,omitempty"`
	ConfigContent     interface{} `json:"configContent,omitempty"`
	ConfigContentType string      `json:"configContentType,omitempty"`
}

func GetPageTheme

func GetPageTheme() (configs []SpaConfigInfo)

GetPageTheme 开放方法:获取页面主题配置。从缓存中获取

func GetPageThemeSkipCache

func GetPageThemeSkipCache() (configs []SpaConfigInfo)

GetPageThemeSkipCache 开放方法:获取页面主题配置。跳过缓存

type SpaResp

type SpaResp struct {
	Code    interface{} `json:"code,omitempty"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type WebSite

type WebSite struct {
	app.Pk
	Name      WebSiteName `orm:"column(name)"`      // 应用名称
	BaseUrl   string      `orm:"column(base_url)"`  // url前缀
	Copyright string      `orm:"column(copyright)"` // 版权
	Icp       string      `orm:"column(icp)"`       // icp
	Favicon   string      `orm:"column(favicon)"`   // favicon url
	Attr1     string      `orm:"column(attr1)"`     // 扩展
	Attr2     string      `orm:"column(attr2)"`     // 扩展
	Attr3     string      `orm:"column(attr3)"`     // 扩展
	app.TableChangeInfo
}

WebSite 网站程序配置, 动态html输出

type WebSiteInfo

type WebSiteInfo struct {
	Name      WebSiteName // 应用名称
	BaseUrl   string      // url前缀
	Copyright string      // 版权
	Icp       string      // icp
	Favicon   string      // favicon url
	Attr1     string      // 扩展内容
	Attr2     string      // 扩展内容
	Attr3     string      // 扩展内容
}

func GetWebsiteInfo

func GetWebsiteInfo() (ws WebSiteInfo, err error)

type WebSiteName

type WebSiteName string

Jump to

Keyboard shortcuts

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