Documentation ¶
Index ¶
- type Coupon
- func (this *Coupon) CheckValidity(user *account.User, poolProductIds []int) (bool, error)
- func (this *Coupon) GetDeductionMoney(orderMoney int) (int, error)
- func (this *Coupon) GetRule() *Rule
- func (this *Coupon) GetStatus(model *m_coupon.Coupon) string
- func (this *Coupon) GetTargetPoolProductId() int
- func (this *Coupon) IsForSingleProduct() bool
- func (this *Coupon) Update(userId int, sourceType int, code string, status int, orderBid string, ...) error
- func (this *Coupon) UpdateStatus(status string)
- func (this *Coupon) UseByOrder(order business.IOrder) error
- type CouponRepository
- func (this *CouponRepository) GetAllCouponsForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
- func (this *CouponRepository) GetCoupon(id int) *Coupon
- func (this *CouponRepository) GetCouponByCode(code string) *Coupon
- func (this *CouponRepository) GetCouponByCodeForUser(user business.IUser, code string) *Coupon
- func (this *CouponRepository) GetCouponInCorp(corp business.ICorp, id int) *Coupon
- func (this *CouponRepository) GetCoupons(filters eel.Map, orderExprs ...string) []*Coupon
- func (this *CouponRepository) GetCouponsForUser(user *account.User, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
- func (this *CouponRepository) GetCouponsForUserAndProducts(user *account.User, products []*product.Product) []*Coupon
- func (this *CouponRepository) GetEnabledCouponsForCorp(rule *Rule, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
- func (this *CouponRepository) GetPagedCoupons(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*Coupon, eel.INextPageInfo)
- type CouponService
- func (this *CouponService) Calculate(user *account.User, coupon *Coupon, couponInfo *params.CouponInfo, ...) (float64, error)
- func (this *CouponService) Deliver(rule *Rule, userIds []int, countPerUser int, sourceType string) ([]*Coupon, error)
- func (this *CouponService) DeliverOne(rule *Rule, userId int, sourceType string) (*Coupon, error)
- func (this *CouponService) DiscardCouponsByRules(ruleIds []int)
- func (this *CouponService) RestoredCoupon(user *account.User, coupon *Coupon) error
- type EncodeCouponService
- type EncodeRuleService
- type FillCouponService
- type FillRuleService
- type RCoupon
- type RRule
- type RRuleCondition
- type Rule
- func (this *Rule) AddRuleCondition(ruleCondition *RuleCondition)
- func (this *Rule) AdditionalCount(count int)
- func (this *Rule) Disable()
- func (this *Rule) Enable()
- func (this *Rule) GenerateCoupons(userId int, count int, sourceType string) ([]*Coupon, error)
- func (this *Rule) GetConditions() []*RuleCondition
- func (this *Rule) GetReceiveStatus() string
- func (this *Rule) GetRemainCouponCount() int64
- func (this *Rule) GetStatus() string
- func (this *Rule) Update(name string, count int, desc string, remark string, startDate string, ...) error
- func (this *Rule) UpdateRemark(remark string)
- func (this *Rule) UpdateRuleConditions(conditions *simplejson.Json)
- type RuleCondition
- type RuleRepository
- func (this *RuleRepository) GetAllRulesForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
- func (this *RuleRepository) GetEnabledRules(page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
- func (this *RuleRepository) GetPagedRules(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*Rule, eel.INextPageInfo)
- func (this *RuleRepository) GetRule(id int) *Rule
- func (this *RuleRepository) GetRuleByName(name string) *Rule
- func (this *RuleRepository) GetRuleInCorp(corp business.ICorp, id int) *Rule
- func (this *RuleRepository) GetRules(filters eel.Map, orderExprs ...string) []*Rule
- func (this *RuleRepository) GetRulesForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
- type RuleService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coupon ¶
type Coupon struct { eel.EntityBase Id int UserId int SourceType string Code string Status string OrderBid string ConsumedAt time.Time DeductionMoney float64 CreatedAt time.Time //foreign key RuleId int //refer to rule Rule *Rule // contains filtered or unexported fields }
func NewCoupon ¶
func NewCoupon( ctx context.Context, userId int, sourceType int, code string, status int, orderBid string, consumedAt string, ruleId int, ) *Coupon
工厂方法
func NewCouponFromModel ¶
根据model构建对象
func NewCoupons ¶
func NewCoupons( ctx context.Context, rule *Rule, userId int, count int, sourceType string, ) ([]*Coupon, error)
工厂方法
func (*Coupon) CheckValidity ¶
func (*Coupon) GetDeductionMoney ¶
func (*Coupon) GetTargetPoolProductId ¶
func (*Coupon) IsForSingleProduct ¶
func (*Coupon) Update ¶
func (this *Coupon) Update( userId int, sourceType int, code string, status int, orderBid string, consumedAt string, ruleId int, ) error
Update 更新对象
func (*Coupon) UpdateStatus ¶
type CouponRepository ¶
type CouponRepository struct {
eel.RepositoryBase
}
func NewCouponRepository ¶
func NewCouponRepository(ctx context.Context) *CouponRepository
func (*CouponRepository) GetAllCouponsForCorp ¶
func (this *CouponRepository) GetAllCouponsForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
GetAllCouponsForCorp 获得所有Coupon对象集合
func (*CouponRepository) GetCoupon ¶
func (this *CouponRepository) GetCoupon(id int) *Coupon
GetCoupon 根据id和corp获得Coupon对象
func (*CouponRepository) GetCouponByCode ¶
func (this *CouponRepository) GetCouponByCode(code string) *Coupon
GetCoupon 根据code获得Coupon对象
func (*CouponRepository) GetCouponByCodeForUser ¶
func (this *CouponRepository) GetCouponByCodeForUser(user business.IUser, code string) *Coupon
GetCouponByCodeForUser 根据code获得Coupon对象
func (*CouponRepository) GetCouponInCorp ¶
func (this *CouponRepository) GetCouponInCorp(corp business.ICorp, id int) *Coupon
GetCouponInCorp 根据id和corp获得Coupon对象
func (*CouponRepository) GetCoupons ¶
func (this *CouponRepository) GetCoupons(filters eel.Map, orderExprs ...string) []*Coupon
func (*CouponRepository) GetCouponsForUser ¶
func (this *CouponRepository) GetCouponsForUser(user *account.User, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
GetCouponsForUser 获得启用的Coupon对象集合
func (*CouponRepository) GetCouponsForUserAndProducts ¶
func (this *CouponRepository) GetCouponsForUserAndProducts(user *account.User, products []*product.Product) []*Coupon
GetCouponsForUserAndProducts 获得启用的Coupon对象集合
func (*CouponRepository) GetEnabledCouponsForCorp ¶
func (this *CouponRepository) GetEnabledCouponsForCorp(rule *Rule, page *eel.PageInfo, filters eel.Map) ([]*Coupon, eel.INextPageInfo)
GetEnabledCouponsForCorp 获得启用的Coupon对象集合
func (*CouponRepository) GetPagedCoupons ¶
func (this *CouponRepository) GetPagedCoupons(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*Coupon, eel.INextPageInfo)
type CouponService ¶
type CouponService struct {
eel.ServiceBase
}
func NewCouponService ¶
func NewCouponService(ctx context.Context) *CouponService
func (*CouponService) Calculate ¶
func (this *CouponService) Calculate(user *account.User, coupon *Coupon, couponInfo *params.CouponInfo, orderInfo *params.OrderInfo, products []*params.ProductInfo) (float64, error)
计算可抵扣的金额
func (*CouponService) Deliver ¶
func (this *CouponService) Deliver(rule *Rule, userIds []int, countPerUser int, sourceType string) ([]*Coupon, error)
发放优惠券
func (*CouponService) DeliverOne ¶
func (*CouponService) DiscardCouponsByRules ¶
func (this *CouponService) DiscardCouponsByRules(ruleIds []int)
func (*CouponService) RestoredCoupon ¶
func (this *CouponService) RestoredCoupon(user *account.User, coupon *Coupon) error
恢复优惠券
type EncodeCouponService ¶
type EncodeCouponService struct {
eel.ServiceBase
}
func NewEncodeCouponService ¶
func NewEncodeCouponService(ctx context.Context) *EncodeCouponService
func (*EncodeCouponService) Encode ¶
func (this *EncodeCouponService) Encode(coupon *Coupon) *RCoupon
Encode 对单个实体对象进行编码
func (*EncodeCouponService) EncodeMany ¶
func (this *EncodeCouponService) EncodeMany(coupons []*Coupon) []*RCoupon
EncodeMany 对实体对象进行批量编码
type EncodeRuleService ¶
type EncodeRuleService struct {
eel.ServiceBase
}
func NewEncodeRuleService ¶
func NewEncodeRuleService(ctx context.Context) *EncodeRuleService
func (*EncodeRuleService) Encode ¶
func (this *EncodeRuleService) Encode(rule *Rule) *RRule
Encode 对单个实体对象进行编码
func (*EncodeRuleService) EncodeMany ¶
func (this *EncodeRuleService) EncodeMany(rules []*Rule) []*RRule
EncodeMany 对实体对象进行批量编码
type FillCouponService ¶
type FillCouponService struct {
eel.ServiceBase
}
func NewFillCouponService ¶
func NewFillCouponService(ctx context.Context) *FillCouponService
func (*FillCouponService) Fill ¶
func (this *FillCouponService) Fill(coupons []*Coupon, option eel.FillOption)
type FillRuleService ¶
type FillRuleService struct {
eel.ServiceBase
}
func NewFillRuleService ¶
func NewFillRuleService(ctx context.Context) *FillRuleService
func (*FillRuleService) Fill ¶
func (this *FillRuleService) Fill(rules []*Rule, option eel.FillOption)
type RCoupon ¶
type RCoupon struct { Id int `json:"id"` UserId int `json:"user_id"` SourceType string `json:"source_type"` Code string `json:"code"` Status string `json:"status"` OrderBid string `json:"order_bid"` DeductionMoney float64 `json:"deduction_money"` ConsumedAt string `json:"consumed_at"` Rule *RRule `json:"rule"` CreatedAt string `json:"created_at"` }
type RRule ¶
type RRule struct { Id int `json:"id"` Name string `json:"name"` Count int `json:"count"` Desc string `json:"desc"` Remark string `json:"remark"` IsActive bool `json:"is_active"` IsDeleted bool `json:"is_deleted"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` CreatedAt string `json:"created_at"` Status string `json:"status"` Conditions []*RRuleCondition `json:"conditions"` RemainCouponCount int64 `json:"remain_coupon_count"` ReceiveStartDate string `json:"receive_start_date"` ReceiveEndDate string `json:"receive_end_date"` ReceiveStatus string `json:"receive_status"` CouponLinkUrl string `json:"coupon_link_url"` }
type RRuleCondition ¶
type Rule ¶
type Rule struct { eel.EntityBase Id int CorpId int Name string Count int Desc string Remark string IsActive bool IsDeleted bool StartDate time.Time EndDate time.Time CreatedAt time.Time Status string Conditions []*RuleCondition RemainCouponCount int64 ReceiveStartDate time.Time ReceiveEndDate time.Time ReceiveStatus string }
func NewRule ¶
func NewRule( ctx context.Context, corp business.ICorp, name string, count int, desc string, remark string, startDate string, endDate string, receiveStartDate string, receiveEndDate string, conditions *simplejson.Json, ) *Rule
工厂方法
func NewRuleFromModel ¶
根据model构建对象
func (*Rule) AddRuleCondition ¶
func (this *Rule) AddRuleCondition(ruleCondition *RuleCondition)
AddRuleCondition 添加限制条件对象
func (*Rule) GenerateCoupons ¶
生成优惠券
func (*Rule) GetConditions ¶
func (this *Rule) GetConditions() []*RuleCondition
func (*Rule) GetReceiveStatus ¶
GetReceiveStatus 是否在可领的时间范围内
func (*Rule) GetRemainCouponCount ¶
GetRemainCouponCount 剩余未领的张数
func (*Rule) Update ¶
func (this *Rule) Update( name string, count int, desc string, remark string, startDate string, endDate string, receiveStartDate string, receiveEndDate string, conditions *simplejson.Json, ) error
Update 更新对象
func (*Rule) UpdateRemark ¶
func (*Rule) UpdateRuleConditions ¶
func (this *Rule) UpdateRuleConditions(conditions *simplejson.Json)
UpdateRuleConditions 更新规则限制条件
type RuleCondition ¶
type RuleCondition struct { eel.EntityBase Id int Type string Data *simplejson.Json CreatedAt time.Time //foreign key RuleId int //refer to rule }
func NewRuleConditionFromModel ¶
func NewRuleConditionFromModel(ctx context.Context, model *m_coupon.RuleCondition) *RuleCondition
根据model构建对象
type RuleRepository ¶
type RuleRepository struct {
eel.RepositoryBase
}
func NewRuleRepository ¶
func NewRuleRepository(ctx context.Context) *RuleRepository
func (*RuleRepository) GetAllRulesForCorp ¶
func (this *RuleRepository) GetAllRulesForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
GetAllRulesForCorp 获得所有Rule对象集合
func (*RuleRepository) GetEnabledRules ¶
func (this *RuleRepository) GetEnabledRules(page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
GetEnabledRules 获得启用的Rule对象集合
func (*RuleRepository) GetPagedRules ¶
func (this *RuleRepository) GetPagedRules(filters eel.Map, page *eel.PageInfo, orderExprs ...string) ([]*Rule, eel.INextPageInfo)
func (*RuleRepository) GetRule ¶
func (this *RuleRepository) GetRule(id int) *Rule
GetRule 根据id获得Rule对象
func (*RuleRepository) GetRuleByName ¶
func (this *RuleRepository) GetRuleByName(name string) *Rule
GetRuleByName 根据name获得Rule对象
func (*RuleRepository) GetRuleInCorp ¶
func (this *RuleRepository) GetRuleInCorp(corp business.ICorp, id int) *Rule
GetRuleInCorp 根据id和corp获得Rule对象
func (*RuleRepository) GetRules ¶
func (this *RuleRepository) GetRules(filters eel.Map, orderExprs ...string) []*Rule
func (*RuleRepository) GetRulesForCorp ¶
func (this *RuleRepository) GetRulesForCorp(corp business.ICorp, page *eel.PageInfo, filters eel.Map) ([]*Rule, eel.INextPageInfo)
GetRulesForCorp 获得启用的Rule对象集合
type RuleService ¶
type RuleService struct {
eel.ServiceBase
}
func NewRuleService ¶
func NewRuleService(ctx context.Context) *RuleService
func (*RuleService) DeleteRuleById ¶
func (this *RuleService) DeleteRuleById(id int) bool
DeleteRule 根据id删除Rule对象
func (*RuleService) DeleteRuleByIds ¶
func (this *RuleService) DeleteRuleByIds(ids []int) bool