完善测试建表并统一前端格式

This commit is contained in:
yml2213
2026-07-14 01:32:14 +08:00
parent 2efcede800
commit 2ca6fd9306
36 changed files with 714 additions and 478 deletions
+38
View File
@@ -4,6 +4,8 @@ import (
"fmt"
"log"
"hfb_sys/backend/internal/model"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
@@ -31,3 +33,39 @@ func NewTestDBWithName(name string) *gorm.DB {
}
return db
}
// MigrateListingLifecycleTestSchema 创建商品生命周期测试所需的共享表结构。
func MigrateListingLifecycleTestSchema(db *gorm.DB) error {
return db.AutoMigrate(
&model.User{},
&model.GameAccount{},
&model.RentalListing{},
&model.ListingStatusEvent{},
)
}
// MigrateRentalTransactionTestSchema 在商品生命周期基础上创建订单、支付和交接测试所需的共享表结构。
func MigrateRentalTransactionTestSchema(db *gorm.DB) error {
if err := MigrateListingLifecycleTestSchema(db); err != nil {
return err
}
return db.AutoMigrate(
&model.RentalOrder{},
&model.PaymentOrder{},
&model.Notification{},
&model.HandoffRecord{},
&model.OrderCheckout{},
&model.AuditLog{},
&model.ChatConversation{},
&model.ChatParticipant{},
&model.ChatMessage{},
)
}
// MigrateRentalDisputeTestSchema 在交易链路基础上创建申诉测试所需的表结构。
func MigrateRentalDisputeTestSchema(db *gorm.DB) error {
if err := MigrateRentalTransactionTestSchema(db); err != nil {
return err
}
return db.AutoMigrate(&model.Dispute{})
}