feat: 添加金豆消费记录功能
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

添加金豆消费记录表和相关服务,用于记录用户金豆消耗明细
在购买逻辑中预留记录消费的注释位置
This commit is contained in:
xinian
2026-02-23 07:47:06 +08:00
committed by cnb
parent 84768e3406
commit 75cfc7bcb1
5 changed files with 27 additions and 13 deletions

View File

@@ -12,9 +12,9 @@ const (
// 通过金豆消费时间来确认金豆物品的购买重置周期
// GoldBeanConsume 金豆消费核心模型(与数据库表字段一一对应,存储消费明细)
type GoldBeanConsume struct {
Base
*cool.Model
UID uint32 `gorm:"not null;default:0;index;comment:'玩家唯一ID关联玩家表主键'" json:"uid" description:"玩家ID"`
PlayerID uint64 `gorm:"not null;uniqueIndex;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"`
ConsumeNum uint32 `gorm:"not null;default:0;comment:'金豆消费数量(非负数)'" json:"consume_num" description:"消费金豆数量"`
BizID uint32 `gorm:"not null;default:0;comment:'关联业务ID如道具ID/扭蛋池ID无则填0'" json:"biz_id" description:"关联业务ID"`
///消费年份
@@ -40,7 +40,7 @@ func (*GoldBeanConsume) GroupName() string {
// NewGoldBeanConsume 创建金豆消费记录实例初始化通用Model及默认值
func NewGoldBeanConsume() *GoldBeanConsume {
return &GoldBeanConsume{
Base: *NewBase(),
Model: cool.NewModel(),
}
}