This commit is contained in:
2026-03-13 15:51:59 +08:00
parent 4db2386bbf
commit 4e91f4cede
133 changed files with 19502 additions and 37 deletions

View File

@@ -0,0 +1,37 @@
package model
import "time"
// NotifyStatus 通知状态
type NotifyStatus string
const (
NotifyStatusPending NotifyStatus = "PENDING"
NotifyStatusSuccess NotifyStatus = "SUCCESS"
NotifyStatusRetry NotifyStatus = "RETRY"
NotifyStatusGiveup NotifyStatus = "GIVEUP"
)
// NotifyType 通知类型
type NotifyType string
const (
NotifyTypePayment NotifyType = "PAYMENT"
NotifyTypeRefund NotifyType = "REFUND"
)
// NotifyLog 下游通知记录
type NotifyLog struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
TradeNo string `gorm:"column:trade_no;size:32;not null;uniqueIndex:uk_trade_notify_type"`
NotifyType NotifyType `gorm:"column:notify_type;size:20;not null;uniqueIndex:uk_trade_notify_type"`
NotifyURL string `gorm:"column:notify_url;size:512;not null"`
Status NotifyStatus `gorm:"column:status;size:20;not null;default:PENDING"`
RetryCount int `gorm:"column:retry_count;not null;default:0"`
NextRetryTime *time.Time `gorm:"column:next_retry_time;index:idx_status_next_retry"`
LastResponse string `gorm:"column:last_response;type:text"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime:milli"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime:milli"`
}
func (NotifyLog) TableName() string { return "notify_log" }