退款列表快照订单号
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m30s

This commit is contained in:
2026-04-23 10:59:34 +08:00
parent 52d883d8a0
commit 1f1f31a7cb
9 changed files with 94 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ type RefundResponse struct {
ID uint `json:"id" description:"退款申请ID"`
RefundNo string `json:"refund_no" description:"退款单号"`
OrderID uint `json:"order_id" description:"关联订单ID"`
OrderNo string `json:"order_no" description:"订单号"`
PackageUsageID *uint `json:"package_usage_id,omitempty" description:"关联套餐使用记录ID"`
ShopID *uint `json:"shop_id,omitempty" description:"店铺ID"`
ShopName string `json:"shop_name,omitempty" description:"店铺名称"`

View File

@@ -16,6 +16,7 @@ type RefundRequest struct {
// 退款单基础信息
RefundNo string `gorm:"column:refund_no;type:varchar(50);uniqueIndex:idx_refund_request_refund_no,where:deleted_at IS NULL;not null;comment:退款单号RF+日期时间+6位随机数" json:"refund_no"`
OrderID uint `gorm:"column:order_id;index;not null;comment:关联订单ID" json:"order_id"`
OrderNo string `gorm:"column:order_no;type:varchar(30);not null;default:'';comment:关联订单号快照" json:"order_no"`
PackageUsageID *uint `gorm:"column:package_usage_id;comment:关联套餐使用记录ID可选" json:"package_usage_id,omitempty"`
ShopID *uint `gorm:"column:shop_id;index;comment:店铺ID从订单获取用于数据权限过滤" json:"shop_id,omitempty"`
ShopName string `gorm:"column:shop_name;->" json:"shop_name,omitempty"`

View File

@@ -110,6 +110,7 @@ func (s *Service) Create(ctx context.Context, req *dto.CreateRefundRequest) (*dt
refund := &model.RefundRequest{
RefundNo: generateRefundNo(),
OrderID: req.OrderID,
OrderNo: order.OrderNo,
PackageUsageID: req.PackageUsageID,
ShopID: shopID,
ActualReceivedAmount: req.ActualReceivedAmount,
@@ -644,6 +645,7 @@ func buildRefundResponse(r *model.RefundRequest) *dto.RefundResponse {
ID: r.ID,
RefundNo: r.RefundNo,
OrderID: r.OrderID,
OrderNo: r.OrderNo,
PackageUsageID: r.PackageUsageID,
ShopID: r.ShopID,
ShopName: r.ShopName,