完善订单交接结账流程留痕
This commit is contained in:
@@ -41,6 +41,8 @@ type RentalOrder struct {
|
||||
GrowthPointsAwarded int64 `gorm:"not null;default:0" json:"growth_points_awarded"`
|
||||
GrowthPointsAwardedAt *time.Time `json:"growth_points_awarded_at"`
|
||||
AccountSnapshot datatypes.JSON `json:"account_snapshot"`
|
||||
AccountSource string `gorm:"size:32;not null;default:'internal';index" json:"account_source"`
|
||||
SourceChannel string `gorm:"size:32;not null;default:''" json:"source_channel"`
|
||||
Status string `gorm:"size:32;not null;default:'pending_payment'" json:"status"`
|
||||
HandoffStatus string `gorm:"size:32;not null;default:'none'" json:"handoff_status"`
|
||||
HandoffMode string `gorm:"size:16;not null;default:'owner';index" json:"handoff_mode"`
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
// ProcessEvent 是订单、提号等交易流程的不可变操作留痕。
|
||||
// 当前业务表仍保存当前状态;此表只追加,用于还原每一步由谁填写、修改和确认。
|
||||
type ProcessEvent struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
BusinessType string `gorm:"size:32;not null;index:idx_process_event_business" json:"business_type"`
|
||||
BusinessID uint64 `gorm:"not null;index:idx_process_event_business" json:"business_id"`
|
||||
Stage string `gorm:"size:32;not null;default:''" json:"stage"`
|
||||
Action string `gorm:"size:64;not null" json:"action"`
|
||||
ActorType string `gorm:"size:16;not null" json:"actor_type"`
|
||||
ActorID uint64 `gorm:"not null;default:0" json:"actor_id"`
|
||||
ActorName string `gorm:"size:128;not null;default:''" json:"actor_name"`
|
||||
TargetType string `gorm:"size:16;not null;default:''" json:"target_type"`
|
||||
TargetID *uint64 `json:"target_id,omitempty"`
|
||||
TargetName string `gorm:"size:128;not null;default:''" json:"target_name"`
|
||||
Content string `gorm:"type:text" json:"content"`
|
||||
Reason string `gorm:"type:text" json:"reason"`
|
||||
Payload datatypes.JSON `gorm:"not null" json:"payload"`
|
||||
AttachmentURLs datatypes.JSON `gorm:"column:attachment_urls;not null" json:"attachment_urls"`
|
||||
StateBefore datatypes.JSON `gorm:"column:state_before;not null" json:"state_before"`
|
||||
StateAfter datatypes.JSON `gorm:"column:state_after;not null" json:"state_after"`
|
||||
CreatedAt time.Time `gorm:"index" json:"created_at"`
|
||||
}
|
||||
|
||||
func (ProcessEvent) TableName() string {
|
||||
return "process_events"
|
||||
}
|
||||
Reference in New Issue
Block a user