content

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 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 : content.go
  • author : jarryliu
  • date : -- :
  • description :
  • history :

Index

Constants

View Source
const (
	// open for all users
	PermAll int = 1 << iota
	// only open for system user
	PermUser
	// only open for member
	PermMember
	// only open for vendor
	PermVendor
)

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", "用户不匹配")
)

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"`
}

文章

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"`
}

栏目

type IArticle

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

文章

type IArticleManager

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

文章管理器

type ICategory

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

栏目

type IContent

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

type IContentRepo

type IContentRepo interface {
	// 获取内容
	GetContent(userId int64) IContent
	// 根据编号获取页面
	GetPageById(userId, id int32) *Page
	// 根据标识获取页面
	GetPageByStringIndent(userId int32, indent string) *Page
	// 删除页面
	DeletePage(userId, id int32) error
	// 保存页面
	SavePage(userId int32, v *Page) (int32, error)
	// 获取所有栏目
	GetAllArticleCategory() []*ArticleCategory
	// 获取文章数量
	GetArticleNumByCategory(categoryId int32) int
	// 保存栏目
	SaveCategory(v *ArticleCategory) (int32, error)
	// 判断栏目是否存在
	CategoryExists(alias string, id int32) bool
	// 删除栏目
	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 IPage

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

type Page

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

Jump to

Keyboard shortcuts

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