Documentation ¶
Index ¶
- Constants
- Variables
- func ContentHideDetectorRegister(k string, description string, hideDetector ContentHideDetectorFunc, v string, ...)
- func GetContentHideDetector(customer *dbschema.OfficialCustomer, article *dbschema.OfficialCommonArticle) top.HideDetector
- func WithSourceInfo(ctx echo.Context, list []*ArticleAndSourceInfo) error
- type Article
- func (f *Article) Add() (pk interface{}, err error)
- func (f *Article) CommonQueryList(cond *db.Compounds, limit int, offset int, orderby ...interface{}) []*ArticleWithOwner
- func (f *Article) CustomerPendingCount(customerID interface{}) (int64, error)
- func (f *Article) CustomerPendingTodayCount(customerID interface{}) (int64, error)
- func (f *Article) CustomerTodayCount(customerID interface{}) (int64, error)
- func (f *Article) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Article) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Article) GetCategories(rows ...*dbschema.OfficialCommonArticle) ([]dbschema.OfficialCommonCategory, error)
- func (f *Article) IsAllowedComment(customer *dbschema.OfficialCustomer) error
- func (f *Article) ListByOffsetSimple(cond *db.Compounds, limit int, offset int, orderby ...interface{}) ([]*ArticleWithOwner, error)
- func (f *Article) ListByTag(recv interface{}, mw func(db.Result) db.Result, page, size int, tag string) (func() int64, error)
- func (f *Article) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*ArticleAndSourceInfo, error)
- func (f *Article) ListPageSimple(cond *db.Compounds, orderby ...interface{}) ([]*ArticleWithOwner, error)
- func (f *Article) NextRow(currentID uint64, extraCond *db.Compounds) (*dbschema.OfficialCommonArticle, error)
- func (f *Article) PrevRow(currentID uint64, extraCond *db.Compounds) (*dbschema.OfficialCommonArticle, error)
- func (f *Article) QueryList(query string, limit int, offset int, orderby ...interface{}) []*ArticleWithOwner
- func (f *Article) RelationList(limit int, orderby ...interface{}) []*ArticleWithOwner
- func (f *Article) SyncRemoteImage() (string, error)
- func (f *Article) TagCond(tag string) db.Compound
- type ArticleAndSourceInfo
- type ArticleWithOwner
- type Category
- type ContentHideDetectorFunc
- type ContentHideInfo
- type ContentHideMsgFnKey
- type ContentHideParams
- type MessageFuncOnHide
Constants ¶
View Source
const (
BehaviorName = `article`
)
View Source
const GroupName = `article`
Variables ¶
View Source
var AllowComment = map[string]func(echo.Context, *dbschema.OfficialCustomer, *dbschema.OfficialCommonArticle) error{
`buyer`: allowBuyerComment,
`author`: allowAuthorComment,
`admin`: allowAdminComment,
`none`: disallowComment,
}
View Source
var ContentHideDetector = echo.NewKVData()
View Source
var Contype = official.Contype
View Source
var OrderQuerier = func(c echo.Context, customer *dbschema.OfficialCustomer, sourceId, sourceTable string) error {
return c.E(`很抱歉,您不是当前商品买家,本文只有当前商品买家才能评论`)
}
View Source
var (
Source = source.New()
)
Functions ¶
func ContentHideDetectorRegister ¶
func ContentHideDetectorRegister(k string, description string, hideDetector ContentHideDetectorFunc, v string, fn ...MessageFuncOnHide)
func GetContentHideDetector ¶
func GetContentHideDetector( customer *dbschema.OfficialCustomer, article *dbschema.OfficialCommonArticle, ) top.HideDetector
func WithSourceInfo ¶
func WithSourceInfo(ctx echo.Context, list []*ArticleAndSourceInfo) error
Types ¶
type Article ¶
type Article struct { *dbschema.OfficialCommonArticle DisallowCreateTags bool }
func NewArticle ¶
func (*Article) CommonQueryList ¶
func (*Article) CustomerPendingCount ¶
func (*Article) CustomerPendingTodayCount ¶
func (*Article) CustomerTodayCount ¶
func (*Article) GetCategories ¶
func (f *Article) GetCategories(rows ...*dbschema.OfficialCommonArticle) ([]dbschema.OfficialCommonCategory, error)
func (*Article) IsAllowedComment ¶
func (f *Article) IsAllowedComment(customer *dbschema.OfficialCustomer) error
IsAllowedComment 是否可以评论
func (*Article) ListByOffsetSimple ¶
func (*Article) ListPage ¶
func (f *Article) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*ArticleAndSourceInfo, error)
func (*Article) ListPageSimple ¶
func (f *Article) ListPageSimple(cond *db.Compounds, orderby ...interface{}) ([]*ArticleWithOwner, error)
func (*Article) QueryList ¶
func (f *Article) QueryList(query string, limit int, offset int, orderby ...interface{}) []*ArticleWithOwner
func (*Article) RelationList ¶
func (f *Article) RelationList(limit int, orderby ...interface{}) []*ArticleWithOwner
func (*Article) SyncRemoteImage ¶
type ArticleAndSourceInfo ¶
type ArticleAndSourceInfo struct { *dbschema.OfficialCommonArticle Categories []*dbschema.OfficialCommonCategory SourceInfo echo.KV `db:"-"` }
func (*ArticleAndSourceInfo) AddCategory ¶
func (a *ArticleAndSourceInfo) AddCategory(g *dbschema.OfficialCommonCategory)
func (*ArticleAndSourceInfo) GetCategory1 ¶
func (a *ArticleAndSourceInfo) GetCategory1() uint
func (*ArticleAndSourceInfo) GetCategory2 ¶
func (a *ArticleAndSourceInfo) GetCategory2() uint
func (*ArticleAndSourceInfo) GetCategory3 ¶
func (a *ArticleAndSourceInfo) GetCategory3() uint
func (*ArticleAndSourceInfo) GetCategoryID ¶
func (a *ArticleAndSourceInfo) GetCategoryID() uint
type ArticleWithOwner ¶
type ArticleWithOwner struct { *dbschema.OfficialCommonArticle User *modelAuthor.User `db:"-,relation=id:owner_id|gtZero|eq(owner_type:user),columns=id&username&avatar" json:",omitempty"` Customer *modelAuthor.Customer `db:"-,relation=id:owner_id|gtZero|eq(owner_type:customer),columns=id&name&avatar" json:",omitempty"` Category *Category `db:"-,relation=id:category_id|gtZero,columns=id&name" json:",omitempty"` }
type ContentHideDetectorFunc ¶
type ContentHideDetectorFunc func(*ContentHideParams) bool
type ContentHideInfo ¶
type ContentHideInfo struct {
// contains filtered or unexported fields
}
func NewContentHideInfo ¶
func NewContentHideInfo(hideDetector ContentHideDetectorFunc) *ContentHideInfo
type ContentHideMsgFnKey ¶
type ContentHideMsgFnKey string
type ContentHideParams ¶
type ContentHideParams struct { echo.Context Customer *dbschema.OfficialCustomer Article *dbschema.OfficialCommonArticle HideContent string Args []string }
func (*ContentHideParams) Reset ¶
func (c *ContentHideParams) Reset()
type MessageFuncOnHide ¶
type MessageFuncOnHide func(*ContentHideParams) string
Click to show internal directories.
Click to hide internal directories.