第 5 阶段:纠纷、通知与后台-1

This commit is contained in:
yml
2026-05-22 16:34:32 +08:00
parent 9ebdfab078
commit 99f9df7bcd
32 changed files with 1711 additions and 8 deletions
+24
View File
@@ -0,0 +1,24 @@
package model
import (
"time"
"gorm.io/datatypes"
)
type AuditLog struct {
ID uint64 `gorm:"primaryKey" json:"id"`
ActorType string `gorm:"size:32;not null" json:"actor_type"`
ActorID uint64 `gorm:"not null;index" json:"actor_id"`
Action string `gorm:"size:64;not null" json:"action"`
BizType string `gorm:"size:32;not null" json:"biz_type"`
BizID *uint64 `json:"biz_id"`
IP string `gorm:"size:64;not null;default:''" json:"ip"`
UserAgent string `gorm:"size:512;not null;default:''" json:"user_agent"`
Detail datatypes.JSON `json:"detail"`
CreatedAt time.Time `json:"created_at"`
}
func (AuditLog) TableName() string {
return "audit_logs"
}
+28
View File
@@ -0,0 +1,28 @@
package model
import (
"time"
"gorm.io/datatypes"
)
type Dispute struct {
ID uint64 `gorm:"primaryKey" json:"id"`
OrderID uint64 `gorm:"not null;index" json:"order_id"`
InitiatorID uint64 `gorm:"not null" json:"initiator_id"`
TargetUserID uint64 `gorm:"not null" json:"target_user_id"`
Type string `gorm:"size:32;not null" json:"type"`
Status string `gorm:"size:32;not null;default:'open'" json:"status"`
Description string `json:"description"`
EvidenceURLS datatypes.JSON `json:"evidence_urls"`
ArbitrationResult string `gorm:"size:32;not null;default:''" json:"arbitration_result"`
ArbitrationRemark string `json:"arbitration_remark"`
HandledBy *uint64 `json:"handled_by"`
HandledAt *time.Time `json:"handled_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Dispute) TableName() string {
return "disputes"
}
+19
View File
@@ -0,0 +1,19 @@
package model
import "time"
type Notification struct {
ID uint64 `gorm:"primaryKey" json:"id"`
UserID uint64 `gorm:"not null;index" json:"user_id"`
Type string `gorm:"size:32;not null" json:"type"`
Title string `gorm:"size:128;not null" json:"title"`
Content string `json:"content"`
BizType string `gorm:"size:32;not null;default:''" json:"biz_type"`
BizID *uint64 `json:"biz_id"`
ReadAt *time.Time `json:"read_at"`
CreatedAt time.Time `json:"created_at"`
}
func (Notification) TableName() string {
return "notifications"
}
+17
View File
@@ -0,0 +1,17 @@
package model
import "time"
type SystemConfig struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Key string `gorm:"column:key;size:128;not null;uniqueIndex" json:"key"`
Value string `gorm:"column:value;type:text;not null" json:"value"`
Description string `gorm:"size:255;not null;default:''" json:"description"`
UpdatedBy *uint64 `json:"updated_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (SystemConfig) TableName() string {
return "system_configs"
}