Documentation
¶
Overview ¶
用户积分模块
Index ¶
- func CreateHistory(id uint, bal int, desc string, call bool) error
- func CreateHistoryTime(id uint, bal int, desc string, call bool, endT time.Duration) error
- func CreateIntegral(c *Integral) error
- func CreateType(c *IntegralType) error
- func Cron()
- func Regedit(c *Config)
- func SetDB(db *gorm.DB)
- type Config
- type Integral
- type IntegralHistory
- type IntegralType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHistoryTime ¶ added in v0.0.19
创建积分变动信息
id 积分账户ID bal 变动金额 desc 变动描述 call 是否回写主账户 endT 结束时间【time.xxx * xxx的形式,此处使用 time.Now().Add().Format()进行存储】 endT参数描述: 0 表示参照默认 -1 表示永久有效(默认有效期到2099-12-31年) 1~11 表示往后x月有效(含11) 12~20 表示往后x-11年有效(含20)
func CreateType ¶ added in v0.0.21
func CreateType(c *IntegralType) error
创建/修改积分隔离类信息
c 积分隔离分类存储的信息
Types ¶
type Config ¶
type Config struct {
DB *gorm.DB
IntegralName string // 积分主表名称
IntegralHistoryName string // 积分明细名称
IntegralTypeName string // 积分隔离表表名,用于隔离自身积分或者群积分、VIP积分等
}
配置项
type Integral ¶
type Integral struct {
Id uint `gorm:"column:id;primaryKey;not null;autoIncrement" json:"id" form:"id"` // 条目ID
UserId uint `gorm:"column:user_id;comment:用户ID" json:"user_id" form:"user_id"` // 用户ID
TypeId uint `` // 积分隔离ID
/* 131-byte string literal not displayed */
Name string `gorm:"column:name;type:VARCHAR(50);comment:积分名称" json:"name" form:"name"` // 积分名称
Desc string `gorm:"column:desc;type:VARCHAR(200);comment:积分详情" json:"desc" form:"desc"` // 积分详情
Type uint `` // 积分类型 1-每一条有单独的有效期 2-固定期限 3-无限期 4-x年后的固定月、日有效期
/* 182-byte string literal not displayed */
Balance uint `gorm:"column:balance;comment:积分余额" json:"balance" form:"balance"` // 积分余额
ExpireBalance uint `gorm:"column:expire_balance;comment:即将过期积分【3天内最近的】" json:"expire_balance" form:"expire_balance"` // 即将过期积分【3天内最近的】
ExpireDays uint `gorm:"column:expire_days;comment:默认过期时间【type=1-天 type=4-年】" json:"expire_days" form:"expire_days"` // 默认过期时间【type=1-天 type=4-年】
IsDeleted uint8 `gorm:"column:is_deleted;type:TINYINT UNSIGNED;comment:是否删除 0-否 1-是" json:"is_deleted" form:"is_deleted"` // 是否删除 0-否 1-是
EndDate string `gorm:"column:end_date;type:DATE;comment:过期时间【2-统一有效期 4-x月x日有效】" json:"end_date" form:"end_date"` // 过期时间【2-统一有效期 4-x月x日有效】
CreatedAt string `gorm:"column:created_at;type:DATETIME;comment:创建时间" json:"created_at" form:"created_at"` // 创建时间
UpdatedAt string `gorm:"column:updated_at;type:DATETIME;comment:更新时间" json:"updated_at" form:"updated_at"` // 更新时间
}
积分主表
type IntegralHistory ¶
type IntegralHistory struct {
Id uint `gorm:"column:id;primaryKey;not null;autoIncrement" json:"id" form:"id"` // 条目ID
IntegralId uint `gorm:"column:integral_id;comment:积分ID" json:"integral_id" form:"integral_id"` // 积分ID
Balance int `gorm:"column:balance;type:INT;comment:积分变动金额" json:"balance" form:"balance"` // 积分变动金额
EndDate string `gorm:"column:end_date;type:DATE;comment:过期时间" json:"end_date" form:"end_date"` // 过期时间
EndBalance uint `gorm:"column:end_balance;comment:剩余未使用积分" json:"end_balance" form:"end_balance"` // 剩余未使用积分
Desc string `gorm:"column:desc;type:VARCHAR(200);comment:积分变动描述" json:"desc" form:"desc"` // 积分变动描述
CreatedAt string `gorm:"column:created_at;type:DATETIME;comment:创建时间" json:"created_at" form:"created_at"` // 创建时间
}
积分明细表
func ListHistory ¶ added in v0.1.9
func ListHistory(integral_id uint, offset, limit int) (int64, []IntegralHistory, error)
type IntegralType ¶ added in v0.0.21
type IntegralType struct {
Id uint `gorm:"column:id;primaryKey;not null;autoIncrement" json:"id" form:"id"` // 条目ID
Name string `gorm:"column:name;type:VARCHAR(50);comment:积分名称" json:"name" form:"name"` // 隔离类型名称
Desc string `gorm:"column:desc;type:VARCHAR(200);comment:积分详情" json:"desc" form:"desc"` // 隔离类型详情
FileId uint `gorm:"column:file_id;comment:文件ID" json:"file_id" form:"file_id"` // 所属文件ID
UserId uint `gorm:"column:user_id;comment:用户ID" json:"user_id" form:"user_id"` // 创建人ID
CreatedAt string `gorm:"column:created_at;type:DATETIME;comment:创建时间" json:"created_at" form:"created_at"` // 创建时间
UpdatedAt string `gorm:"column:updated_at;type:DATETIME;comment:更新时间" json:"updated_at" form:"updated_at"` // 更新时间
}
积分隔离备注表
func InfoType ¶ added in v0.0.21
func InfoType(id uint) (*IntegralType, error)
获取积分隔离详情信息
id 积分隔离条目ID
Click to show internal directories.
Click to hide internal directories.