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 是否内置 FCategoryInternal = 1 << iota // FCategoryPost 是否支持投稿 FCategoryPost = 2 // FCategoryOpen 是否对会员显示 FCategoryOpen = 4 )
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", "页面别名已存在") ErrInvalidCategory = domain.NewError( "err_invalid_category", "文章分类不正确") ErrDisallowPostArticle = domain.NewError( "err_disallow_post_article", "分类不允许投稿") 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 int `db:"id" pk:"yes" auto:"yes" json:"id" bson:"id"`
// 分类编号
CatId int `db:"cat_id" json:"catId" bson:"catId"`
// 标题
Title string `db:"title" json:"title" bson:"title"`
// ShortTitle
ShortTitle string `db:"short_title" json:"shortTitle" bson:"shortTitle"`
// 标志
Flag int `db:"flag" json:"flag" bson:"flag"`
// 缩略图
Thumbnail string `db:"thumbnail" json:"thumbnail" bson:"thumbnail"`
// 访问密钥
AccessToken string `db:"access_token" json:"accessToken" bson:"accessToken"`
// 作者
PublisherId int `db:"publisher_id" json:"publisherId" bson:"publisherId"`
// 地址
Location string `db:"location" json:"location" bson:"location"`
// 优先级
Priority int `db:"priority" json:"priority" bson:"priority"`
// 短标题
MchId int `db:"mch_id" json:"mchId" bson:"mchId"`
// 内容
Content string `db:"content" json:"content" bson:"content"`
// 标签
Tags string `db:"tags" json:"tags" bson:"tags"`
// 喜欢的数量
LikeCount int `db:"like_count" json:"likeCount" bson:"likeCount"`
// 不喜欢的数量
DislikeCount int `db:"dislike_count" json:"dislikeCount" bson:"dislikeCount"`
// 浏览次数
ViewCount int `db:"view_count" json:"viewCount" bson:"viewCount"`
// 排列序号
SortNum int `db:"sort_num" json:"sortNum" bson:"sortNum"`
// 创建时间
CreateTime int `db:"create_time" json:"createTime" bson:"createTime"`
// 更新时间
UpdateTime int `db:"update_time" json:"updateTime" bson:"updateTime"`
}
Article 文章
type Category ¶
type Category struct {
// 编号
Id int `json:"id" db:"id" gorm:"column:id" pk:"yes" auto:"yes" bson:"id"`
// 上级编号
Pid int `json:"pid" db:"pid" gorm:"column:pid" bson:"pid"`
// 权限标志
Flag int `json:"flag" db:"flag" gorm:"column:flag" bson:"flag"`
// 分类编号
Name string `json:"name" db:"name" gorm:"column:name" bson:"name"`
// 分类别名
Alias string `json:"alias" db:"alias" gorm:"column:alias" bson:"alias"`
// 标题
Title string `json:"title" db:"title" gorm:"column:title" bson:"title"`
// 关键词
Keywords string `json:"keywords" db:"keywords" gorm:"column:keywords" bson:"keywords"`
// 描述
Description string `json:"description" db:"description" gorm:"column:description" bson:"description"`
// 排序编号
SortNo int `json:"sortNo" db:"sort_no" gorm:"column:sort_no" bson:"sortNo"`
// 地址
Location string `json:"location" db:"location" gorm:"column:location" bson:"location"`
// 更新时间
UpdateTime int `json:"updateTime" db:"update_time" gorm:"column:update_time" bson:"updateTime"`
}
Category 栏目
type IArticle ¶
type IArticle interface {
domain.IDomain
// GetValue 获取值
GetValue() Article
// SetValue 设置值
SetValue(*Article) error
// Category 栏目
Category() *Category
// Save 保存文章
Save() error
// Destory 删除文章
Destory() error
// 增加浏览次数
IncreaseViewCount(count int) error
// 喜欢
Like(memberId int) error
// 不喜欢
Dislike(memberId int) error
}
IArticle 文章
type IArticleCategoryRepo ¶
type IArticleCategoryRepo interface {
fw.Repository[Category]
}
IArticleCategoryRepo 文章栏目仓储
type IArticleManager ¶
type IArticleManager interface {
// GetCategory 获取栏目
GetCategory(id int) *Category
// GetCategoryByAlias 根据标识获取文章栏目
GetCategoryByAlias(alias string) *Category
// GetAllCategory 获取所有的栏目
GetAllCategory() []Category
// SaveCategory 保存栏目
SaveCategory(v *Category) error
// DeleteCategory 删除栏目
DeleteCategory(id int) error
// CreateArticle 创建文章
CreateArticle(*Article) IArticle
// GetArticle 获取文章
GetArticle(id int) IArticle
}
IArticleManager 文章管理器
type IArticleRepo ¶
type IArticleRepo interface {
fw.Repository[Article]
// GetContent 获取内容
GetContent(userId int64) IContentAggregateRoot
// GetArticleNumByCategory 获取文章数量
GetArticleNumByCategory(categoryId int) int
}
IArticleManager 文章服务
type IContentAggregateRoot ¶
type IContentAggregateRoot interface {
d.IAggregateRoot
// ArticleManager 文章服务
ArticleManager() IArticleManager
// PageManager 页面服务
PageManager() IPageManager
}
type IPage ¶
type IPage interface {
domain.IDomain
// GetValue 获取值
GetValue() *Page
// SetValue 设置值
SetValue(*Page) error
// Save 保存
Save() (int, error)
}
IPage 页面
type IPageManager ¶
type IPageManager interface {
// CreatePage 创建页面
CreatePage(*Page) IPage
// GetPage 获取页面
GetPage(id int) IPage
// GetPageByCode 根据字符串标识获取页面
GetPageByCode(indent string) IPage
// DeletePage 删除页面
DeletePage(id int) error
}
IPageManager 页面管理器
type IPageRepo ¶
type IPageRepo interface {
fw.Repository[Page]
// GetPageById 根据编号获取页面
GetPageById(tenantId, id int) IPage
// GetPageByCode 根据标识获取页面
GetPageByCode(tenantId int, code string) IPage
// DeletePage 删除页面
DeletePage(tenantId, id int) error
// SavePage 保存页面
SavePage(zondId int, v *Page) error
}
IPageRepo 页面仓储
type Page ¶
type Page struct {
// 编号
Id int `json:"id" db:"id" gorm:"column:id" pk:"yes" auto:"yes" bson:"id"`
// 用户编号,系统为0
UserId int `json:"userId" db:"user_id" gorm:"column:user_id" bson:"userId"`
// 标题
Title string `json:"title" db:"title" gorm:"column:title" bson:"title"`
// 标志
Flag int `json:"flag" db:"flag" gorm:"column:flag" bson:"flag"`
// 访问钥匙
AccessKey string `json:"accessKey" db:"access_key" gorm:"column:access_key" bson:"accessKey"`
// 页面代码
Code string `json:"code" db:"code" gorm:"column:code" bson:"code"`
// 关键词
Keyword string `json:"keyword" db:"keyword" gorm:"column:keyword" bson:"keyword"`
// 描述
Description string `json:"description" db:"description" gorm:"column:description" bson:"description"`
// 样式表路径
CssPath string `json:"cssPath" db:"css_path" gorm:"column:css_path" bson:"cssPath"`
// 是否启用
Enabled int `json:"enabled" db:"enabled" gorm:"column:enabled" bson:"enabled"`
// 内容
Content string `json:"content" db:"content" gorm:"column:content" bson:"content"`
// 更新时间
UpdateTime int `json:"updateTime" db:"update_time" gorm:"column:update_time" bson:"updateTime"`
}
Page 页面
Click to show internal directories.
Click to hide internal directories.