Files
junhong_cmp_fiber/internal/model/commission.go
huang 1cf17e8f14
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m46s
清理冗余的梯度返佣(TierCommission)配置
- 移除 Model 层:删除 ShopSeriesCommissionTier 模型及相关字段
- 更新 DTO:删除 TierCommissionConfig、TierEntry 类型及相关请求/响应字段
- 删除 Store 层:移除 ShopSeriesCommissionTierStore 及相关查询逻辑
- 简化 Service 层:删除梯度返佣处理逻辑,统计查询移除 tier_bonus 字段
- 数据库迁移:创建 000034_remove_tier_commission 移除相关表和字段
- 更新测试:移除梯度返佣相关测试用例,更新集成测试
- OpenAPI 文档:删除梯度返佣相关 schema 和枚举值
- 归档变更:归档 remove-tier-commission-redundancy 到 archive/2026-01-30-
- 同步规范:更新 4 个主 specs,标记废弃功能并添加迁移指引

原因:梯度返佣功能与一次性梯度佣金功能重复,且从未实现实际计算逻辑
迁移:使用一次性佣金的梯度模式 (OneTimeCommissionConfig.type = "tiered") 替代
2026-01-30 14:57:24 +08:00

47 lines
1.9 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"`
ShopID uint `gorm:"column:shop_id;index;not null;comment:店铺ID佣金归属" json:"shop_id"`
OrderID uint `gorm:"column:order_id;index;not null;comment:订单ID" json:"order_id"`
IotCardID *uint `gorm:"column:iot_card_id;index;comment:关联卡ID可空" json:"iot_card_id"`
DeviceID *uint `gorm:"column:device_id;index;comment:关联设备ID可空" json:"device_id"`
CommissionSource string `gorm:"column:commission_source;type:varchar(20);not null;index;comment:佣金来源 cost_diff-成本价差 one_time-一次性佣金" json:"commission_source"`
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-已失效" json:"status"`
ReleasedAt *time.Time `gorm:"column:released_at;comment:入账时间" json:"released_at"`
Remark string `gorm:"column:remark;type:varchar(500);comment:备注" json:"remark"`
}
// TableName 指定表名
func (CommissionRecord) TableName() string {
return "tb_commission_record"
}
// 佣金来源常量
const (
// CommissionSourceCostDiff 成本价差收入
CommissionSourceCostDiff = "cost_diff"
// CommissionSourceOneTime 一次性佣金
CommissionSourceOneTime = "one_time"
)
// 佣金状态常量
const (
// CommissionStatusReleased 已入账
CommissionStatusReleased = 1
// CommissionStatusInvalid 已失效
CommissionStatusInvalid = 2
)