level

package
v0.0.0-...-0ad6518 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: AGPL-3.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// 等级状态
	LevelStatusActived = `actived`
	LevelStatusExpired = `expired`

	// 金额类型
	AmountTypeBalance     = `balance`
	AmountTypeAccumulated = `accumulated`
)

Variables

View Source
var AmountTypes = echo.NewKVData().Add(AmountTypeBalance, echo.T(`余额`)).Add(AmountTypeAccumulated, echo.T(`累积总收入`))
View Source
var GroupList = echo.NewKVData().Add(`base`, echo.T(`普通会员`))

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

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

Functions

func AddGroup

func AddGroup(k string, v string)

func LevelNew

func LevelNew(ctx echo.Context, customerID uint64, group string, assetType string, expired uint) error

func MakeFreeCond

func MakeFreeCond(group string, balance float64, accumulated float64, asset string) *db.Compounds

func MakePayCond

func MakePayCond(group string, balance float64, accumulated float64, asset string) *db.Compounds

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

func (f *Level) CanAutoLevelUpBy(customerID uint64, group string, assetType string) (*dbschema.OfficialCustomerLevel, error)

func (*Level) CanAutoLevelUpByCustomerID

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

func (*Level) CanAutoLevelUpByIntegral

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

func (*Level) CanAutoLevelUpByIntegralAsset

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

func (*Level) CanPaymentLevelUpByIntegralAsset

func (f *Level) CanPaymentLevelUpByIntegralAsset(group string, balance float64, accumulated 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

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

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

func (*Relation) HasGroupLevelByCustomerID

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

func (*Relation) LevelUp

func (f *Relation) LevelUp() error

func (*Relation) ListByCustomerID

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

func (*Relation) ListByCustomerIDs

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

type RelationExt

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

func (*RelationExt) Name_

func (r *RelationExt) Name_() string

Jump to

Keyboard shortcuts

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