Files
junhong_cmp_fiber/migrations/000030_add_order_commission_fields.up.sql
huang e87513541b
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m41s
feat: 实现一次性佣金功能
- 新增佣金计算服务,支持一次性佣金和返佣计算
- 新增 ShopSeriesOneTimeCommissionTier 模型和存储层
- 新增两个数据库迁移:一次性佣金表和订单佣金字段
- 更新 Commission 模型,新增佣金来源和关联字段
- 更新 CommissionRecord 存储层,支持一次性佣金查询
- 更新 MyCommission 服务,集成一次性佣金计算逻辑
- 更新 ShopCommission 服务,支持一次性佣金统计
- 新增佣金计算异步任务处理器
- 更新 API 路由,新增一次性佣金相关端点
- 归档 OpenSpec 变更文档,同步规范到主规范库
2026-01-29 09:36:12 +08:00

20 lines
961 B
SQL
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.
-- 迁移: 为 Order 表添加佣金计算所需字段
-- 说明:
-- 1. 添加 seller_shop_id 字段销售店铺ID用于成本价差计算
-- 2. 添加 seller_cost_price 字段(销售成本价,用于计算利润)
-- 3. 添加 series_id 字段系列ID用于查询分配配置
ALTER TABLE tb_order
ADD COLUMN IF NOT EXISTS seller_shop_id BIGINT,
ADD COLUMN IF NOT EXISTS seller_cost_price BIGINT DEFAULT 0,
ADD COLUMN IF NOT EXISTS series_id BIGINT;
-- 添加索引
CREATE INDEX IF NOT EXISTS idx_order_seller_shop_id ON tb_order(seller_shop_id);
CREATE INDEX IF NOT EXISTS idx_order_series_id ON tb_order(series_id);
-- 添加字段注释
COMMENT ON COLUMN tb_order.seller_shop_id IS '销售店铺ID用于成本价差佣金计算';
COMMENT ON COLUMN tb_order.seller_cost_price IS '销售成本价(分,用于计算利润)';
COMMENT ON COLUMN tb_order.series_id IS '系列ID用于查询分配配置';