level

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelStatusActived = `actived`
	LevelStatusExpired = `expired`
)

Variables

View Source
var GroupList = echo.NewKVData().Add(`base`, `普通会员`)

GroupList base-普通会员(基础组),其它名称为扩展组。客户只能有一个基础组等级,可以有多个扩展组等级

View Source
var LevelStatuses = echo.NewKVData().Add(LevelStatusActived, `有效`).Add(LevelStatusExpired, `过期`)

Functions

func AddGroup

func AddGroup(k string, v string)

Types

type Level

type Level struct {
	*dbschema.OfficialCustomerLevel
}

func NewLevel

func NewLevel(ctx echo.Context) *Level

func (*Level) Add

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

func (*Level) CanAutoLevelUpByCustomerID

func (f *Level) CanAutoLevelUpByCustomerID(customerID uint64) (*dbschema.OfficialCustomerLevel, error)

func (*Level) CanAutoLevelUpByIntegral

func (f *Level) CanAutoLevelUpByIntegral(integral float64) (*dbschema.OfficialCustomerLevel, error)

func (*Level) CanAutoLevelUpByIntegralAsset added in v0.2.7

func (f *Level) CanAutoLevelUpByIntegralAsset(group string, integral float64, asset string) (*dbschema.OfficialCustomerLevel, error)

func (*Level) CanPaymentLevelUpByIntegralAsset added in v0.2.7

func (f *Level) CanPaymentLevelUpByIntegralAsset(group string, integral float64, asset string) (*dbschema.OfficialCustomerLevel, error)

func (*Level) Edit

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

func (*Level) Exists

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

func (*Level) ExistsOther

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

func (*Level) GetMinLevelByGroup added in v0.2.9

func (f *Level) GetMinLevelByGroup(group string) error

func (*Level) GreaterOrEqualThan

func (f *Level) GreaterOrEqualThan(levelId uint, targetLevelId uint) (bool, error)

func (*Level) LessThan

func (f *Level) LessThan(levelId uint, targetLevelId uint) (bool, error)

func (*Level) ListByCustomer

func (f *Level) ListByCustomer(customer *dbschema.OfficialCustomer) ([]*dbschema.OfficialCustomerLevel, error)

func (*Level) ListLevelGroup

func (f *Level) ListLevelGroup() ([]*LevelGroup, error)

func (*Level) Than

func (f *Level) Than(
	levelId uint, targetLevelId uint,
	compare func(*dbschema.OfficialCustomerLevel, *dbschema.OfficialCustomerLevel) bool,
) (bool, error)

type LevelGroup

type LevelGroup struct {
	Group string
	Title string
	List  []*dbschema.OfficialCustomerLevel
}

type Relation

type Relation struct {
	*dbschema.OfficialCustomerLevelRelation
}

客户的扩展组等级关联关系

func NewRelation

func NewRelation(ctx echo.Context) *Relation

func (*Relation) GetGroupLevelByCustomerID added in v0.2.8

func (f *Relation) GetGroupLevelByCustomerID(customerID uint64, group string) (*dbschema.OfficialCustomerLevel, error)

func (*Relation) HasGroupLevelByCustomerID added in v0.2.8

func (f *Relation) HasGroupLevelByCustomerID(customerID uint64, group string) bool

func (*Relation) ListByCustomerID

func (f *Relation) ListByCustomerID(customerID uint64) ([]*dbschema.OfficialCustomerLevelRelation, error)

func (*Relation) ListByCustomerIDs added in v0.2.7

func (f *Relation) ListByCustomerIDs(customerIDs []uint64) (map[uint64][]*RelationExt, error)

type RelationExt added in v0.2.7

type RelationExt struct {
	*dbschema.OfficialCustomerLevelRelation
	Level *dbschema.OfficialCustomerLevel `db:"-,relation=id:level_id|gtZero"`
}

func (*RelationExt) Name_ added in v0.2.7

func (r *RelationExt) Name_() string

Jump to

Keyboard shortcuts

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