51 lines
2.8 KiB
Go
51 lines
2.8 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type PointsMallProduct struct {
|
|
ID uint64 `gorm:"primaryKey" json:"id"`
|
|
Title string `gorm:"size:128;not null" json:"title"`
|
|
Subtitle string `gorm:"size:255;not null;default:''" json:"subtitle"`
|
|
Description string `gorm:"type:text;not null" json:"description"`
|
|
CoverURL string `gorm:"size:512;not null;default:''" json:"cover_url"`
|
|
RedemptionInstructions string `gorm:"type:text;not null" json:"redemption_instructions"`
|
|
PointsPrice int64 `gorm:"not null;default:0" json:"points_price"`
|
|
Stock int64 `gorm:"not null;default:0" json:"stock"`
|
|
RedeemedCount int64 `gorm:"not null;default:0" json:"redeemed_count"`
|
|
PerUserLimit int `gorm:"not null;default:1" json:"per_user_limit"`
|
|
Status string `gorm:"size:16;not null;default:'offline'" json:"status"`
|
|
SortOrder int `gorm:"not null;default:0" json:"sort_order"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func (PointsMallProduct) TableName() string {
|
|
return "points_mall_products"
|
|
}
|
|
|
|
type PointsMallRedemption struct {
|
|
ID uint64 `gorm:"primaryKey" json:"id"`
|
|
RedemptionNo string `gorm:"size:32;not null;uniqueIndex" json:"redemption_no"`
|
|
UserID uint64 `gorm:"not null;index" json:"user_id"`
|
|
ProductID uint64 `gorm:"not null;index" json:"product_id"`
|
|
ProductTitle string `gorm:"size:128;not null" json:"product_title"`
|
|
ProductCoverURL string `gorm:"size:512;not null;default:''" json:"product_cover_url"`
|
|
RedemptionInstructions string `gorm:"type:text;not null" json:"redemption_instructions"`
|
|
ContactName string `gorm:"size:32;not null;default:''" json:"contact_name"`
|
|
ContactPhone string `gorm:"size:32;not null;default:''" json:"contact_phone"`
|
|
CustomerRemark string `gorm:"size:500;not null;default:''" json:"customer_remark"`
|
|
PointsPrice int64 `gorm:"not null;default:0" json:"points_price"`
|
|
Quantity int `gorm:"not null;default:1" json:"quantity"`
|
|
TotalPoints int64 `gorm:"not null;default:0" json:"total_points"`
|
|
Status string `gorm:"size:16;not null;default:'pending'" json:"status"`
|
|
AdminRemark string `gorm:"size:255;not null;default:''" json:"admin_remark"`
|
|
CompletedBy *uint64 `json:"completed_by,omitempty"`
|
|
CompletedAt *time.Time `json:"completed_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func (PointsMallRedemption) TableName() string {
|
|
return "points_mall_redemptions"
|
|
}
|