All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m33s
- 删除 model/commission.go 中与 constants 包冲突的旧常量(值=1/2) - 所有服务层改用 constants.CommissionStatusReleased(值=3)写入和查询 - 数据库迁移:status 1→3(已发放),2→4(已失效) - 修复佣金明细列表接口,通过 JOIN 关联返回 order_no、iccid、virtual_no、order_created_at - 新增 seller_shop_id / seller_shop_name 销售来源字段 - 统计接口过滤条件从精确匹配改为排除无效(NOT IN 4,99) - 更新 OpenAPI 文档及 commission-record-query spec
39 lines
1.8 KiB
Go
39 lines
1.8 KiB
Go
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-解冻中 3-已发放 4-已失效" 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"
|
||
)
|