Files
lunar-mini/server/internal/model/commerce.go
T
goukiandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 132fef051b feat(commerce): 排盘保存需显式同意,默认本地计算不上传
- 前端免费排盘默认不保存,勾选同意后才调用保存接口
- 服务端要求 consentVersion,记录 consentAt,校验并限流公开保存接口
- 付费结算单独披露报告快照与订单信息将由服务端存储
- 管理端展示同意版本与时间,历史无同意证据记录保留并标注

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-27 23:21:16 +00:00

77 lines
3.3 KiB
Go

package model
import "time"
type BaziChartRecord struct {
ID uint `gorm:"primaryKey" json:"id"`
ReportID string `gorm:"index;size:64" json:"reportId"`
UserID *uint `gorm:"index" json:"userId,omitempty"`
Name string `gorm:"size:64" json:"name"`
BirthDate string `gorm:"size:16" json:"birthDate"`
BirthTime string `gorm:"size:8" json:"birthTime"`
Gender string `gorm:"size:16" json:"gender"`
City string `gorm:"size:64" json:"city"`
ConsentVersion string `gorm:"size:32;not null;default:''" json:"consentVersion"`
ConsentAt *time.Time `json:"consentAt,omitempty"`
Snapshot string `gorm:"type:longtext" json:"-"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type ReportProduct struct {
ID uint `gorm:"primaryKey" json:"id"`
Code string `gorm:"uniqueIndex;size:40" json:"code"`
Name string `gorm:"size:100" json:"name"`
Description string `gorm:"size:255" json:"description"`
StripeAmount int `json:"stripeAmount"`
StripeCurrency string `gorm:"size:10" json:"stripeCurrency"`
BinanceAmount string `gorm:"size:32" json:"binanceAmount"`
BinanceCurrency string `gorm:"size:10" json:"binanceCurrency"`
Status int `gorm:"default:1" json:"status"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type ReportEntitlement struct {
ID uint `gorm:"primaryKey" json:"id"`
UserID uint `gorm:"uniqueIndex:idx_user_report;index" json:"userId"`
ReportID string `gorm:"uniqueIndex:idx_user_report;size:64;index" json:"reportId"`
OrderID uint `gorm:"uniqueIndex" json:"orderId"`
Status string `gorm:"size:20;default:'active'" json:"status"`
GrantedAt time.Time `json:"grantedAt"`
RevokedAt *time.Time `json:"revokedAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type ReportSnapshot struct {
ID uint `gorm:"primaryKey" json:"id"`
UserID uint `gorm:"index" json:"userId"`
ReportID string `gorm:"size:64;index" json:"reportId"`
OrderID uint `gorm:"uniqueIndex;index" json:"orderId"`
Snapshot string `gorm:"type:longtext" json:"-"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type PaymentEvent struct {
ID uint `gorm:"primaryKey" json:"id"`
Provider string `gorm:"uniqueIndex:idx_provider_event;size:30" json:"provider"`
ProviderEventID string `gorm:"uniqueIndex:idx_provider_event;size:128" json:"providerEventId"`
EventType string `gorm:"size:80" json:"eventType"`
OrderNo string `gorm:"size:32;index" json:"orderNo"`
PayloadHash string `gorm:"size:64" json:"payloadHash"`
ProcessedAt time.Time `json:"processedAt"`
CreatedAt time.Time `json:"createdAt"`
}
type EmailLoginCode struct {
ID uint `gorm:"primaryKey" json:"-"`
Email string `gorm:"size:254;index" json:"-"`
CodeHash string `gorm:"size:64" json:"-"`
Attempts int `gorm:"default:0" json:"-"`
ExpiresAt time.Time `gorm:"index" json:"-"`
UsedAt *time.Time `json:"-"`
CreatedAt time.Time `gorm:"index" json:"-"`
}