diff --git a/app/model/conf.go b/app/model/conf.go index 0c3bc91..e5b7a7d 100644 --- a/app/model/conf.go +++ b/app/model/conf.go @@ -15,8 +15,8 @@ type ConfKey string var confCache sync.Map type Conf struct { - K ConfKey `gorm:"column:k;type:varchar(32);primaryKey" json:"key"` - V string `gorm:"column:v;type:varchar(255)" json:"val"` + K ConfKey `Gorm:"column:k;type:varchar(32);primaryKey" json:"key"` + V string `Gorm:"column:v;type:varchar(255)" json:"val"` } func (c Conf) TableName() string { diff --git a/app/model/model.go b/app/model/model.go index 3876a54..a37fca6 100644 --- a/app/model/model.go +++ b/app/model/model.go @@ -13,12 +13,12 @@ var Db *gorm.DB var err error type Id struct { - ID int64 `gorm:"column:id;type:INTEGER PRIMARY KEY AUTOINCREMENT;;not null;comment:主键ID" json:"id"` + ID int64 `Gorm:"column:id;type:INTEGER PRIMARY KEY AUTOINCREMENT;;not null;comment:主键ID" json:"id"` } type AutoTimeAt struct { - CreatedAt *Datetime `gorm:"column:created_at;type:Datetime;not null;comment:记录创建时间;index" json:"created_at"` - UpdatedAt *Datetime `gorm:"column:updated_at;type:Datetime;not null;comment:最后更新时间" json:"updated_at"` + CreatedAt *Datetime `Gorm:"column:created_at;type:Datetime;not null;comment:记录创建时间;index" json:"created_at"` + UpdatedAt *Datetime `Gorm:"column:updated_at;type:Datetime;not null;comment:最后更新时间" json:"updated_at"` } func Init(path string) error { diff --git a/app/model/notify.go b/app/model/notify.go index af25db4..623bd5d 100644 --- a/app/model/notify.go +++ b/app/model/notify.go @@ -2,7 +2,7 @@ package model type NotifyRecord struct { Id - Txid string `gorm:"type:varchar(64);uniqueIndex;not null;comment:交易哈希"` + Txid string `Gorm:"type:varchar(64);uniqueIndex;not null;comment:交易哈希"` AutoTimeAt } diff --git a/app/model/order.go b/app/model/order.go index dd3a2cd..3e9f69b 100644 --- a/app/model/order.go +++ b/app/model/order.go @@ -51,26 +51,26 @@ var calcMutex sync.Mutex type Order struct { Id - OrderId string `gorm:"column:order_id;type:varchar(128);not null;index;comment:商户ID" json:"order_id"` - TradeId string `gorm:"column:trade_id;type:varchar(128);not null;uniqueIndex;comment:本地ID" json:"trade_id"` - TradeType string `gorm:"column:trade_type;type:varchar(20);not null;comment:交易类型" json:"trade_type"` - Fiat string `gorm:"column:fiat;type:varchar(16);not null;index;default:CNY;comment:法币" json:"fiat"` - Rate string `gorm:"column:rate;type:varchar(10);not null;comment:交易汇率" json:"rate"` - Amount string `gorm:"column:amount;type:varchar(32);not null;default:0.00;comment:交易数额" json:"amount"` - Money string `gorm:"column:money;type:varchar(32);not null;default:0.00;comment:订单交易金额" json:"money"` - Address string `gorm:"column:address;type:varchar(64);not null;comment:收款地址" json:"address"` - FromAddress string `gorm:"type:varchar(34);not null;default:'';comment:支付地址" json:"from_address"` - Status int `gorm:"type:tinyint(1);not null;default:1;index;comment:交易状态" json:"status"` - Name string `gorm:"type:varchar(64);not null;default:'';comment:商品名称" json:"name"` - ApiType string `gorm:"type:varchar(20);not null;default:'epusdt';comment:API类型" json:"api_type"` - ReturnUrl string `gorm:"type:varchar(255);not null;default:'';comment:同步地址" json:"return_url"` - NotifyUrl string `gorm:"type:varchar(255);not null;default:'';comment:异步地址" json:"notify_url"` - NotifyNum int `gorm:"column:notify_num;type:int(11);not null;default:0;comment:回调次数" json:"notify_num"` - NotifyState int `gorm:"column:notify_state;type:tinyint(1);not null;default:0;comment:回调状态 1:成功 0:失败" json:"notify_state"` - RefHash string `gorm:"column:ref_hash;type:varchar(128);not null;default:'';unique;comment:交易哈希" json:"ref_hash"` - RefBlockNum int64 `gorm:"column:ref_block_num;type:bigint(20);not null;default:0;comment:区块索引" json:"ref_block_num"` - ExpiredAt time.Time `gorm:"column:expired_at;type:timestamp;not null;comment:失效时间" json:"expired_at"` - ConfirmedAt time.Time `gorm:"type:timestamp;null;comment:交易确认时间"` + OrderId string `Gorm:"column:order_id;type:varchar(128);not null;index;comment:商户ID" json:"order_id"` + TradeId string `Gorm:"column:trade_id;type:varchar(128);not null;uniqueIndex;comment:本地ID" json:"trade_id"` + TradeType string `Gorm:"column:trade_type;type:varchar(20);not null;comment:交易类型" json:"trade_type"` + Fiat string `Gorm:"column:fiat;type:varchar(16);not null;index;default:CNY;comment:法币" json:"fiat"` + Rate string `Gorm:"column:rate;type:varchar(10);not null;comment:交易汇率" json:"rate"` + Amount string `Gorm:"column:amount;type:varchar(32);not null;default:0.00;comment:交易数额" json:"amount"` + Money string `Gorm:"column:money;type:varchar(32);not null;default:0.00;comment:订单交易金额" json:"money"` + Address string `Gorm:"column:address;type:varchar(64);not null;comment:收款地址" json:"address"` + FromAddress string `Gorm:"type:varchar(34);not null;default:'';comment:支付地址" json:"from_address"` + Status int `Gorm:"type:tinyint(1);not null;default:1;index;comment:交易状态" json:"status"` + Name string `Gorm:"type:varchar(64);not null;default:'';comment:商品名称" json:"name"` + ApiType string `Gorm:"type:varchar(20);not null;default:'epusdt';comment:API类型" json:"api_type"` + ReturnUrl string `Gorm:"type:varchar(255);not null;default:'';comment:同步地址" json:"return_url"` + NotifyUrl string `Gorm:"type:varchar(255);not null;default:'';comment:异步地址" json:"notify_url"` + NotifyNum int `Gorm:"column:notify_num;type:int(11);not null;default:0;comment:回调次数" json:"notify_num"` + NotifyState int `Gorm:"column:notify_state;type:tinyint(1);not null;default:0;comment:回调状态 1:成功 0:失败" json:"notify_state"` + RefHash string `Gorm:"column:ref_hash;type:varchar(128);not null;default:'';unique;comment:交易哈希" json:"ref_hash"` + RefBlockNum int64 `Gorm:"column:ref_block_num;type:bigint(20);not null;default:0;comment:区块索引" json:"ref_block_num"` + ExpiredAt time.Time `Gorm:"column:expired_at;type:timestamp;not null;comment:失效时间" json:"expired_at"` + ConfirmedAt time.Time `Gorm:"type:timestamp;null;comment:交易确认时间"` AutoTimeAt } diff --git a/app/model/rate.go b/app/model/rate.go index 9cb5acd..b5cb229 100644 --- a/app/model/rate.go +++ b/app/model/rate.go @@ -32,11 +32,11 @@ var SupportTradeCrypto = []string{string(TokenTypeUSDT), string(TokenTypeUSDC), type Rate struct { Id - Rate string `gorm:"column:rate;type:varchar(32);not null;comment:订单汇率" json:"rate"` - Fiat string `gorm:"column:fiat;type:varchar(16);not null;comment:法币" json:"fiat"` - Crypto string `gorm:"column:crypto;type:varchar(16);not null;comment:加密货币" json:"crypto"` - RawRate float64 `gorm:"column:raw_rate;type:decimal(10,4);not null;comment:基准汇率" json:"raw_rate"` - Syntax string `gorm:"column:syntax;type:varchar(32);not null;default:'';comment:浮动语法" json:"syntax"` + Rate string `Gorm:"column:rate;type:varchar(32);not null;comment:订单汇率" json:"rate"` + Fiat string `Gorm:"column:fiat;type:varchar(16);not null;comment:法币" json:"fiat"` + Crypto string `Gorm:"column:crypto;type:varchar(16);not null;comment:加密货币" json:"crypto"` + RawRate float64 `Gorm:"column:raw_rate;type:decimal(10,4);not null;comment:基准汇率" json:"raw_rate"` + Syntax string `Gorm:"column:syntax;type:varchar(32);not null;default:'';comment:浮动语法" json:"syntax"` AutoTimeAt } diff --git a/app/model/wallet.go b/app/model/wallet.go index cabeb9d..d7d194c 100644 --- a/app/model/wallet.go +++ b/app/model/wallet.go @@ -72,12 +72,12 @@ var TradeTypeTable = map[string]TokenType{ type Wallet struct { Id - Name string `gorm:"column:name;type:varchar(32);not null;default:-';comment:名称" json:"name"` - Status uint8 `gorm:"column:status;type:tinyint(1);not null;default:1;comment:地址状态" json:"status"` - Address string `gorm:"column:address;type:varchar(64);not null;uniqueIndex:idx_address;comment:钱包地址" json:"address"` - TradeType string `gorm:"column:trade_type;type:varchar(20);not null;uniqueIndex:idx_address;comment:交易类型" json:"trade_type"` - OtherNotify uint8 `gorm:"column:other_notify;type:tinyint(1);not null;default:0;comment:其它通知" json:"other_notify"` - Remark string `gorm:"column:remark;type:varchar(255);not null;default:'';comment:备注" json:"remark"` + Name string `Gorm:"column:name;type:varchar(32);not null;default:-';comment:名称" json:"name"` + Status uint8 `Gorm:"column:status;type:tinyint(1);not null;default:1;comment:地址状态" json:"status"` + Address string `Gorm:"column:address;type:varchar(64);not null;uniqueIndex:idx_address;comment:钱包地址" json:"address"` + TradeType string `Gorm:"column:trade_type;type:varchar(20);not null;uniqueIndex:idx_address;comment:交易类型" json:"trade_type"` + OtherNotify uint8 `Gorm:"column:other_notify;type:tinyint(1);not null;default:0;comment:其它通知" json:"other_notify"` + Remark string `Gorm:"column:remark;type:varchar(255);not null;default:'';comment:备注" json:"remark"` AutoTimeAt }