article

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BehaviorName = `article`
)
View Source
const GroupName = `article`

Variables

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 NewArticle(ctx echo.Context) *Article

func (*Article) Add

func (f *Article) Add() (pk interface{}, err error)

func (*Article) CommonQueryList

func (f *Article) CommonQueryList(cond *db.Compounds, limit int, offset int, orderby ...interface{}) []*ArticleWithOwner

func (*Article) CustomerPendingCount

func (f *Article) CustomerPendingCount(customerID interface{}) (int64, error)

func (*Article) CustomerPendingTodayCount

func (f *Article) CustomerPendingTodayCount(customerID interface{}) (int64, error)

func (*Article) CustomerTodayCount

func (f *Article) CustomerTodayCount(customerID interface{}) (int64, error)

func (*Article) Delete

func (f *Article) Delete(mw func(db.Result) db.Result, args ...interface{}) error

func (*Article) Edit

func (f *Article) Edit(mw func(db.Result) db.Result, args ...interface{}) error

func (*Article) GetCategories

func (*Article) IsAllowedComment

func (f *Article) IsAllowedComment(customer *dbschema.OfficialCustomer) error

IsAllowedComment 是否可以评论

func (*Article) ListByOffsetSimple

func (f *Article) ListByOffsetSimple(cond *db.Compounds, limit int, offset int, orderby ...interface{}) ([]*ArticleWithOwner, error)

func (*Article) ListByTag

func (f *Article) ListByTag(recv interface{}, mw func(db.Result) db.Result, page, size int, tag string) (func() int64, error)

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) NextRow

func (f *Article) NextRow(currentID uint64, extraCond *db.Compounds) (*dbschema.OfficialCommonArticle, error)

func (*Article) PrevRow

func (f *Article) PrevRow(currentID uint64, extraCond *db.Compounds) (*dbschema.OfficialCommonArticle, 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

func (f *Article) SyncRemoteImage() (string, error)

func (*Article) TagCond

func (f *Article) TagCond(tag string) db.Compound

type ArticleAndSourceInfo

type ArticleAndSourceInfo struct {
	*dbschema.OfficialCommonArticle
	Categories []*dbschema.OfficialCommonCategory
	SourceInfo echo.KV `db:"-"`
}

func (*ArticleAndSourceInfo) AddCategory

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 Category

type Category struct {
	Id   uint   `db:"id"`
	Name string `db:"name"`
}

func (*Category) Name_

func (c *Category) Name_() string

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

Jump to

Keyboard shortcuts

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