All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m30s
新增功能: - 门店套餐分配管理(shop_package_allocation):支持门店套餐库存管理 - 门店套餐系列分配管理(shop_series_allocation):支持套餐系列分配和佣金层级设置 - 我的套餐查询(my_package):支持门店查询自己的套餐分配情况 测试改进: - 统一集成测试基础设施,新增 testutils.NewIntegrationTestEnv - 重构所有集成测试使用新的测试环境设置 - 移除旧的测试辅助函数和冗余测试文件 - 新增 test_helpers_test.go 统一任务测试辅助 技术细节: - 新增数据库迁移 000025_create_shop_allocation_tables - 新增 3 个 Handler、Service、Store 和对应的单元测试 - 更新 OpenAPI 文档和文档生成器 - 测试覆盖率:Service 层 > 90% Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
44 lines
2.4 KiB
Go
44 lines
2.4 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
)
|
||
|
||
// ShopSeriesAllocation 店铺套餐系列分配模型
|
||
// 记录上级店铺为下级店铺分配的套餐系列,包含加价模式和一次性佣金配置
|
||
// 分配者只能分配自己已被分配的套餐系列,且只能分配给直属下级
|
||
type ShopSeriesAllocation struct {
|
||
gorm.Model
|
||
BaseModel `gorm:"embedded"`
|
||
ShopID uint `gorm:"column:shop_id;index;not null;comment:被分配的店铺ID" json:"shop_id"`
|
||
SeriesID uint `gorm:"column:series_id;index;not null;comment:套餐系列ID" json:"series_id"`
|
||
AllocatorShopID uint `gorm:"column:allocator_shop_id;index;not null;comment:分配者店铺ID(上级)" json:"allocator_shop_id"`
|
||
PricingMode string `gorm:"column:pricing_mode;type:varchar(20);not null;comment:加价模式 fixed-固定金额 percent-百分比" json:"pricing_mode"`
|
||
PricingValue int64 `gorm:"column:pricing_value;type:bigint;not null;comment:加价值(分或千分比,如100=10%)" json:"pricing_value"`
|
||
OneTimeCommissionTrigger string `gorm:"column:one_time_commission_trigger;type:varchar(30);comment:一次性佣金触发类型 one_time_recharge-单次充值 accumulated_recharge-累计充值" json:"one_time_commission_trigger"`
|
||
OneTimeCommissionThreshold int64 `gorm:"column:one_time_commission_threshold;type:bigint;default:0;comment:一次性佣金触发阈值(分)" json:"one_time_commission_threshold"`
|
||
OneTimeCommissionAmount int64 `gorm:"column:one_time_commission_amount;type:bigint;default:0;comment:一次性佣金金额(分)" json:"one_time_commission_amount"`
|
||
Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-启用 2-禁用" json:"status"`
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (ShopSeriesAllocation) TableName() string {
|
||
return "tb_shop_series_allocation"
|
||
}
|
||
|
||
// 加价模式常量
|
||
const (
|
||
// PricingModeFixed 固定金额加价
|
||
PricingModeFixed = "fixed"
|
||
// PricingModePercent 百分比加价(千分比)
|
||
PricingModePercent = "percent"
|
||
)
|
||
|
||
// 一次性佣金触发类型常量
|
||
const (
|
||
// OneTimeCommissionTriggerOneTimeRecharge 单次充值触发
|
||
OneTimeCommissionTriggerOneTimeRecharge = "one_time_recharge"
|
||
// OneTimeCommissionTriggerAccumulatedRecharge 累计充值触发
|
||
OneTimeCommissionTriggerAccumulatedRecharge = "accumulated_recharge"
|
||
)
|