draft
This commit is contained in:
37
backend/internal/model/notify_log.go
Normal file
37
backend/internal/model/notify_log.go
Normal 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" }
|
||||
Reference in New Issue
Block a user