- Added new structured snapshot types for orders and order items to improve data integrity and clarity. - Updated the Order and OrderItem models to use the new JSONType for snapshots. - Refactored tests to accommodate the new snapshot structure, ensuring compatibility with legacy data. - Enhanced the OrdersSnapshot struct to support multiple snapshot types and maintain backward compatibility. - Introduced new fields for order items and orders to capture detailed snapshot information for auditing and historical display.
16 lines
590 B
Go
16 lines
590 B
Go
package fields
|
|
|
|
// OrderItemsSnapshot 定义 order_items.snapshot 的固定结构。
|
|
//
|
|
// 该快照用于“历史展示与审计”:即使内容标题/作者等信息后续变更,也不影响已下单记录的展示一致性。
|
|
type OrderItemsSnapshot struct {
|
|
// ContentID 内容 ID。
|
|
ContentID int64 `json:"content_id"`
|
|
// ContentTitle 内容标题快照。
|
|
ContentTitle string `json:"content_title"`
|
|
// ContentUserID 内容作者用户 ID。
|
|
ContentUserID int64 `json:"content_user_id"`
|
|
// AmountPaid 该行实付金额(分)。
|
|
AmountPaid int64 `json:"amount_paid"`
|
|
}
|