Update mengyastore
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// StringSlice is a JSON-serialized string slice stored as a MySQL TEXT/JSON column.
|
||||
// StringSlice 表示以 JSON 序列化形式存入 MySQL TEXT/JSON 列的字符串切片。
|
||||
type StringSlice []string
|
||||
|
||||
func (s StringSlice) Value() (driver.Value, error) {
|
||||
@@ -31,9 +31,9 @@ func (s *StringSlice) Scan(src any) error {
|
||||
return json.Unmarshal(raw, s)
|
||||
}
|
||||
|
||||
// ─── Products ────────────────────────────────────────────────────────────────
|
||||
// ─── 商品 ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
// ProductRow is the GORM model for the `products` table.
|
||||
// ProductRow 为 `products` 表的 GORM 模型。
|
||||
type ProductRow struct {
|
||||
ID string `gorm:"primaryKey;size:36"`
|
||||
Name string `gorm:"size:255;not null"`
|
||||
@@ -55,12 +55,14 @@ type ProductRow struct {
|
||||
FixedContent string `gorm:"type:text"`
|
||||
ShowNote bool `gorm:"default:true"`
|
||||
ShowContact bool `gorm:"default:true"`
|
||||
// PaymentQrURLs JSON:萌芽支付等多张收款码图片链接。
|
||||
PaymentQrURLs StringSlice `gorm:"column:payment_qr_urls;type:json"`
|
||||
CreatedAt time.Time `gorm:"index"`
|
||||
}
|
||||
|
||||
func (ProductRow) TableName() string { return "products" }
|
||||
|
||||
// ProductCodeRow stores individual codes for a product (one row per code).
|
||||
// ProductCodeRow 单条卡密一行,按商品维度存储。
|
||||
type ProductCodeRow struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
ProductID string `gorm:"size:36;not null;index"`
|
||||
@@ -69,7 +71,7 @@ type ProductCodeRow struct {
|
||||
|
||||
func (ProductCodeRow) TableName() string { return "product_codes" }
|
||||
|
||||
// ─── Orders ──────────────────────────────────────────────────────────────────
|
||||
// ─── 订单 ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
type OrderRow struct {
|
||||
ID string `gorm:"primaryKey;size:36"`
|
||||
@@ -85,14 +87,20 @@ type OrderRow struct {
|
||||
ContactPhone string `gorm:"size:50"`
|
||||
ContactEmail string `gorm:"size:255"`
|
||||
NotifyEmail string `gorm:"size:255"`
|
||||
// PaymentMethod 如 mengya;历史订单或免费单可能为空。
|
||||
PaymentMethod string `gorm:"size:32;default:'';index"`
|
||||
// PaymentExpectedTotal 待支付时应付快照(元),用于 Webhook 金额核对。
|
||||
PaymentExpectedTotal float64 `gorm:"default:0"`
|
||||
// PaymentExpiresAt 待支付截止时间;非待支付订单为 NULL。
|
||||
PaymentExpiresAt *time.Time `gorm:"index"`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
func (OrderRow) TableName() string { return "orders" }
|
||||
|
||||
// ─── Site settings ───────────────────────────────────────────────────────────
|
||||
// ─── 站点设置 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
// SiteSettingRow stores arbitrary key-value pairs for site-wide settings.
|
||||
// SiteSettingRow 站点级键值配置。
|
||||
type SiteSettingRow struct {
|
||||
Key string `gorm:"primaryKey;size:64"`
|
||||
Value string `gorm:"type:text"`
|
||||
@@ -100,7 +108,7 @@ type SiteSettingRow struct {
|
||||
|
||||
func (SiteSettingRow) TableName() string { return "site_settings" }
|
||||
|
||||
// ─── Wishlists ───────────────────────────────────────────────────────────────
|
||||
// ─── 收藏夹 ───────────────────────────────────────────────────────────────────
|
||||
|
||||
type WishlistRow struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
@@ -110,7 +118,7 @@ type WishlistRow struct {
|
||||
|
||||
func (WishlistRow) TableName() string { return "wishlists" }
|
||||
|
||||
// ─── Chat messages ───────────────────────────────────────────────────────────
|
||||
// ─── 聊天消息 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
type ChatMessageRow struct {
|
||||
ID string `gorm:"primaryKey;size:36"`
|
||||
|
||||
Reference in New Issue
Block a user