content

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

*

  • Copyright 2015 @ 56x.net.
  • name : article
  • author : jarryliu
  • date : -- :
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : 9.content.go
  • author : jarryliu
  • date : -- :
  • description :
  • history :

Index

Constants

View Source
const (
	// FlagInternal 是否内置
	FlagInternal = 1 << iota
	// FlagAll open for all users
	FlagAll
	// PermUser only open for system user
	PermUser
	// FlagMember only open for member
	FlagMember
	// FlagVendor only open for vendor
	FlagVendor
)

Variables

View Source
var (
	ErrCategoryContainArchive = domain.NewError(
		"err_category_contain_archive", "栏目包含文章,不允许删除")

	ErrCategoryAliasExists = domain.NewError(
		"err_category_alias_exists", "已存在相同标识的栏目")

	ErrAliasHasExists = domain.NewError(
		"err_content_alias_exists", "页面别名已存在")

	NotSetCategory = domain.NewError(
		"err_not_set_category", "请选择分类")

	ErrUserNotMatch = domain.NewError(
		"err_content_user_not_match", "用户不匹配")

	ErrNoSuchPage = domain.NewError(
		"err_no_such_page", "页面不存在")

	ErrInternalPage = domain.NewError(
		"err_internal_page", "不允许操作内置页面")
)

Functions

This section is empty.

Types

type Article

type Article struct {
	// 编号
	ID int32 `db:"id" auto:"yes" pk:"yes"`
	// 栏目编号
	CatId int32 `db:"cat_id"`
	// 标题
	Title string `db:"title"`
	// 小标题
	SmallTitle string `db:"small_title"`
	// 文章附图
	Thumbnail string `db:"thumbnail"`
	// 重定向URL
	Location string `db:"location"`
	// 优先级,优先级越高,则置顶
	Priority int `db:"priority"`
	// 浏览钥匙
	AccessKey string `db:"access_key"`
	// 作者
	PublisherId int `db:"publisher_id"`
	// 文档内容
	Content string `db:"content"`
	// 标签(关键词)
	Tags string `db:"tags"`
	// 显示次数
	ViewCount int `db:"view_count"`
	// 排序序号
	SortNum int `db:"sort_num"`
	// 创建时间
	CreateTime int64 `db:"create_time"`
	// 最后修改时间
	UpdateTime int64 `db:"update_time"`
}

Article 文章

type ArticleCategory

type ArticleCategory struct {
	//编号
	ID int32 `db:"id" pk:"yes" auto:"yes"`
	//父类编号,如为一级栏目则为0
	ParentId int32 `db:"parent_id"`
	// 浏览权限
	PermFlag int `db:"perm_flag"`
	// 名称(唯一)
	Name string `db:"name"`
	// 别名
	Alias string `db:"cat_alias"`
	// 排序编号
	SortNum int `db:"sort_num"`
	// 定位路径(打开栏目页定位到的路径)
	Location string `db:"location"`
	// 页面标题
	Title string `db:"title"`
	// 关键字
	Keywords string `db:"keywords"`
	// 描述
	Description string `db:"describe"`
	// 更新时间
	UpdateTime int64 `db:"update_time"`
}

ArticleCategory 栏目

type IArchiveRepo added in v0.4.4

type IArchiveRepo interface {
	// GetContent 获取内容
	GetContent(userId int64) IContent
	// GetPageById 根据编号获取页面
	GetPageById(userId, id int32) *Page
	// GetPageByCode 根据标识获取页面
	GetPageByCode(userId int, code string) *Page
	// DeletePage 删除页面
	DeletePage(userId, id int32) error
	// SavePage 保存页面
	SavePage(userId int32, v *Page) (int32, error)
	// GetAllArticleCategory 获取所有栏目
	GetAllArticleCategory() []*ArticleCategory
	// GetArticleNumByCategory 获取文章数量
	GetArticleNumByCategory(categoryId int32) int
	// SaveCategory 保存栏目
	SaveCategory(v *ArticleCategory) (int32, error)
	// CategoryExists 判断栏目是否存在
	CategoryExists(alias string, id int32) bool
	// DeleteCategory 删除栏目
	DeleteCategory(id int32) error
	// 获取文章
	GetArticleById(id int32) *Article
	// 获取文章列表
	GetArticleList(categoryId int32, begin int, end int) []*Article
	// 保存文章
	SaveArticle(v *Article) (int32, error)
	// 删除文章
	DeleteArticle(id int32) error
}

type IArticle

type IArticle interface {
	// GetDomainId 获取领域编号
	GetDomainId() int32
	// GetValue 获取值
	GetValue() Article
	// SetValue 设置值
	SetValue(*Article) error
	// Category 栏目
	Category() ICategory
	// Save 保存文章
	Save() (int32, error)
}

IArticle 文章

type IArticleManager

type IArticleManager interface {
	// GetCategory 获取栏目
	GetCategory(id int32) ICategory
	// GetCategoryByAlias 根据标识获取文章栏目
	GetCategoryByAlias(alias string) ICategory
	// GetAllCategory 获取所有的栏目
	GetAllCategory() []ICategory
	// CreateCategory 创建栏目
	CreateCategory(*ArticleCategory) ICategory
	// DelCategory 删除栏目
	DelCategory(id int32) error
	// CreateArticle 创建文章
	CreateArticle(*Article) IArticle
	// GetArticle 获取文章
	GetArticle(id int32) IArticle
	// GetArticleList 获取文章列表
	GetArticleList(categoryId int32, begin, end int) []*Article
	// DeleteArticle 删除文章
	DeleteArticle(id int32) error
}

IArticleManager 文章管理器

type ICategory

type ICategory interface {
	// GetDomainId 获取领域编号
	GetDomainId() int32
	// GetValue 获取值
	GetValue() ArticleCategory
	// ArticleNum 获取文章数量
	ArticleNum() int
	// SetValue 设置值
	SetValue(*ArticleCategory) error
	// Save 保存
	Save() (int32, error)
}

ICategory 栏目

type IContent

type IContent interface {
	// GetAggregateRootId 获取聚合根编号
	GetAggregateRootId() int
	// ArticleManager 文章服务
	ArticleManager() IArticleManager
	// CreatePage 创建页面
	CreatePage(*Page) IPage
	// GetPage 获取页面
	GetPage(id int32) IPage
	// GetPageByCode 根据字符串标识获取页面
	GetPageByCode(indent string) IPage
	// DeletePage 删除页面
	DeletePage(id int32) error
}

type IPage

type IPage interface {
	// GetDomainId 获取领域编号
	GetDomainId() int
	// GetValue 获取值
	GetValue() *Page
	// SetValue 设置值
	SetValue(*Page) error
	// Save 保存
	Save() (int32, error)
}

type Page

type Page struct {
	// 编号
	Id int `db:"id" pk:"yes" auto:"yes"`
	// 商户编号
	UserId int `db:"user_id"`
	// 标题
	Title string `db:"title"`
	// 字符标识
	Code string `db:"code"`
	// 浏览权限
	Flag int `db:"flag"`
	// 浏览钥匙
	AccessKey string `db:"access_key"`
	// 关键词
	KeyWord string `db:"keyword"`
	// 描述
	Description string `db:"description"`
	// 样式表地址
	CssPath string `db:"css_path"`
	// 内容
	Content string `db:"content"`
	// 是否启用
	Enabled int `db:"enabled"`
	// 修改时间
	UpdateTime int64 `db:"update_time"`
}

Jump to

Keyboard shortcuts

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