Files
junhong_cmp_fiber/internal/model/commission.go
huang 79c061b6fa
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m24s
feat: 实现套餐管理模块,包含套餐系列、双状态管理、废弃模型清理
- 新增套餐系列管理 (CRUD + 状态切换)
- 新增套餐管理 (CRUD + 启用/禁用 + 上架/下架双状态)
- 清理 8 个废弃分佣模型及对应数据库表
- Package 模型新增建议成本价、建议售价、上架状态字段
- 完整的 Store/Service/Handler 三层实现
- 包含单元测试和集成测试
- 归档 add-package-module change
- 新增多个 OpenSpec changes (订单支付、店铺套餐分配、一次性分佣、卡设备系列绑定)
2026-01-27 19:55:47 +08:00

30 lines
1.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"time"
"gorm.io/gorm"
)
// CommissionRecord 分佣记录模型
// 记录分佣的冻结、解冻、发放状态
type CommissionRecord struct {
gorm.Model
BaseModel `gorm:"embedded"`
AgentID uint `gorm:"column:agent_id;index;not null;comment:代理用户ID" json:"agent_id"`
ShopID uint `gorm:"column:shop_id;index;comment:店铺ID佣金主要跟着店铺走" json:"shop_id"`
OrderID uint `gorm:"column:order_id;index;not null;comment:订单ID" json:"order_id"`
RuleID uint `gorm:"column:rule_id;index;not null;comment:分佣规则ID" json:"rule_id"`
CommissionType string `gorm:"column:commission_type;type:varchar(50);not null;comment:分佣类型 one_time-一次性 long_term-长期" json:"commission_type"`
Amount int64 `gorm:"column:amount;type:bigint;not null;comment:分佣金额(分为单位)" json:"amount"`
BalanceAfter int64 `gorm:"column:balance_after;type:bigint;default:0;comment:入账后佣金余额(分)" json:"balance_after"`
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-已冻结 2-解冻中 3-已发放 4-已失效" json:"status"`
UnfrozenAt *time.Time `gorm:"column:unfrozen_at;comment:解冻时间" json:"unfrozen_at"`
ReleasedAt *time.Time `gorm:"column:released_at;comment:发放时间" json:"released_at"`
}
// TableName 指定表名
func (CommissionRecord) TableName() string {
return "tb_commission_record"
}