point

package
v0.0.0-...-744bbcf Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateLogForRule

func GenerateLogForRule(corp business.ICorp, user business.IUser, orderBid string, rule *PointRule, point int) *m_point.PointLog

func InitSystemRulesForCorp

func InitSystemRulesForCorp(ctx context.Context, corp business.ICorp)

func RecordPointLog

func RecordPointLog(ctx context.Context, corp business.ICorp, user business.IUser, orderBid string, orderMoney int, rules []*PointRule, point int)

RecordPointLog : 记录一次积分日志

Types

type EncodePointLogService

type EncodePointLogService struct {
	eel.ServiceBase
}

func NewEncodePointLogService

func NewEncodePointLogService(ctx context.Context) *EncodePointLogService

func (*EncodePointLogService) Encode

func (this *EncodePointLogService) Encode(log *PointLog) *RPointLog

func (*EncodePointLogService) EncodeMany

func (this *EncodePointLogService) EncodeMany(logs []*PointLog) []*RPointLog

type EncodePointRuleService

type EncodePointRuleService struct {
	eel.ServiceBase
}

func NewEncodePointRuleService

func NewEncodePointRuleService(ctx context.Context) *EncodePointRuleService

func (*EncodePointRuleService) Encode

func (this *EncodePointRuleService) Encode(rule *PointRule) *RPointRule

func (*EncodePointRuleService) EncodeMany

func (this *EncodePointRuleService) EncodeMany(rules []*PointRule) []*RPointRule

type FillPointLogService

type FillPointLogService struct {
	eel.ServiceBase
}

func NewFillPointLogService

func NewFillPointLogService(ctx context.Context) *FillPointLogService

func (*FillPointLogService) Fill

func (this *FillPointLogService) Fill(logs []*PointLog, option eel.FillOption)

func (*FillPointLogService) FillOne

func (this *FillPointLogService) FillOne(log *PointLog, option eel.FillOption)

type FillPointRuleService

type FillPointRuleService struct {
	eel.ServiceBase
}

func NewFillPointRuleService

func NewFillPointRuleService(ctx context.Context) *FillPointRuleService

func (*FillPointRuleService) Fill

func (this *FillPointRuleService) Fill(rules []*PointRule, option eel.FillOption)

func (*FillPointRuleService) FillOne

func (this *FillPointRuleService) FillOne(rule *PointRule, option eel.FillOption)

type Order

type Order struct {
	Bid   string
	Money int
}

type PointLog

type PointLog struct {
	eel.EntityBase
	Id int

	Data  map[string]interface{} // 业务数据
	Point int                    // 积分数量

	CreatedAt time.Time

	UserId int
	User   *account.User

	CorpId int
}

func NewPointLogFromModel

func NewPointLogFromModel(ctx context.Context, model *m_point.PointLog) *PointLog

type PointLogRepository

type PointLogRepository struct {
	eel.ServiceBase
}

func NewPointLogRepository

func NewPointLogRepository(ctx context.Context) *PointLogRepository

func (*PointLogRepository) GetPagedPointLogs

func (this *PointLogRepository) GetPagedPointLogs(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*PointLog, eel.INextPageInfo)

func (*PointLogRepository) GetPagedPointLogsForCorp

func (this *PointLogRepository) GetPagedPointLogsForCorp(corp business.ICorp, filters eel.Map, page *eel.PageInfo) ([]*PointLog, eel.INextPageInfo)

func (*PointLogRepository) GetPagedPointLogsForUserInCorp

func (this *PointLogRepository) GetPagedPointLogsForUserInCorp(corp business.ICorp, user business.IUser, filters eel.Map, page *eel.PageInfo) ([]*PointLog, eel.INextPageInfo)

func (*PointLogRepository) GetPointLogs

func (this *PointLogRepository) GetPointLogs(filters eel.Map, orderExprs ...string) []*PointLog

func (*PointLogRepository) GetPointLogsForUserInCorp

func (this *PointLogRepository) GetPointLogsForUserInCorp(corp business.ICorp, user business.IUser, filters eel.Map) []*PointLog

type PointRule

type PointRule struct {
	eel.EntityBase
	Id int

	Type   int
	Stage  int
	CorpId int
	Name   string
	Detail string
	Data   map[string]interface{} // 规则业务数据
	Point  int                    // 奖励积分值

	IsForAllProduct bool
	IsSystemRule    bool
	IsEnabled       bool
	IsDeleted       bool
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

func NewPointRuleFromModel

func NewPointRuleFromModel(ctx context.Context, model *m_point.PointRule) *PointRule

func (*PointRule) Delete

func (this *PointRule) Delete() error

func (*PointRule) GetStageText

func (this *PointRule) GetStageText() string

func (*PointRule) GetTypeText

func (this *PointRule) GetTypeText() string

func (*PointRule) IsActive

func (this *PointRule) IsActive() bool

func (*PointRule) IsMaxPerDayRule

func (this *PointRule) IsMaxPerDayRule() bool

func (*PointRule) IsOutputRule

func (this *PointRule) IsOutputRule() bool

func (*PointRule) IsPreconditionRule

func (this *PointRule) IsPreconditionRule() bool

func (*PointRule) IsTradeRule

func (this *PointRule) IsTradeRule() bool

func (*PointRule) Update

func (this *PointRule) Update(ruleType string, data interface{}, point int)

type PointRuleFactory

type PointRuleFactory struct {
	eel.ServiceBase
}

func NewPointRuleFactory

func NewPointRuleFactory(ctx context.Context) *PointRuleFactory

func (*PointRuleFactory) CreateRuleForCorp

func (this *PointRuleFactory) CreateRuleForCorp(corp business.ICorp, name string, ruleType string, data interface{}, point int) (*PointRule, error)

func (*PointRuleFactory) InitSystemRulesForCorp

func (this *PointRuleFactory) InitSystemRulesForCorp(corp business.ICorp)

type PointRuleRepository

type PointRuleRepository struct {
	eel.ServiceBase
}

func NewPointRuleRepository

func NewPointRuleRepository(ctx context.Context) *PointRuleRepository

func (*PointRuleRepository) GetPagedPointRules

func (this *PointRuleRepository) GetPagedPointRules(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*PointRule, eel.INextPageInfo)

func (*PointRuleRepository) GetPagedPointRulesForCorp

func (this *PointRuleRepository) GetPagedPointRulesForCorp(corp business.ICorp, filters eel.Map, page *eel.PageInfo) ([]*PointRule, eel.INextPageInfo)

func (*PointRuleRepository) GetPointRuleInCorp

func (this *PointRuleRepository) GetPointRuleInCorp(corp business.ICorp, ruleId int) *PointRule

func (*PointRuleRepository) GetPointRules

func (this *PointRuleRepository) GetPointRules(filters eel.Map, orderExprs ...string) []*PointRule

type PointService

type PointService struct {
	eel.ServiceBase
}

func NewPointService

func NewPointService(ctx context.Context) *PointService

func (*PointService) GetPendingTradingCountForUser

func (this *PointService) GetPendingTradingCountForUser(user business.IUser) int

GetPendingTradingCountForUser : 获取user的未处理消费记录

func (*PointService) GetTodayPointForUserInCorp

func (this *PointService) GetTodayPointForUserInCorp(corp business.ICorp, user business.IUser) int

GetTodayPointForUserInCorp : 获得当天user在corp中领取的积分累积值

func (*PointService) RecordTradeForUser

func (this *PointService) RecordTradeForUser(user business.IUser) error

RecordTradeForUser : 记录user的一次消费

func (*PointService) ResetPendingTradeCountForUser

func (this *PointService) ResetPendingTradeCountForUser(user business.IUser) error

ResetPendingTradeCountForUser : 记录user的未处理消费记录

type RPointLog

type RPointLog struct {
	Id     int `json:"id"`
	UserId int `json:"user_id"`
	CorpId int `json:"corp_id"`
	Point  int `json:"point"'`

	User interface{} `json:"user"`
	Data interface{} `json:"data"`

	CreatedAt string `json:"created_at"`
}

type RPointRule

type RPointRule struct {
	Id     int    `json:"id"`
	CorpId int    `json:"corp_id"`
	Type   string `json:"type"`
	Stage  string `json:"stage"`

	IsSystemRule bool        `json:"is_system_rule"`
	Name         string      `json:"name"`
	Detail       string      `json:"detail"`
	Data         interface{} `json:"data"`
	Point        int         `json:"point"`

	IsEnabled bool `json:"is_enabled"`
	IsDeleted bool `json:"is_deleted"`

	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type RuleEngine

type RuleEngine struct {
	eel.ServiceBase
}

func NewRuleEngine

func NewRuleEngine(ctx context.Context) *RuleEngine

func (*RuleEngine) RunForCorp

func (this *RuleEngine) RunForCorp(corp business.ICorp, bid string, money int) (int, []*PointRule)

Jump to

Keyboard shortcuts

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