🎨 新增兑换码功能,新增vip过期检测定时任务

This commit is contained in:
2025-09-09 22:25:27 +08:00
parent a30ab925d1
commit c588e9efe7
19 changed files with 914 additions and 56 deletions

34
model/app/redeem_code.go Normal file
View File

@@ -0,0 +1,34 @@
package app
import "git.echol.cn/loser/lckt/global"
type RedeemCode struct {
global.GVA_MODEL
CodeName string `json:"codeName" gorm:"comment:兑换码名称"`
Type int `json:"type" gorm:"comment:类型1-VIP,2-讲师VIP,3-课程"`
Item uint `json:"item" gorm:"comment:对应类型的ID"`
Num int `json:"num" gorm:"comment:兑换码数量"`
No int `json:"no" gorm:"comment:已使用数量"`
}
func (RedeemCode) TableName() string {
return "app_redeem_code"
}
type CDK struct {
global.GVA_MODEL
RedeemId uint `json:"redeemId" gorm:"comment:兑换码库ID"`
Code string `json:"code" gorm:"unique;comment:兑换码"`
Status int `json:"status" gorm:"default:1;comment:状态1-未使用2-已使用3-已过期"`
UseId uint `json:"useId" gorm:"comment:使用用户ID"`
UseName string `json:"useName" gorm:"comment:使用用户名"`
UseAt string `json:"useAt" gorm:"comment:使用时间"`
// 有效期
ValidDay int `json:"validDay" gorm:"comment:有效期,单位天 0表示永久有效"`
// 过期时间
ExpireAt string `json:"expireAt" gorm:"comment:过期时间"`
}
func (CDK) TableName() string {
return "app_cdk"
}