coupon

package
v0.0.0-...-2cd4ea5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const CONDITION_TYPE_COUNT_PER_USER = 5 // 每人限领张数
View Source
const CONDITION_TYPE_DEDUCTION = 4 // 抵扣
View Source
const CONDITION_TYPE_DISCOUNT = 2 // 折扣
View Source
const CONDITION_TYPE_REACH_DEDUCTION = 3 // 满减(满xx后抵扣)
View Source
const CONDITION_TYPE_SINGLE_PRODUCT = 1 // 单品

优惠券规则条件类型

View Source
const COUPON_SOURCE_TYPE_ASSIGNED = 2 // 分配
View Source
const COUPON_SOURCE_TYPE_INITIATIVE = 1 // 主动领取的

优惠券的来源

View Source
const COUPON_STATUS_DISCARD = 4 // 作废
View Source
const COUPON_STATUS_EXPIRED = 2 // 已过期
View Source
const COUPON_STATUS_INVALID = 3 // 已失效
View Source
const COUPON_STATUS_UNUSED = 0 // 已领取

优惠券状态 const COUPON_STATUS_UNRECEIVED = 0 // unreceived未领取

View Source
const COUPON_STATUS_USED = 1 // 已使用

Variables

View Source
var CONDITION_TYPE2CODE = map[int]string{
	CONDITION_TYPE_SINGLE_PRODUCT:  "single_product",
	CONDITION_TYPE_DISCOUNT:        "discount",
	CONDITION_TYPE_REACH_DEDUCTION: "reach_deduction",
	CONDITION_TYPE_DEDUCTION:       "deduction",
	CONDITION_TYPE_COUNT_PER_USER:  "count_per_user",
}
View Source
var CONDITION_TYPE_CODE2TYPE = map[string]int{
	"single_product":  CONDITION_TYPE_SINGLE_PRODUCT,
	"discount":        CONDITION_TYPE_DISCOUNT,
	"reach_deduction": CONDITION_TYPE_REACH_DEDUCTION,
	"deduction":       CONDITION_TYPE_DEDUCTION,
	"count_per_user":  CONDITION_TYPE_COUNT_PER_USER,
}
View Source
var COUPON_SOURCE_TYPE2CODE = map[int]string{
	COUPON_SOURCE_TYPE_INITIATIVE: "initiative",
	COUPON_SOURCE_TYPE_ASSIGNED:   "assigned",
}
View Source
var COUPON_SOURCE_TYPE_CODE2TYPE = map[string]int{
	"initiative": COUPON_SOURCE_TYPE_INITIATIVE,
	"assigned":   COUPON_SOURCE_TYPE_ASSIGNED,
}
View Source
var COUPON_STATUS2CODE = map[int]string{
	COUPON_STATUS_UNUSED:  "unused",
	COUPON_STATUS_USED:    "used",
	COUPON_STATUS_EXPIRED: "expired",
	COUPON_STATUS_INVALID: "invalid",
	COUPON_STATUS_DISCARD: "discard",
}
View Source
var COUPON_STATUS2CODE2STR = map[string]string{
	"unused":  "未使用",
	"used":    "已使用",
	"expired": "已过期",
	"invalid": "已失效",
	"discard": "作废",
}
View Source
var COUPON_STATUS_CODE2STATUS = map[string]int{
	"unused":  COUPON_STATUS_UNUSED,
	"used":    COUPON_STATUS_USED,
	"expired": COUPON_STATUS_EXPIRED,
	"invalid": COUPON_STATUS_INVALID,
	"discard": COUPON_STATUS_DISCARD,
}

Functions

This section is empty.

Types

type Coupon

type Coupon struct {
	eel.Model
	RuleId         int       `gorm:index`
	UserId         int       `gorm:"default:0;index"`
	SourceType     int       `gorm:"default:0"`
	Code           string    `gorm:"size:50;index"`
	Status         int       `gorm:"default:0"`
	OrderBid       string    `gorm:"size:32;default:'';index"`
	DeductionMoney float64   `sql:"type:float(255,2);"`
	ConsumedAt     time.Time `gorm:"type:datetime"`
}

Coupon Model

func (*Coupon) TableName

func (self *Coupon) TableName() string

type Rule

type Rule struct {
	eel.Model
	CorpId           int `gorm:"index"` //foreign key for corp
	Name             string
	Count            int
	Desc             string
	Remark           string
	IsActive         bool      `gorm:"default:true"`
	IsDeleted        bool      `gorm:"default:false"`
	StartDate        time.Time `gorm:"type:datetime"`
	EndDate          time.Time `gorm:"type:datetime"`
	ReceiveStartDate time.Time `gorm:"type:datetime"`
	ReceiveEndDate   time.Time `gorm:"type:datetime"`
}

Rule Model

func (*Rule) TableName

func (self *Rule) TableName() string

type RuleCondition

type RuleCondition struct {
	eel.Model
	RuleId int `gorm:index`
	Type   int `gorm:index`
	Data   string
}

RuleCondition Model

func (*RuleCondition) TableName

func (self *RuleCondition) TableName() string

Jump to

Keyboard shortcuts

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