official

package
v0.0.0-...-139d814 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: AGPL-3.0 Imports: 20 Imported by: 9

Documentation

Index

Constants

View Source
const ChineseSpace = ` `

ChineseSpace 中文全角空白字符

Variables

View Source
var (
	// CategoryMaxLevel 分类最大层数(层从0开始)
	CategoryMaxLevel uint = 3 //3代表最大允许4层
	// CategoryTypes 分类的类别
	CategoryTypes = echo.NewKVData()
)
View Source
var ClickFlowTargets = map[string]ClickFlowTarget{}
View Source
var CollectionTargets = map[string]CollectionTarget{}
View Source
var (
	Contype = echo.NewKVData()
)
View Source
var (
	FriendlinkMaxUnsuccessfuls int64 = 5 // 每个用户提交友情链接的最大数量(不包含已经通过的)
)
View Source
var (
	//GroupTypes 组类型
	GroupTypes = echo.NewKVData().
		Add(`customer`, `客户组`).
		Add(`openapp`, `开放平台应用`).
		Add(`api`, `外部API`)
)
View Source
var NavigateLinkType = echo.NewKVData()
View Source
var (
	// NavigateMaxLevel 分类最大层数(层从0开始)
	NavigateMaxLevel uint = 3 //3代表最大允许4层
)
View Source
var (
	// NavigateTypes 分类的类别
	NavigateTypes = echo.NewKVData()
)
View Source
var RoutePageTypes = echo.NewKVData()
View Source
var SourceTables = map[string]*SourceTableEntry{}

SourceTables 来源表集合 used: comment

View Source
var (
	// TagGroups 标签组
	TagGroups = echo.NewKVData()
)

Functions

func AddCategoryType

func AddCategoryType(value, label string)

AddCategoryType 登记新的类别

func AddClickFlowTarget

func AddClickFlowTarget(name string, target ClickFlowTarget)

func AddCollectionTarget

func AddCollectionTarget(name string, title string, targetDo CollectionTargetDo, targetList CollectionTargetList)

func AddNavigateType

func AddNavigateType(value, label string)

AddNavigateType 登记新的类别

func AddTagGroup

func AddTagGroup(group string, title string)

func CollectionCategoryIDs

func CollectionCategoryIDs() func(...uint) []uint

func CollectionNavigateIDs

func CollectionNavigateIDs() func(...uint) []uint

func FillChildren

func FillChildren(list *[]*NavigateExt, children map[uint][]*NavigateExt)

func FireNavigateUpdate

func FireNavigateUpdate(m *dbschema.OfficialCommonNavigate) error

func GenActiveDetector

func GenActiveDetector(categoryKey string, categoryID uint) func(ctx echo.Context) bool

func GetAddNavigateTypes

func GetAddNavigateTypes() []*echo.KV

GetAddNavigateTypes 获取类别列表

func MakeOperator

func MakeOperator(isCancel ...bool) string

func OnNavigateUpdate

func OnNavigateUpdate(f func(*dbschema.OfficialCommonNavigate) error)

func TagCond

func TagCond(tag string) db.Compound

Types

type Area

type Area struct {
	*dbschema.OfficialCommonArea
}

func NewArea

func NewArea(ctx echo.Context) *Area

func (*Area) Add

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

func (*Area) Edit

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

func (*Area) Exists

func (f *Area) Exists(name string) (bool, error)

func (*Area) ExistsOther

func (f *Area) ExistsOther(name string, id uint) (bool, error)

func (*Area) Parent

func (f *Area) Parent(pid uint) (*dbschema.OfficialCommonArea, error)

func (*Area) Parents

func (f *Area) Parents(pid uint) ([]*dbschema.OfficialCommonArea, error)

func (*Area) PositionIds

func (f *Area) PositionIds(id uint) ([]uint, error)

func (*Area) Positions

func (f *Area) Positions(id uint) ([]*dbschema.OfficialCommonArea, error)

type AreaGroup

type AreaGroup struct {
	*dbschema.OfficialCommonAreaGroup
}

func NewAreaGroup

func NewAreaGroup(ctx echo.Context) *AreaGroup

func (*AreaGroup) Add

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

func (*AreaGroup) Edit

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

func (*AreaGroup) Exists

func (f *AreaGroup) Exists(countryAbbr string, abbr string) (bool, error)

func (*AreaGroup) ExistsOther

func (f *AreaGroup) ExistsOther(countryAbbr string, abbr string, id uint) (bool, error)

func (*AreaGroup) GetWithExt

func (f *AreaGroup) GetWithExt(cond *db.Compounds) (*AreaGroupExt, error)

func (*AreaGroup) ListPage

func (f *AreaGroup) ListPage(cond *db.Compounds, sorts ...interface{}) ([]*dbschema.OfficialCommonAreaGroup, error)

func (*AreaGroup) ListPageWithExt

func (f *AreaGroup) ListPageWithExt(cond *db.Compounds, sorts ...interface{}) ([]*AreaGroupExt, error)

type AreaGroupExt

type AreaGroupExt struct {
	*dbschema.OfficialCommonAreaGroup
	Areas []*dbschema.OfficialCommonArea `db:"-,relation=id:area_ids|notEmpty|split"`
}

type Category

type Category struct {
	*dbschema.OfficialCommonCategory
	// contains filtered or unexported fields
}

func NewCategory

func NewCategory(ctx echo.Context) *Category

func (*Category) Add

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

func (*Category) Delete

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

func (*Category) Edit

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

func (*Category) Exists

func (f *Category) Exists(name string) error

func (*Category) ExistsOther

func (f *Category) ExistsOther(name string, id uint) error

func (*Category) FillTo

func (f *Category) FillTo(tg []ICategory) error

func (*Category) ListAllParent

func (f *Category) ListAllParent(typ string, excludeId uint, maxLevels ...uint) []*dbschema.OfficialCommonCategory

func (*Category) ListAllParentBy

func (f *Category) ListAllParentBy(typ string, excludeId uint, maxLevel uint, extraConds ...db.Compound) []*dbschema.OfficialCommonCategory

func (*Category) ListChildren

func (f *Category) ListChildren(parentID uint) ([]*dbschema.OfficialCommonCategory, error)

ListChildren 查询子分类

func (*Category) ListIndent

func (f *Category) ListIndent(categoryList []*dbschema.OfficialCommonCategory) []*dbschema.OfficialCommonCategory

func (*Category) MaxLevel

func (f *Category) MaxLevel() uint

func (*Category) Parents

func (f *Category) Parents(parentID uint) ([]dbschema.OfficialCommonCategory, error)

func (*Category) PositionIds

func (f *Category) PositionIds(id uint) ([]uint, error)

func (*Category) Positions

func (f *Category) Positions(id uint) ([]dbschema.OfficialCommonCategory, error)

func (*Category) UpdateAllChildren

func (f *Category) UpdateAllChildren(row *dbschema.OfficialCommonCategory) error

UpdateAllChildren 更新所有子孙分类level值

func (*Category) UpdateAllParents

func (f *Category) UpdateAllParents(oldData *dbschema.OfficialCommonCategory) (err error)

UpdateAllParents 更新所有父级分类(目前仅仅用于更新父级has_child值)

type ClickFlow

type ClickFlow struct {
	*dbschema.OfficialCommonClickFlow
}

func NewClickFlow

func NewClickFlow(ctx echo.Context) *ClickFlow

func (*ClickFlow) Add

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

func (*ClickFlow) DelByTarget

func (f *ClickFlow) DelByTarget(targetType string, targetID uint64) error

func (*ClickFlow) DelByTargetOwner

func (f *ClickFlow) DelByTargetOwner(targetType string, targetID uint64, ownerID uint64, ownerType string) error

func (*ClickFlow) Edit

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

func (*ClickFlow) Exists

func (f *ClickFlow) Exists(targetType string, targetID uint64, ownerID uint64, ownerType string) (bool, error)

func (*ClickFlow) Find

func (f *ClickFlow) Find(targetType string, targetID uint64, ownerID uint64, ownerType string) error

func (*ClickFlow) ListByAdminTargets

func (f *ClickFlow) ListByAdminTargets(targetType string, targetIDs []uint64, adminUID uint) (map[uint64]*dbschema.OfficialCommonClickFlow, error)

func (*ClickFlow) ListByCustomerTargets

func (f *ClickFlow) ListByCustomerTargets(targetType string, targetIDs []uint64, customerID uint64) (map[uint64]*dbschema.OfficialCommonClickFlow, error)

func (*ClickFlow) ListByTargets

func (f *ClickFlow) ListByTargets(targetType string, targetIDs []uint64, customerID uint64, adminUID uint) (map[uint64]*dbschema.OfficialCommonClickFlow, error)

func (*ClickFlow) NewestTimeByCustomerID

func (f *ClickFlow) NewestTimeByCustomerID(targetType string, targetID uint64, ownerID uint64, ownerType string) (uint, error)

type ClickFlowTarget

type ClickFlowTarget interface {
	Do(ctx echo.Context, id interface{}) (after func(typ string, isCancel ...bool) error, infoGetter func() ClickFlowTargetInfo, err error)
}

type ClickFlowTargetFunc

type ClickFlowTargetFunc func(ctx echo.Context, id interface{}) (after func(typ string, isCancel ...bool) error, infoGetter func() ClickFlowTargetInfo, err error)

func (ClickFlowTargetFunc) Do

func (c ClickFlowTargetFunc) Do(ctx echo.Context, id interface{}) (after func(typ string, isCancel ...bool) error, infoGetter func() ClickFlowTargetInfo, err error)

type ClickFlowTargetInfo

type ClickFlowTargetInfo struct {
	ID       uint64
	AuthorID uint64
}

type Collection

type Collection struct {
	*dbschema.OfficialCommonCollection
}

func NewCollection

func NewCollection(ctx echo.Context) *Collection

func (*Collection) Add

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

func (*Collection) DelByTarget

func (f *Collection) DelByTarget(targetType string, targetID uint64) error

func (*Collection) DelByTargetOwner

func (f *Collection) DelByTargetOwner(targetType string, targetID uint64, customerID uint64) error

func (*Collection) Edit

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

func (*Collection) Exists

func (f *Collection) Exists(targetType string, targetID uint64, customerID uint64) (bool, error)

func (*Collection) Find

func (f *Collection) Find(targetType string, targetID uint64, customerID uint64) error

func (*Collection) ListByTargets

func (f *Collection) ListByTargets(targetType string, targetIDs []uint64, customerID uint64) (map[uint64]*dbschema.OfficialCommonCollection, error)

func (*Collection) ListPage

func (f *Collection) ListPage(targetType string, customerID uint64, title string, sorts ...interface{}) ([]*CollectionResponse, error)

func (*Collection) ListPageByOffset

func (f *Collection) ListPageByOffset(targetType string, customerID uint64, title string, sorts ...interface{}) ([]*CollectionResponse, error)

func (*Collection) NewestTimeByCustomerID

func (f *Collection) NewestTimeByCustomerID(targetType string, targetID uint64, customerID uint64) (uint, error)

type CollectionResponse

type CollectionResponse struct {
	*dbschema.OfficialCommonCollection
	Title string `db:"-" json:"title" xml:"title"`
	URL   string `db:"-" json:"url" xml:"url"`
	Extra echo.H `db:"-" json:"extra,omitempty" xml:"extra,omitempty"`
}

func (*CollectionResponse) Set

func (c *CollectionResponse) Set(key interface{}, value ...interface{})

type CollectionTarget

type CollectionTarget struct {
	Title string
	// contains filtered or unexported fields
}

func (CollectionTarget) Do

func (c CollectionTarget) Do(ctx echo.Context, id interface{}) (after func(isCancel ...bool) error, infoGetter func() CollectionTargetInfo, err error)

func (CollectionTarget) HasDo

func (c CollectionTarget) HasDo() bool

func (CollectionTarget) HasList

func (c CollectionTarget) HasList() bool

func (CollectionTarget) List

func (c CollectionTarget) List(ctx echo.Context, rows []*CollectionResponse, targetIDs []uint64) ([]*CollectionResponse, error)

type CollectionTargetDo

type CollectionTargetDo interface {
	Do(ctx echo.Context, id interface{}) (after func(isCancel ...bool) error, infoGetter func() CollectionTargetInfo, err error)
}

type CollectionTargetDoFunc

type CollectionTargetDoFunc func(ctx echo.Context, id interface{}) (after func(isCancel ...bool) error, infoGetter func() CollectionTargetInfo, err error)

func (CollectionTargetDoFunc) Do

func (c CollectionTargetDoFunc) Do(ctx echo.Context, id interface{}) (after func(isCancel ...bool) error, infoGetter func() CollectionTargetInfo, err error)

type CollectionTargetInfo

type CollectionTargetInfo struct {
	ID    uint64
	Title string
}

type CollectionTargetList

type CollectionTargetList interface {
	List(ctx echo.Context, rows []*CollectionResponse, targetIDs []uint64) ([]*CollectionResponse, error)
}

type CollectionTargetListFunc

type CollectionTargetListFunc func(ctx echo.Context, rows []*CollectionResponse, targetIDs []uint64) ([]*CollectionResponse, error)

func (CollectionTargetListFunc) List

func (c CollectionTargetListFunc) List(ctx echo.Context, rows []*CollectionResponse, targetIDs []uint64) ([]*CollectionResponse, error)
type Friendlink struct {
	*dbschema.OfficialCommonFriendlink
}
func NewFriendlink(ctx echo.Context) *Friendlink

func (*Friendlink) Add

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

func (*Friendlink) Edit

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

func (*Friendlink) Exists

func (f *Friendlink) Exists(customerID uint64, url string, host string) (bool, error)

func (*Friendlink) ExistsOther

func (f *Friendlink) ExistsOther(customerID uint64, url string, host string, id uint) (bool, error)

func (*Friendlink) IncrReturnCount

func (f *Friendlink) IncrReturnCount(id uint) error

func (*Friendlink) ListPage

func (f *Friendlink) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*FriendlinkExt, error)

func (*Friendlink) ListShowAndRecord

func (f *Friendlink) ListShowAndRecord(limit int, categoryIds ...uint) ([]*dbschema.OfficialCommonFriendlink, error)

ListShowAndRecord 前台列表显示,并记录回调

func (*Friendlink) RecordReturn

func (f *Friendlink) RecordReturn() error

func (*Friendlink) VerifyFail

func (f *Friendlink) VerifyFail(id uint) error

type FriendlinkExt

type FriendlinkExt struct {
	*dbschema.OfficialCommonFriendlink
	Category *dbschema.OfficialCommonCategory `db:"-,relation=id:category_id|gtZero"`
}

type Group

type Group struct {
	*dbschema.OfficialCommonGroup
}

func NewGroup

func NewGroup(ctx echo.Context) *Group

func (*Group) Add

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

func (*Group) Edit

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

func (*Group) Exists

func (f *Group) Exists(name string) (bool, error)

func (*Group) ExistsOther

func (f *Group) ExistsOther(name string, id uint) (bool, error)

type GroupAndType

type GroupAndType struct {
	*dbschema.OfficialCommonGroup
	Type *echo.KV
}

type ICategory

type ICategory interface {
	GetCategory1() uint
	GetCategory2() uint
	GetCategory3() uint
	GetCategoryID() uint
	AddCategory(*dbschema.OfficialCommonCategory)
}
type Navigate struct {
	*dbschema.OfficialCommonNavigate
	// contains filtered or unexported fields
}

func NewNavigate

func NewNavigate(ctx echo.Context) *Navigate
func (f *Navigate) Add() (pk interface{}, err error)
func (f *Navigate) Delete(mw func(db.Result) db.Result, args ...interface{}) error
func (f *Navigate) Edit(mw func(db.Result) db.Result, args ...interface{}) (err error)
func (f *Navigate) Exists(title string, typ string) error
func (f *Navigate) ExistsOther(title string, typ string, id uint) error
func (f *Navigate) ListAllParent(typ string, excludeId uint, maxLevels ...uint) []*dbschema.OfficialCommonNavigate
func (f *Navigate) ListIndent(categoryList []*dbschema.OfficialCommonNavigate) []*dbschema.OfficialCommonNavigate
func (f *Navigate) MaxLevel() uint
func (f *Navigate) ParentIds(parentID uint) []uint
func (f *Navigate) UpdateAllChildren(row *dbschema.OfficialCommonNavigate) error

UpdateAllChildren 更新所有子孙分类level值

func (f *Navigate) UpdateAllParents(oldData *dbschema.OfficialCommonNavigate) (err error)

UpdateAllParents 更新所有父级分类(目前仅仅用于更新父级has_child值)

type NavigateExt struct {
	*dbschema.OfficialCommonNavigate

	Children *[]*NavigateExt
	Extra    echo.H
	// contains filtered or unexported fields
}

func NewNavigateExt

func NewNavigateExt(nav *dbschema.OfficialCommonNavigate) *NavigateExt
func (f *NavigateExt) ClearChildren() *NavigateExt
func (f *NavigateExt) FetchChildren(forces ...bool) []*NavigateExt
func (f *NavigateExt) HasChildren() bool
func (f *NavigateExt) Init() *NavigateExt
func (f *NavigateExt) IsActive() bool
func (f *NavigateExt) IsInside() bool
func (f *NavigateExt) IsValidURL() bool
func (f *NavigateExt) SetActiveDetector(fn func(echo.Context) bool) *NavigateExt
func (f *NavigateExt) SetExtra(extra echo.H) *NavigateExt
func (f *NavigateExt) SetExtraKV(k string, v interface{}) *NavigateExt
func (f *NavigateExt) URL() string

type RoutePage

type RoutePage struct {
	*dbschema.OfficialCommonRoutePage
}

func NewRoutePage

func NewRoutePage(ctx echo.Context) *RoutePage

func (*RoutePage) Add

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

func (*RoutePage) Edit

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

func (*RoutePage) ListWithExtensionRoutes

func (f *RoutePage) ListWithExtensionRoutes(ext string) ([]string, error)

type RouteRewrite

type RouteRewrite struct {
	*dbschema.OfficialCommonRouteRewrite
}

func NewRouteRewrite

func NewRouteRewrite(ctx echo.Context) *RouteRewrite

func (*RouteRewrite) Add

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

func (*RouteRewrite) Edit

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

type SourceTableEntry

type SourceTableEntry struct {
	// Name 名称
	Name string

	// QueryKVAndDetailURL 查询id和名称以及详情页网址
	// H: echo.H{
	//	`detailURL`: `%v`,
	//},
	QueryKVAndDetailURL func(ctx echo.Context, sourceIDs []string) echo.KVList

	// QueryBought 查询是否购买过
	QueryBought func(ctx echo.Context, sourceID string, customerID []uint64) (map[uint64]bool, error)
}

SourceTableEntry 来源表项

type Tags

type Tags struct {
	*dbschema.OfficialCommonTags
}

func NewTags

func NewTags(ctx echo.Context) *Tags

func (*Tags) Add

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

func (*Tags) Clean

func (f *Tags) Clean() (err error)

func (*Tags) DecrNum

func (f *Tags) DecrNum(group string, name []string, n ...int) error

func (*Tags) Edit

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

func (*Tags) IncrNum

func (f *Tags) IncrNum(group, name string, n ...int) error

func (*Tags) ListByGroup

func (f *Tags) ListByGroup(group string, limit int) []*dbschema.OfficialCommonTags

func (*Tags) UpdateTags

func (f *Tags) UpdateTags(group string, oldTags []string, postTags []string, disallowCreateTags ...bool) ([]string, error)

Directories

Path Synopsis
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>

Jump to

Keyboard shortcuts

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